feat(cli): add explicit SSH fallback for remote agent attach - #1483
Conversation
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughThe CLI adds ChangesRemote node attachment
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant LocalAgentCLI
participant attachRemoteNode
participant SSH
participant RemoteRelay
LocalAgentCLI->>attachRemoteNode: Request attachment for agent and node
attachRemoteNode->>SSH: Start quoted remote attach command
SSH->>RemoteRelay: Execute remote attach command
RemoteRelay-->>SSH: Return output and exit status
SSH-->>attachRemoteNode: Propagate process result
attachRemoteNode-->>LocalAgentCLI: Return attachment status
Possibly related PRs
Suggested labels: Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fd695e70b9
ℹ️ 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".
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@CHANGELOG.md`:
- Line 12: Update the changelog heading containing “Unreleased - Minor” to the
exact “## [Unreleased]” form, preserving the new agent-relay entry beneath it.
In `@packages/cli/src/cli/commands/local-agent.ts`:
- Around line 510-511: Update the node-selection logic around options.node to
check for undefined rather than truthiness, so an explicit empty --node value
enters attachRemoteNode and is rejected by remote validation. Add a regression
test covering --node '' and verify it does not start local attachment.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 36749f5b-2a45-4ca4-add2-1c07485ed18e
📒 Files selected for processing (7)
.agentworkforce/trajectories/completed/2026-08/traj_jzmkf8ctib43/summary.md.agentworkforce/trajectories/completed/2026-08/traj_jzmkf8ctib43/trajectory.jsonCHANGELOG.mdpackages/cli/src/cli/commands/local-agent.test.tspackages/cli/src/cli/commands/local-agent.tspackages/cli/src/cli/lib/attach-remote-node.test.tspackages/cli/src/cli/lib/attach-remote-node.ts
There was a problem hiding this comment.
All reported issues were addressed
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/cli/src/cli/commands/local-agent.ts`:
- Around line 512-513: Update the conflict check in the local-agent command to
detect brokerUrl and apiKey whenever either option was explicitly supplied,
including empty-string values, by checking against undefined rather than
truthiness. Add tests covering --ssh-host combined with each empty broker
option.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: ab3401ad-b76d-4b38-991f-27d29ecab397
📒 Files selected for processing (5)
CHANGELOG.mdpackages/cli/src/cli/commands/local-agent.test.tspackages/cli/src/cli/commands/local-agent.tspackages/cli/src/cli/lib/attach-remote-node.test.tspackages/cli/src/cli/lib/attach-remote-node.ts
🚧 Files skipped from review as they are similar to previous changes (3)
- CHANGELOG.md
- packages/cli/src/cli/lib/attach-remote-node.test.ts
- packages/cli/src/cli/commands/local-agent.test.ts
There was a problem hiding this comment.
All reported issues were addressed across 6 files (changes from recent commits).
Tip: Review your code locally with the cubic CLI to iterate faster.
Re-trigger cubic
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/cli/src/cli/lib/attach-remote-node.ts`:
- Around line 62-66: Update the broker PID discovery command in attachRemoteNode
to request and propagate the broker’s own PID rather than ppid, so the
subsequent state-directory lookup uses broker_pids directly. Preserve the
existing command matching and filtering logic.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 49ec5b78-bf2a-4a8c-8106-8e105a1abfd7
📒 Files selected for processing (4)
packages/cli/src/cli/commands/local-agent.test.tspackages/cli/src/cli/commands/local-agent.tspackages/cli/src/cli/lib/attach-remote-node.test.tspackages/cli/src/cli/lib/attach-remote-node.ts
🚧 Files skipped from review as they are similar to previous changes (3)
- packages/cli/src/cli/lib/attach-remote-node.test.ts
- packages/cli/src/cli/commands/local-agent.test.ts
- packages/cli/src/cli/commands/local-agent.ts
There was a problem hiding this comment.
All reported issues were addressed across 4 files (changes from recent commits).
Tip: Review your code locally with the cubic CLI to iterate faster.
Re-trigger cubic
barryollama
left a comment
There was a problem hiding this comment.
Independent exact-head review complete at 986b90e. All 11 review threads are resolved; latest-head checks are terminal with 36 passing and 5 change-scope skips; focused remote tests, the 333-test attach/local-agent suite, CLI/core builds, lint, formatting, and diff checks passed. Approving. No merge performed.
Closes the physical-node fallback slice of #1449.
What changed
agent-relay node agent attach <name> --ssh-host <host>as an explicit SSH fallback--nodefor the canonical fleet-native attach pathview,drive, andpassthroughssh -Tfor--jsonso NDJSON stdout is not contaminated by a PTY or login banner--state-dir; otherwise discovers host-managed state, the standard project-local broker state, or one unambiguous managed-node fallbackLive Barry proof
From Khaliq's Mac, against
chief-barry-codex-0811-1440:--ssh-host barry --mode viewrendered the live Chief TUI--ssh-host barry --mode drivedelivered input and Chief repliedNODE_DRIVE_OK--ssh-host barry@barrys-mac-mini.tail9110d0.ts.net --mode viewproved SSH-alias/FQDN discoveryVerification
npm run build:corenpm run build:cligit diff --checkpassedScope boundary
SSH is the explicit fallback, not the canonical node identity or transport. Fleet-native
--nodeshould resolve placement through Relay/Cloud and open an outbound ephemeral terminal stream, with the same path serving physical nodes and Daytona sandboxes without inbound SSH.