Repository navigation
fix(orcad): refuse an update that would end a degraded host's in-process terminals - #25598
Conversation
…ess terminals The census now reports inProcessSessions separately. Those terminals run inside orcad and end with any restart, so planOrcadUpdate defers with a non-forceable orcad_update_ends_in_process_terminals instead of claiming they survive on the daemon.
There was a problem hiding this comment.
ℹ️ No critical issues — one order-of-checks issue inline, plus a wire-compat note.
Reviewed changes
- Census field.
OrcadTerminalCensusSchemagains an optionalinProcessSessions; the orcad census computes it (and the hostUNVERIFIABLEconstant now carriesnull), so an unreadable census reports unknown rather than zero. - Update planner.
planOrcadUpdatedefers with the neworcad_update_ends_in_process_terminalswheninProcessSessions ?? 0 > 0, ahead of the live-session/force branches. - Not forceable.
isForceableOrcadDeferralis unchanged, so the new code offers no Force path, and auto-update treats it as a wait-and-retry code. - Surfaces. The renderer maps the code to the existing live-terminal copy; the telemetry failure enum gains
update_ends_in_process_terminalsvia theorcad_prefix strip. - Tests. Census expectations gain
inProcessSessions; a new update-plan case drives the real census and pins the deferral for forced and unforced.
ℹ️ inProcessSessions absence also describes the #25545-only host
The body says an older host that omits the field "is exactly what that host knew before." That is true for a host predating #25545, but the base branch already contains #25545 (6cf918a0f3), which counts in-process terminals in liveSessions while (before this PR) omitting the field. If any build ships between #25545 and this PR, input.census.inProcessSessions ?? 0 treats that host's in-process terminals as none, and a forced update proceeds with the "They survive the restart" note — the exact loss this PR prevents. If the phase branch merges wholesale (as #24863 implies) there is no such build and this is moot; otherwise the ?? 0 default is the gap.
Technical details
# Wire-compat default for `inProcessSessions`
## Affected sites
- `src/main/ssh/orcad-update-plan.ts:115` — `const inProcess = input.census.inProcessSessions ?? 0`.
- `src/main/ssh/orcad-update-plan.ts:82-91` — force + `unverifiable` returns before the in-process guard.
## Required outcome
- Decide whether a build can exist between #25545 and this PR. If it can, an absent
`inProcessSessions` on a host whose `liveSessions > 0` must not be read as zero when forcing.
## Suggested approach (only if a build can ship in that window)
- Treat absent-while-live as unverifiable and refuse force, or hold #25545 and this PR to the
same release.deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏
| const inProcess = input.census.inProcessSessions ?? 0 | ||
| // Why force cannot override: these run inside orcad, so no daemon carries them across. | ||
| if (inProcess > 0) { |
There was a problem hiding this comment.
On the canonical degraded host — an empty daemon plus in-process terminals, which the census test pins as { liveSessions: 1, daemonProtocolVersion: null, inProcessSessions: 1 } — the force && crossing === 'unverifiable' guard at lines 82-91 runs first. A forced update therefore returns orcad_update_daemon_protocol_unverifiable and its "Retry when the daemon answers" reason instead of this code, so the exact host this PR targets gets the wrong explanation (the unforced path is already correct). Move this block above that guard, and add a daemonProtocolVersion: null case to the new it.each.
Technical details
# Forced update names the wrong refusal for a degraded host
## Affected sites
- `src/main/ssh/orcad-update-plan.ts:115-117` — in-process guard sits after the force + `unverifiable` early return at `:82-91`.
- `src/main/ssh/orcad-update-plan.test.ts:89-118` — the new test only covers a daemon session on an `attachable` protocol, so it never exercises the forced/degraded branch.
## Evidence
- Verified with a throwaway test: `census: { liveSessions: 1, startedSinceActivation: null, daemonProtocolVersion: null, inProcessSessions: 1 }, force: true` returns `{ code: 'orcad_update_daemon_protocol_unverifiable', reason: 'The terminal daemon did not report its protocol … Retry when the daemon answers.' }`.
## Required outcome
- A forced update whose only live terminals run in-process returns `orcad_update_ends_in_process_terminals` with the restart-ends-them reason.
## Suggested approach
- Move the `inProcess > 0` block above the `if (input.force && crossing === 'unverifiable')` block (leaving the `strands-live-terminals` precedence unchanged).
- Add a force case using a census with `daemonProtocolVersion: null` and `inProcessSessions: 1`.
ELI5
When a managed Orca server's background terminal process is in a reduced ("degraded") mode, new terminals run inside the server process itself, so a restart ends them. Updating the server, even when forced, could restart it and end those terminals, while the update message said the terminals would survive. Now Orca refuses that update and says why.
What Changed
Before
--force(CLI) or the force option in the UI, it proceeded with the note "They survive the restart on the existing daemon". The restart then ended every in-process terminal.After
inProcessSessionsfield. They are still included inliveSessions. An unreadable census reports the field as unknown, not zero.planOrcadUpdatedefers with a new code,orcad_update_ends_in_process_terminals, before any force handling. The reason says the terminals run inside the orcad process because its daemon is degraded, that any restart ends them, and that forcing cannot keep them alive.isForceableOrcadDeferraldoesn't include the new code, so the UI offers no Force button and the CLI's--forcegets the same refusal.update_ends_in_process_terminals, so it isn't recorded asother.Why
Linked Issue
Phase 3 round-6 review (medium, internal).
Visual Proof
N/A. No layout changes; the update action shows the existing "terminals still running" message for this case.
Testing
New in
orcad-update-plan.test.ts: a degraded host goes through the real census and the update plan. It has one daemon session on a protocol the new build can attach to, plus two in-process terminals. Both the unforced and the forced update defer with the new code, and the reason says the restart ends them. The existing census tests now expectinProcessSessions.Ran locally:
pnpm tc:node, the changed-code gate, the format check, and the census and update-plan tests.Review
Agent skill upstream boundary
docs/reference/agent-skill-sharing-upstream-boundary.mdand copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.Notes
inProcessSessionsis a new optional field. An older host leaves it out and the plan treats that as no in-process terminals, which is exactly what that host knew before. An older client ignores it.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)