Repository navigation
fix(ssh): an SSH server update counts terminals again just before it stops the server - #30874
Conversation
…stops the server The SSH update passed the terminal census taken before the artifact upload and no recount, so a terminal opened during the upload was missed and, on a host running terminals inside orcad, ended by the restart. The recount is now a required deploy option, so every runtime (SSH, WSL, first deploy) supplies one and the stop step always recounts.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ➖ Normal Merge Risk: ⚪ Minimal · up to
|
…ake count Rebased onto #30874, which made recountCensus required and gave SSH its own recount. The SSH fence now supplies that recount, counting over the tunnel's current pairing without waking a server under the activation lock; an unanswered recount reads unverifiable, as on main. Co-Authored-By: Claude <noreply@anthropic.com>
ELI5
When Orca updates the server it runs on an SSH host, it first checks whether terminals are running there. On SSH, that check happened only once, before the slow upload of the new version. A terminal you opened while the upload was in progress was never counted, so the server restart could kill it.
What Changed
Mechanism:
recountCensuswas an optional field of the deploy step, and the SSH path never supplied it. It is now required, so SSH, WSL and first-time deploys all have to provide it or the code doesn't compile.orcad-installed-activation.ts).Why
Making the recount a required parameter closes the whole gap: no current or future runtime can leave it out. Patching only the SSH call would have left the same trap for the next runtime.
The first count stays before the upload, outside the host's activation fence (the host-side lock an update holds while it swaps versions). That's where a server that went idle can still be woken. Under the fence, a wake attempt only reads "fenced". So if the server stops during the upload, the recount comes back unverifiable and the update defers. That is the safe direction.
Rollback and decommission also count terminals before taking that lock, but no upload sits between their count and the stop. They are left as they are.
Found by Codex review 5, P1 #1.
Linked Issue
None. Found in an internal review.
Visual Proof
N/A: no UI change. The only visible difference is that an update now shows the existing "terminals running" deferral in a case where it used to restart.
Testing
I manually tested these changes locally
Automated tests added/updated, or explained why not below
A new test in
orcad-runtime-maintenance.test.tsfails on main: the SSH update hands the deploy no recount.In
orcad-remote-deploy.test.ts, a recount just before the stop defers the update in four cases: live terminals; terminals running inside the server, even when forced; an unreadable count, even when forced; and a recount that throws.WSL incumbent tests: an unproven incumbent's recount is unverifiable.
Ran locally:
src/main/wsl,src/main/managed-server,src/main/ssh/orcad*andsrc/main/ipc/runtime-environments(2127 tests pass);pnpm tc:node; and every step of the "static analysis and typecheck" job.Live-verified: nothing on a real host. Verified only in unit tests, plus the Docker managed-orcad e2e lane in CI.
Review
Codex (gpt-6.1-sol, high effort): clean on both heads.
An independent Opus review found no P0, P1 or P2 issues. Its three minor notes are handled here: a recount that throws now reads as unverifiable, the maintenance test was renamed, and the WSL test now checks the recount.
Agent skill upstream boundary
Notes