SSH reconnect can reuse an older remote server while the desktop-pinned CLI mints a pairing grant the server cannot decode. Read the running server version through the existing HTTP forward and use that release CLI to issue the grant. Discovery failures stop pairing; development Node-script runners keep their configured runner.
Keep the pairing runner in pair-t3.sh so version selection cannot rewrite the launch runner or trigger a later restart. Fixes #16984.
Verification:
- Focused tunnel suite: 39 passed (34 current-main cases plus 5 retained PR cases, reduced from 9 additions). The original PR had 29 cases before main added coverage. The archive regression fails against exact main on the desktop-version credential instead of the running-server-version credential.
- SSH package typecheck, targeted lint, formatting and whitespace checks pass.
- Current-head production-manager before/after proof: main returns HTTP 500 and overwrites the launch runner; ac23054c56 pairs twice with HTTP 200, preserving launch-script bytes and the server PID. This uses a controlled SSH command adapter with real HTTP, generated shell execution and verified Linux release binaries.
- Independent full-diff Codex and Claude reviews: one round, no actionable findings on ac23054c56.
- Linux x64 release proof, both archives checked against their release SHA256SUMS: October 7 CLI → unchanged October 4 server returns HTTP 500
access_token_issuance_failed; matching October 4 CLI → same server PID returns HTTP 200, and /api/auth/session confirms authentication. This used an isolated temporary home and direct loopback HTTP; it is separate from the SSH manager selection tests. The temporary server and state were cleaned up.
Pairing requires an available release archive matching the reported version; source/fork servers without a matching published archive fail rather than fall back to the desktop CLI. The first pairing may download that archive.
The remaining human gate is authentication-sensitive maintainer review, as required by Macroscope. Electron reconnect, real SSH/Tailscale transport and remote active-agent preservation were not exercised end to end. macOS, Windows, iOS and Android were not verified on this headless Linux machine. This is a backend pairing change; screenshots are not applicable.
Credit to @voltcrash for the original fix in #17550. The takeover preserves contributor commits and merges current main without rewriting history.
Implementation/integration: Codex gpt-6.1-sol (high) in T3 Code; tests: Codex gpt-6-astra (high); adversarial reviews: Codex gpt-6-sol (high) and Claude claude-opus-5-5 (high).
Modernized against upstream 15fe28327278. Preserved upstream’s diagnostic-tail test and private script helpers, and retained the HostProcess/FileSystem services required by the pairing fixture. All 13 selected tests and five affected package typechecks passed. vp run check:changed upstream/main --concurrency 1 passed. Existing runtime evidence above remains historical; no new live provider or SSH session was run.
Modernized with GPT-6.1 Sol in the Codex harness.
Note
Reviews paused#
It 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
reviews.auto_review.auto_pause_after_reviewed_commitssetting.Use the following commands to manage reviews:
@coderabbitai resumeto resume automatic reviews.@coderabbitai reviewto trigger a single review.Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review.
Walkthrough
SSH pairing selects an archive runner using the running remote server’s version and writes its script to a separate file. Node-script runners bypass version discovery. Tests cover repeated pairing and discovery failures.
Changes: SSH pairing runner selection
packages/ssh/src/tunnel.ts,packages/ssh/src/tunnel.test.tsSshPairingError. Node-script runners bypass discovery. Pairing writes topair-t3.sh; tests cover repeated pairing and discovery failures.Estimated code review effort: 3 (Moderate) | ~20 minutes
Change: Bug fix · Severity of issue fixed: Medium
Sequence Diagram(s)#
Possibly related issues
Suggested reviewers:
tris203Merge Risk:
Minimal · previous review
11598Pairing selects a matching CLI for reused release servers. No actionable merge-blocking issue was identified.
Security architecture risk:
Low · up to
ac230The change preserves the server’s launch configuration while selecting a compatible pairing release. Version validation and existing access controls limit the additional authority, but recovery after interrupted pairing has not been established across older releases.
Retained concerns No architecture-level concerns identified.
Security review details
Security Blast Radius
Security Findings and Attack Paths
Trust Boundaries and Controls
Resilience and Maintainability Implications
Pre-merge checks:
4
#16984is closed and supplies historical context only. No active directly linked issue adds coding requirements. The reviewed changes still implement the stated historical fix:tunnel.tsdisco…packages/ssh/src/tunnel.ts. Test changes c…Full details: Description check
Explanation
The description explains the problem, implementation, scope, limitations, linked issue, and detailed verification results. It does not use the template headings exactly, and maintainer approval remains pending, but the required information is mostly present.
Full details: Linked Issues check
Explanation
Issue
#16984is closed and supplies historical context only. No active directly linked issue adds coding requirements. The reviewed changes still implement the stated historical fix:tunnel.tsdiscovers the running server version through the forwarded HTTP endpoint, selects that release for archive pairing, preserves the configured Node-script runner, and keeps pairing inpair-t3.sh. Focused tests cover successful reuse and discovery failures.Full details: Out of Scope Changes check
Explanation
The reviewed changes stay within SSH pairing recovery. Production code changes version discovery, pairing-runner selection, and pairing-script isolation in
packages/ssh/src/tunnel.ts. Test changes cover runner preservation, repeated pairing, version discovery, and failure behavior. No unrelated UI, provider, protocol, or server-lifecycle changes are shown.Finishing Touches
Generate unit tests (beta)
6c75fe6a-5e13-40a1-ba68-9821c4cb2645Reviewing files that changed from the base of the PR and between ac23054c565db5f2e76ad62c112d453ddf61bf5d and 115982f603343966a88941921db420a47bf877df.
packages/ssh/src/tunnel.test.tspackages/ssh/src/tunnel.tsLimit details: You’ve used all 10 included reviews currently available.