Repository navigation
fix(ssh): a managed tunnel follows the server's port after another desktop restarts it - #30888
Conversation
…r desktop restarts the server The tunnel was rebuilt only when this desktop's own check saw the server start. When another desktop restarted it onto a new port, the old forward stayed and every check answered unverifiable. A check that finds the server not answering now reads the port the host's readiness record names and, when it moved, rebuilds the tunnel there.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ⬇️ Low Merge Risk: ⚪ Minimal · up to
|
…0918) * fix(ssh): move the managed tunnel's is-current check beside its record (fix red main) orcad-managed-tunnel-manager.ts reached 301 counted lines when #30891 landed on #30888, failing every PR's static analysis. The six-field check that the recorded tunnel already matches the connection and deployment moves, unchanged, into orcad-managed-tunnel-active.ts, which owns that record. * style: format the 22 files main merged unformatted (fix red main) CI's format check fails every PR on these files. Formatting pushes NativeChatStructuredSession.tsx one line past its 400-line limit, so its one-use question list is inlined where questionBody is already non-null (identical behavior: agentSessionPromptQuestions is pure and ran on every render).
ELI5
A managed Orca server runs on an SSH host, and this desktop reaches it through a tunnel to the server's port. If a different desktop restarted that server (for example, by updating it) and it came back on a new port, this desktop kept its tunnel pointed at the old port. Every health check then failed with "unverifiable". Now, when the server stops answering through the tunnel, the desktop asks the host which port the server is on now, and moves the tunnel if it changed.
What Changed
state: 'started'with a newboundPort). If another desktop restarted the server, this desktop's check found a live server process that was not answering on the old port. It reportedunverifiableand kept the old forward. Resume recovery hit the same check and stayedunverifiableforever.unverifiable, the tunnel reads the port named in the host's current readiness record, the same record a fresh tunnel build already uses. If that port differs from the forwarded one, the check drops the forward and the tunnel is rebuilt there.verifyServingthen answers from the rebuilt tunnel.readActiveSlotBoundPort, used by both tunnel builds (resolveManagedOrcadTunnelPort) and the new check (readManagedOrcadPublishedPort). The new check returnsnullwhen the host names no port (older servers) or cannot be read.nullnever moves a tunnel.Why
The host owns the truth about which port its server is bound to; this desktop's own events are only a partial view. Following the host's record covers every way the port can move: another desktop's update, a wake, or a crash restart. It needs no new events or wire messages.
Alternatives considered:
Wire compatibility: hosts that do not publish a bound endpoint return
null, so the old behavior is kept for them.Linked Issue
Internal review item (managed SSH tunnel lifecycle, item 6). No GitHub issue.
Visual Proof
N/A: there is no UI change. This is the tunnel's recovery behavior behind the existing managed-server status.
Testing
New
orcad-managed-tunnel-peer-restart.test.ts. It uses the real forward manager with a fake transport and a host whose server another desktop moves from 6768 to 7001.verifyServingnow answersservingwith the forward at 7001. On main it answersunverifiableand keeps 6768; this case fails on main.All
src/main/managed-server/lifecyclesuites pass. The full static-analysis job was run locally and passes.Not exercised live against two real desktops. The Docker managed-orcad e2e lane covers the surrounding tunnel paths in CI.
I manually tested these changes locally
Automated tests added/updated, or explained why not below
Review
ensurerebuilds it, which matches the existing "drop now, rebuild on next ensure" design.Agent skill upstream boundary
Notes
null.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)