Repository navigation
Conversation
The device-host tunnel inherited ControlMaster/ControlPersist from the user's ssh config, so it became a mux client that handed its forwards to the control master and exited. The reconnect loop then leaked two listening ports into the master every ~1.5 s until the ephemeral range ran out. Opt the tunnel out of multiplexing, as the environment tunnel already does (pingdotgg#4347). Fixes pingdotgg#17437 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Contributor
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — This is a narrowly scoped SSH tunnel bug fix that prevents device-host forwards from being handed to a persistent ControlMaster, while leaving bootstrap commands unchanged. The production change is isolated and accompanied by focused argument-level tests. You can add or adjust custom eligibility rules. Learn more. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
With
ControlMaster auto/ControlPersistin~/.ssh/config, the SSH device-host tunnel spawned bySshDeviceHost.connectOncebecomes a mux client. It hands its-Lforwards to the control master and exits 0 at once. The reconnect loop then treats each cycle as a healthy reconnect, about every 1.5 s, and every pass leaks one or two more loopback listeners into the master (the hub forward, plus the daemon forward when agent tools are enabled). Left running, this fills the whole IPv4 ephemeral range (32768–60999), and every outboundconnect()on the machine fails withEADDRNOTAVAIL, not just T3's. Full report, trace evidence and environment: #17437.Change
The device-host tunnel spawn now passes
-o ControlMaster=no -o ControlPath=none -o ControlPersist=no, the same optionsstartSshTunnelinpackages/ssh/src/tunnel.tshas used since #4347. The tunnel then owns its own connection and its forwards, and they close when the tunnel exits.The options are added to the long-lived
-Nspawn only, not tobaseSshArgs. Short bootstrap commands keep multiplexing if the user has configured it.Scope and approval
Fixes #17437, which maintainers have triaged (
bug, plus the maintainer-bot analysis on the issue). This is that analysis's first suggested direction. It is a very small fix for an obvious bug: the device-host tunnel (#10856) missed the multiplexing opt-out that #4347 added to the environment tunnel for the same failure (#3533).Out of scope, for separate PRs if wanted:
ready.Verification
Focused test.
SshDeviceHost.test.tsnow records the args of every spawned ssh command. It asserts that each tunnel spawn (-N) passes all three options as-ovalues, and that bootstrap commands pass none of them.pnpm exec vp test run apps/server/src/device/SshDeviceHost.test.tsfails withAssertionError: expected -1 to be greater than 0at theControlMaster=nolookup.Test Files 1 passed (1) · Tests 1 passed (1).vp checkon both files: no lint or format issues.vp run --filter t3 typecheck: 0 errors.Live OpenSSH check. OpenSSH 10.5p1 on Linux, against a macOS device host. A throwaway
-Fconfig forcesControlMaster auto/ControlPersist 60ahead of the user's own config. A bootstrap-stylessh <host> truefirst creates the master, then each tunnel argv runs against it:Not checked: I did not run a full dev server end to end against a device host, and I did not test on macOS or Windows server hosts. The change only adds ssh
-ooptions, and they are the same ones the environment tunnel already ships on every platform.Model and harness: Claude Opus 5.5 (
claude-opus-5-5) in Claude Code, viat3 triage.🤖 Generated with Claude Code