Repository navigation
fix(ssh): a new desktop can connect to a host already running a different Orca server version - #28642
Conversation
…rent Orca server version A first connect onto a host whose managed server another Orca version started deferred the update (its terminal count needs pairing) and failed the connect. Pair with the running build as it is, before uploading anything, then let the linked update check ask it for its terminals.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ➖ Normal Merge Risk: ⚪ Minimal · up to
|
…rent Orca server version (stablyai#28642) A first connect onto a host whose managed server another Orca version started deferred the update (its terminal count needs pairing) and failed the connect. Pair with the running build as it is, before uploading anything, then let the linked update check ask it for its terminals. Co-authored-by: m4air <[email protected]> (cherry picked from commit 8400aa5)
ELI5
If another copy of Orca (a different version) already started Orca's server on an SSH host, a desktop connecting to that host for the first time now joins that server instead of failing. It updates the server later only if that's safe.
What Changed
Before: A fresh desktop profile connecting to a host whose managed server was started by a different Orca version failed with "Orca couldn't start its server on this host. Try connecting again." Retrying never helped, whether or not terminals were open on the host. This also happened when the host's server was newer than the desktop.
After: The desktop pairs with the server that's already running, keeps that server's version, and connects. Right after pairing, it runs the same update check that every linked desktop runs on connect. That check asks the server how many terminals are live and updates it only when the existing rules allow (no terminals running, and the host isn't on a newer Orca). Otherwise the desktop stays connected and shows the usual "update deferred" or "host is newer" note.
Mechanism:
createManagedOrcadEnvironmentnow checks the host's activation record before uploading anything. If it names a different version,adoptRunningOrcadVersion(new file,orcad-running-version-adoption.ts) handles it:wakeStoppedManagedOrcad, so a server is started only if it's proven stopped, and only under the host fence.already-currentwith the running version.--force, and a relay migration. So the downgrade refusal still applies when nothing is running.ssh-host-server-on-connect.ts: after a deploy returnsalready-current, the connect runscheckManagedServerUpdate. Without this, an adopted server would only be offered an update on the next connect.Why
evaluateRuntimeCompat). A server too old to speak this client's protocol is reported as incompatible, not used silently. An older server that can't answer the terminal count leaves the update deferred, and the client never assumes zero.readWslOrcadIncumbent) and keep it serving while an update waits, so that path doesn't need this change. A WSL host running a newer Orca still reports a forceable deferral, which is deliberate and covered by its own test. That's unchanged here.Linked Issue
Found while testing the 1.4.225 release candidate (candidate 8).
Visual Proof
N/A: no UI change. The connect now succeeds and uses the existing status notes.
Testing
orcad-running-version-adoption.test.ts: covers adopting a serving build (checked against its own installed hash), adopting a build that was stopped and restarted only after being proven stopped, falling back to the deploy when the host was stopped, fenced or moved to this build in the meantime, and an unverifiable or unrecoverable host, which throws and launches nothing.orcad-runtime-deployment.test.ts: covers a host on an older and on a newer Orca, each adopted with no upload or restart,--forcestill deploying, the same-version path unchanged (no wake, deploy returns already-active), and an unverifiable host, which registers nothing.ssh-host-server-on-connect.test.ts: covers the update check running right after adoption, with a deferral shown as a note on a managed connect.pnpm tc:node,pnpm test src/main/ssh src/main/ipc src/main/wsl(8350 passed),pnpm run check:code-quality:changed.I didn't run a real Docker host check: Docker isn't available on the machine this was built on.
I manually tested these changes locally
Automated tests added/updated, or explained why not below
Review
Agent skill upstream boundary
Notes
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)