8000 fix(minimal-client): bound the exec ssh handshake so a burst of execs fails instead of hanging by gominimal-aw-bot[bot] · Pull Request #2016 · gominimal/minimal · GitHub
[go: up one dir, main page]

Skip to content

fix(minimal-client): bound the exec ssh handshake so a burst of execs fails instead of hanging - #2016

Merged
norrietaylor merged 2 commits into
mainfrom
inbox-patch/fix/exec-ssh-handshake-timeout-aec351f4de8971a1
Oct 6, 2026
Merged

norrietaylor merged 2 commits into
mainfrom
inbox-patch/fix/exec-ssh-handshake-timeout-aec351f4de8971a1

Conversation

@gominimal-aw-bot
@gominimal-aw-bot gominimal-aw-bot Bot commented Oct 6, 2026 •
Copy link
Copy Markdown
Contributor

Routing-Key: inbox-route/I_kwDOSUhdos8AAAABVYwvFA

A burst of min session exec commands can leave some execs hung forever in ssh: the ProxyCommand reaches the daemon socket, which accepts even when the guest side never answers, and the exec ssh invocation has no ConnectTimeout or ServerAlive* option to bound the connect and handshake. The RPC client already bounds the same step.

attach_command now adds -o ConnectTimeout=<HANDSHAKE_TIMEOUT seconds> to every invocation, and -o ServerAliveInterval=15 -o ServerAliveCountMax=4 (named consts EXEC_SERVER_ALIVE_INTERVAL_SECS / EXEC_SERVER_ALIVE_COUNT_MAX) only for the non-interactive exec path (wire: Some(_)), so a peer that stops answering ends the exec with exit 255 after about 60 s instead of hanging. A healthy long-running exec answers the keepalives, so the exec's own runtime stays unbounded. The interactive path keeps no keepalives so a laptop sleep does not kill the attach. HANDSHAKE_TIMEOUT is widened to pub(crate) so attach.rs can reuse its seconds. The 10 s bound applies after the VM is up (the RPC client already waits out the cold-boot budget and bounds its own handshake by the same constant), so it does not cut into the 150 s cold-boot timeouts.

Verification

Manual reproduction of the defect shape (OpenSSH_10.3p1): a ProxyCommand that accepts and never sends a banner, bounded by ConnectTimeout, exits 255 in about 1 s:

$ time ssh -F /dev/null -o 'ProxyCommand=sleep 30' -o ConnectTimeout=1 -o BatchMode=yes -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null x true
Connection timed out during banner exchange
Connection to UNKNOWN port 65535 timed out
... 1.010 total
rc=255

cargo fmt --all --check --manifest-path target/Cargo.toml — clean
cargo clippy --workspace --locked --manifest-path target/Cargo.toml -- -D warnings — Finished (0 warnings)
cargo build --workspace --locked --manifest-path target/Cargo.toml — Finished
cargo test --workspace --locked --manifest-path target/Cargo.toml — minimal-client 84 passed; checkouts 2 pre-existing sandbox failures (git-clone, unrelated to this change)
cargo test -p minimal-client attach_command_bounds_the_handshake — 1 passed

Summary by CodeRabbit

  • Bug Fixes
    • Attach connections now use a consistent connection timeout. Non-interactive sessions also use keepalive checks to help detect unresponsive connections.

…stead of hanging

A burst of `min session exec` commands can leave some execs hung forever in
ssh: the ProxyCommand reaches the daemon socket, which accepts even when the
guest side never answers, and the exec ssh invocation has no ConnectTimeout or
ServerAlive options to bound the connect and handshake.

Add `-o ConnectTimeout=<HANDSHAKE_TIMEOUT seconds>` to every invocation, and
`-o ServerAliveInterval=15 -o ServerAliveCountMax=4` only for the
non-interactive exec path, so a peer that stops answering ends the exec with
exit 255 instead of hanging. The interactive path keeps no keepalives so a
laptop sleep does not kill the attach.
@gominimal-aw-bot
gominimal-aw-bot Bot requested a review from a team as a code owner October 6, 2026 15:33
@gominimal-aw-bot gominimal-aw-bot Bot added the agent:fix Agentic fix PR eligible for review iteration; min-aw's worker-iterate gates on it. label Oct 6, 2026
@coderabbitai
coderabbitai Bot commented Oct 6, 2026 •
Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Essentials
  • Run ID: 3e76b47c-80b2-4b79-8046-bb3a54721007
