Skip to content

fix(orcad): count a degraded daemon's in-process terminals in the terminal census - #25545

Merged
OrcaWin merged 1 commit into
OrcaWin/node-rt-phase3from
OrcaWin/node-rt-p3-degraded-census
Oct 5, 2026
Merged

OrcaWin merged 1 commit into
OrcaWin/node-rt-phase3from
OrcaWin/node-rt-p3-degraded-census

Conversation

@OrcaWin

@OrcaWin OrcaWin commented Oct 5, 2026 •

Copy link
Copy Markdown
Collaborator
Files Added Deleted Net
Test 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​47 $\color{#cf222e}{\Huge{\mathbf{−}}}$​5 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​42
Prod 3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​23 $\color{#cf222e}{\Huge{\mathbf{−}}}$​8 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​15

ELI5

Before an update or a stop, the managed Orca server counts the terminals still running on its host. If it counts zero, it restarts or stops freely. When the background terminal process was running in a reduced mode, new terminals ran inside the server process itself, and the count left them out. The server could then report "nothing running", restart, and kill those terminals and the agents in them. Now they are counted.

What Changed

Before

  • When orcad takes over an existing terminal daemon that can no longer start new terminals ("degraded" mode), every new terminal runs on the local fallback provider, as a child of the orcad process.
  • collectOrcadTerminalCensus listed only the daemon's sessions. listLiveDaemonSessionsWithProtocol walks getAllAdapters(), which never includes that fallback.
  • With an empty daemon and agents running in-process, the census answered 0 live sessions. Then:
    • an update went ahead without force and without preserving the daemon;
    • a rollback or stop passed its census check;
    • stopping orcad closed those terminals.
  • The idle check didn't have this problem, because it already reads the full local provider.

After

  • The census also counts the degraded provider's in-process terminals, through the new countInProcessFallbackTerminals() in daemon-provider-state.ts, and adds them to liveSessions.
  • When any in-process terminal exists, startedSinceActivation becomes unknown, because those terminals carry no creation time to compare.
  • If the in-process list can't be read, the whole census reads unverifiable instead of 0.
  • Outside degraded mode the fallback adds nothing, so a healthy daemon's census is unchanged.
  • To read the fallback, DegradedDaemonPtyProvider.fallback is now a public read-only field rather than private.

Why

  • Count the terminals rather than always answering "unverifiable" in degraded mode. A real count lets an update defer, or tell the user how many terminals are running, the same way a live daemon does. "Unverifiable" stays reserved for when the count can't be read.
  • Only the fallback is added. The degraded provider's full listProcesses() already includes the daemon's sessions, so using it would count those twice.

Linked Issue

Phase 3 round-5 review (high, internal).

Visual Proof

N/A. No UI changes; the visible effect is that an update or stop now waits for, or reports, these terminals instead of killing them.

Testing

  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below

New tests:

  • orcad-terminal-census.test.ts:
    • an empty daemon plus one in-process terminal counts as 1 live session, with the since-activation count unknown;
    • an in-process list that fails makes the census unverifiable.
  • degraded-daemon-pty-provider.test.ts: a fresh terminal on a degraded provider shows up in fallback.listProcesses() and not in the daemon adapters.

Ran locally: pnpm tc:node, the changed-code gate (0 findings), oxlint, the format check, and the tests above. pnpm build:orcad passes with zero electron and node:sqlite imports.

Review

Agent skill upstream boundary

  • Not applicable, or this change follows docs/reference/agent-skill-sharing-upstream-boundary.md and copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

SSH execution boundary: the host still owns the verdict. A list it can't read is reported as unverifiable, never as zero. The census message's shape is unchanged; only its numbers differ.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

…minal census

In degraded mode fresh terminals run on the local fallback inside orcad, but the census read
only daemon adapters, so an update or stop saw 0 live sessions and killed running agents.
@pullfrog

pullfrog Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

This run was cancelled 🛑

The workflow was cancelled before completion. Please check the link below for details.

Pullfrog  | View workflow run | via Pullfrog | 𝕏

@OrcaWin
OrcaWin merged commit 6cf918a into OrcaWin/node-rt-phase3 Oct 5, 2026
43 of 44 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant