Skip to content

feat(ssh): support -- to pass commands to remote host - #800

Merged
cdalar merged 4 commits into
mainfrom
feat/ssh-command-passthrough
Feb 25, 2026
Merged

cdalar merged 4 commits into
mainfrom
feat/ssh-command-passthrough

Conversation

@cdalar

@cdalar cdalar commented Feb 24, 2026

Copy link
Copy Markdown
Owner

Summary

  • Adds Docker-style -- command passthrough to onctl ssh
  • onctl ssh VM_NAME -- COMMAND [ARGS...] runs the command on the remote instead of opening an interactive session
  • Without --, behavior is unchanged — drops into an interactive SSH session as before

Usage

# Run a command on the remote
onctl ssh zero -- zeroclaw --help
onctl ssh zero -- systemctl status nginx

# Interactive session (unchanged)
onctl ssh zero

Test plan

  • onctl ssh <vm> still opens interactive session
  • onctl ssh <vm> -- <cmd> executes command on remote and exits
  • Exit code from remote command is propagated correctly

🤖 Generated with Claude Code

Adds Docker-style command passthrough via --:
  onctl ssh VM_NAME -- COMMAND [ARGS...]

Without --, behavior is unchanged (interactive SSH session).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c3efdee7e1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread cmd/ssh.go Resolved
cdalar and others added 2 commits February 25, 2026 07:25
… used

Previously args[1:] was always passed to SSHInto, causing any extra
positional arg to be treated as a remote command even without --.
Now os.Args is checked directly for -- since Cobra strips it before
passing to Run.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@codecov

codecov Bot commented Feb 25, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 29.41176% with 12 lines in your changes missing coverage. Please review.
✅ Project coverage is 11.76%. Comparing base (c9a538d) to head (62afa8a).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
internal/tools/ssh.go 0.00% 3 Missing ⚠️
internal/cloud/aws.go 0.00% 2 Missing ⚠️
internal/cloud/azure.go 0.00% 2 Missing ⚠️
internal/cloud/gcp.go 0.00% 2 Missing ⚠️
internal/cloud/hetzner.go 0.00% 2 Missing ⚠️
cmd/ssh.go 83.33% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #800      +/-   ##
==========================================
+ Coverage   11.58%   11.76%   +0.17%     
==========================================
  Files          36       36              
  Lines        3115     3127      +12     
==========================================
+ Hits          361      368       +7     
- Misses       2710     2716       +6     
+ Partials       44       43       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Extract inline os.Args scanning into parseRemoteCmd helper and add
unit tests to satisfy codecov/patch requirement.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@cdalar
cdalar enabled auto-merge (squash) February 25, 2026 06:13
@cdalar

cdalar commented Feb 25, 2026

Copy link
Copy Markdown
Owner Author

Resolved the Codex P2 review: fixed in 9753804 by extracting os.Args scanning into parseRemoteCmd() which only returns a non-nil slice when -- is explicitly present. Added unit tests in TestParseRemoteCmd for full coverage.

@cdalar
cdalar merged commit 869ade0 into main Feb 25, 2026
15 checks passed
@cdalar
cdalar deleted the feat/ssh-command-passthrough branch August 19, 2026 13:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

⌂ 换网址