📥 Commits

Reviewing files that changed from the base of the PR and between b2646a3 and 48c458c.

📒 Files selected for processing (2)
  • crates/minimal-client/src/attach.rs
  • crates/minimal-client/src/lib.rs

Included review availability: This review used your included allowance. Your plan provides up to 5 included reviews per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

Attach commands now use the shared handshake timeout. Exec channels also receive server-alive options; interactive attaches do not. Tests check the options for both attach modes.

Changes

SSH Attach Options

Layer / File(s) Summary
Configure SSH attach commands
crates/minimal-client/src/lib.rs, crates/minimal-client/src/attach.rs
The shared handshake timeout is crate-visible and applies to interactive and exec attach commands. Exec commands also set a 15-second server-alive interval and a maximum of four unanswered probes. Tests check the timeout and mode-specific options.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: 0chroma

Merge Risk: ⚪ Minimal · up to 48c45

This change bounds hung SSH connects and unresponsive exec sessions without affecting interactive attach. No actionable merge risk remains.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: bounding SSH handshakes for exec commands to prevent hangs. It is specific and follows the repository’s Conventional Commit format.
Description check ✅ Passed The description explains the problem and solution and provides detailed verification evidence. It uses “Verification” instead of the template’s “Testing” heading and omits the checklist, but it is oth…
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 2 files.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

A rabbit checks the timeout line
Exec sends pings at intervals fine
Four quiet probes, then pings are through
Interactive waits without them too
Tests hop along to check each cue

Comment @coderabbitai help to get the list of available commands.

@norrietaylor norrietaylor changed the title fix: bound the exec ssh handshake so a burst of execs fails instead of hanging fix(minimal-client): bound the exec ssh handshake so a burst of execs fails instead of hanging Oct 6, 2026
@gominimal-aw-bot gominimal-aw-bot Bot added the agent:resolve Consent gate: pr-conflict-resolver may rewrite this branch label Oct 6, 2026
@norrietaylor
Copy link
Copy Markdown
Member

/review

@norrietaylor
Copy link
Copy Markdown
Member

@coderabbitai review

@minimal-foundry
minimal-foundry Bot commented Oct 6, 2026 •
Copy link
Copy Markdown
Contributor

Approved: no findings at 48c458c6acb1.

Nothing to do.

Clobber: none: git log on both files shows only this PR's fix and a follow-up refactor since the last unrelated commit.

@coderabbitai
coderabbitai Bot commented Oct 6, 2026 •
Copy link
Copy Markdown
Contributor
⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@minimal-foundry minimal-foundry Bot left a comment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

minimal-review — approved

Verdict APPROVE — No findings.

@minimal-foundry minimal-foundry Bot added the review:approved minimal-review approved the current head label Oct 6, 2026
@norrietaylor
Copy link
Copy Markdown
Member

@coderabbitai review

@coderabbitai
coderabbitai Bot commented Oct 6, 2026 •
Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@norrietaylor norrietaylor left a comment
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

CodeRabbit and minimal-review approved this head; 0 unresolved threads; all lanes green.

@norrietaylor
norrietaylor added this pull request to the merge queue Oct 6, 2026
Merged via the queue into main with commit 6bec34b Oct 6, 2026
35 checks passed
@norrietaylor
norrietaylor deleted the inbox-patch/fix/exec-ssh-handshake-timeout-aec351f4de8971a1 branch October 6, 2026 17:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent:fix Agentic fix PR eligible for review iteration; min-aw's worker-iterate gates on it. agent:resolve Consent gate: pr-conflict-resolver may rewrite this branch review:approved minimal-review approved the current head

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

0