Skip to content

fix(ssh): a connected conversion proves the host idle with the account-wide census, not this target's lists - #25697

Merged
OrcaWin merged 4 commits into
OrcaWin/node-rt-phase3from
OrcaWin/node-rt-p3-gate-host-census
Oct 6, 2026
Merged

OrcaWin merged 4 commits into
OrcaWin/node-rt-phase3from
OrcaWin/node-rt-p3-gate-host-census

Conversation

@OrcaWin

@OrcaWin OrcaWin commented Oct 5, 2026 •

Copy link
Copy Markdown
Collaborator
Files Added Deleted Net
Test 8 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​215 $\color{#cf222e}{\Huge{\mathbf{−}}}$​10 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​205
Prod 5 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​105 $\color{#cf222e}{\Huge{\mathbf{−}}}$​23 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​82

ELI5

Before Orca turns an SSH host into a managed server, it checks that no terminal is still running there. When this computer was already connected to the host, Orca only asked about terminals that this computer's relays run. A terminal another computer opened on the same account went unnoticed, so the host could convert underneath it. Now every conversion asks the host about every relay on the account before deciding it is idle.

What Changed

  • Before: assessOrcadMigrationTerminals consulted the account-wide census only when there was no relay session. With a session, an empty listing from this target's relay plus an empty earlier-relay census (both scoped to this target's id) returned exited. Desktop B's live shell, under a different target id, was never counted.
  • After: the gate answers exited only from a complete account-wide census (hostWideVerdict):
    • This target's lists can still prove live.
    • Empty lists hand the question to the census. A census that finds live or unknown work returns that verdict, with hostTerminals carrying its count.
    • With no census given, the gate answers unverifiable with needsHostCensus.
  • Callers:

Why

The gate must not answer "exited" from evidence that can't see the whole account. The target-scoped lists can't, because their socket and pipe names are derived from this target's id. The account-wide census (POSIX socket listing, and the Windows pipe inventory from #25611) is the only evidence that covers other desktops. Requiring it for every cutover, rather than only pre-session, closes the connected path without changing how live is detected.

Linked Issue

Fixes #

Astra review pass 4, §2.

Visual Proof

N/A: no UI change. A host where another desktop runs a shell stays on the relay as "terminals live".

Testing

  • orcad-migration-terminal-gate-host-wide.test.ts uses two desktop target ids, with desktop A connected and both of A's lists empty. It runs the real gate with the real census functions:

    • POSIX: the census finds desktop B's socket with a shell, so the verdict is live; once B is idle, exited.
    • Windows: the pipe inventory maps desktop B's pipe to B's credential and asks it, so the verdict is live; once B is idle, exited.
    • With no census, the verdict is unverifiable with needsHostCensus, and a census that throws gives unverifiable.
  • Refinement: another desktop's live shell reports live and retires none of this desktop's leases.

  • Real Windows host lane (orcad-windows-relay-terminal-gate-test-cell.ts): it deploys a second relay for another target id with a live shell. It expects desktop A's connected gate to read the host live, then exited after B's shell stops, and expects A's empty lists alone to be unverifiable.

  • Existing gate, lister, conversion and delta-move fixtures now give their account-wide census explicitly.

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

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

The census adds one host listing per connected conversion, delta move or post-session refinement, the same listing a pre-session connect already runs.

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)

@pullfrog

pullfrog Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor
  • Checkout PR and read full diff
  • Read PR summary snapshot and learnings
  • Triage and investigate surrounding code
  • Dispatch specialists if needed
  • Draft and submit review
  • Update PR summary file

Pullfrog  | View workflow run | via Pullfrog | Using deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

Re-reviewed the delta since the prior version (4481c03 → bc2772c) on the PR that makes every exited conversion verdict require the account-wide host census.

  • Removed the unread needsHostCensus flag from OrcadMigrationTerminalVerdict; the unverifiable reason string now states why the host could not be proven idle.
  • Updated the gate and host-wide gate tests to assert on that reason instead of the removed flag.
  • Re-ran the five affected gate/connect/conversion suites — 63 tests pass.

Pullfrog  | View workflow run | Using deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

m4air added 4 commits October 5, 2026 17:32
…t-wide census, not this target's lists

The migration terminal gate asked the host-wide census only when no relay session existed. With a
session, it trusted this target's relay listing and its earlier-relay census, both of which name
only this target's instances, and returned `exited` when they were empty, so another desktop's live
shell on the same account, under a different target id, let the host convert under it.

`exited` now always needs a complete host-wide census: this target's lists can prove `live`, but
empty lists only pass the question to the census, and a gate given none answers `unverifiable`
with `needsHostCensus`. The connect-time refinement passes the census too, so a connect retires its
leases only when no relay on the account holds work. The Windows host lane now runs a second
desktop's relay with a live shell and expects the connected gate to read the host live.
@OrcaWin
OrcaWin force-pushed the OrcaWin/node-rt-p3-gate-host-census branch from bc2772c to 4e89786 Compare October 6, 2026 00:36
@OrcaWin
OrcaWin merged commit 8a7027c into OrcaWin/node-rt-phase3 Oct 6, 2026
53 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