Repository navigation
refactor(pty): delete the SSH PTY provider and its registry slot - #27499
Conversation
0574137 to
3d3bcdc
Compare
1ab8e1d to
d7a241b
Compare
📝 Walkthrough
Priority: ➖ Normal Merge Risk: 🔵 Low · up to SSH terminal actions now fail with an error that suggests reconnecting, which will not help. Other SSH paths fail safely without touching local terminals. The change is mergeable once the message wording is corrected or accepted as is. Pre-merge checks |
|
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
a305e833-8b8d-43d0-8628-273ca630f562
📥 Commits
Reviewing files that changed from the base of the PR and between 11cf21e and d7a241bac393d6c67432212e07f1291c6972c9e3.
📒 Files selected for processing (152)
config/reliability-gates.jsoncconfig/scripts/ci-shard-timings.jsonsrc/main/ipc/pty-activation-inventory-scope.test.tssrc/main/ipc/pty-controller-owner-recovery.test.tssrc/main/ipc/pty-controller-ownership-routing.test.tssrc/main/ipc/pty-controller-process-inventory.test.tssrc/main/ipc/pty-daemon-controller-teardown.test.tssrc/main/ipc/pty-daemon-spawn-session-identity.test.tssrc/main/ipc/pty-daemon-ssh-lease-lifecycle.test.tssrc/main/ipc/pty-ipc-producer-flow-control.test.tssrc/main/ipc/pty-ipc-suite-environment.tssrc/main/ipc/pty-pane-reservation-settlement.test.tssrc/main/ipc/pty-pane-restart-replace.test.tssrc/main/ipc/pty-runtime-kill-and-exit.test.tssrc/main/ipc/pty-runtime-ssh-binding-persistence.test.tssrc/main/ipc/pty-serializer-settlement-mapping.test.tssrc/main/ipc/pty-session-liveness-and-ownership.test.tssrc/main/ipc/pty-spawn-cwd-fallback.test.tssrc/main/ipc/pty-spawn-runtime-handle-binding.test.tssrc/main/ipc/pty-ssh-stop-verdict.test.tssrc/main/ipc/pty-ssh-undelivered-kill.test.tssrc/main/ipc/pty-startup-barrier-and-listing.test.tssrc/main/ipc/pty-startup-swap-window-presence.test.tssrc/main/ipc/pty.tssrc/main/ipc/pty/delivery/ssh-intake.tssrc/main/ipc/pty/provider/registry-color-query-reply-colors.test.tssrc/main/ipc/pty/provider/registry-host-routing.test.tssrc/main/ipc/pty/provider/registry.tssrc/main/ipc/pty/register-without-renderer.test.tssrc/main/ipc/pty/runtime/queried-host-kinds.test.tssrc/main/ipc/qoder-desktop-execution-host.test.tssrc/main/ipc/ssh-app-shutdown.test.tssrc/main/ipc/ssh-connect-decision-cancellation.test.tssrc/main/ipc/ssh-disconnect-cancellation.test.tssrc/main/ipc/ssh-handler-reregistration.test.tssrc/main/ipc/ssh-ipc-mock-shapes.tssrc/main/ipc/ssh-ipc-module-mocks.tssrc/main/ipc/ssh-ipc-test-harness.tssrc/main/ipc/ssh-state-broadcast-fanout.test.tssrc/main/ipc/ssh-target-registry.test.tssrc/main/ipc/ssh.test.tssrc/main/ipc/workspace-cleanup.test.tssrc/main/ipc/worktrees-delete-pty-teardown.test.tssrc/main/ipc/worktrees-forget-local.test.tssrc/main/ipc/worktrees-mutation-scan-generation-order.test.tssrc/main/ipc/worktrees-removal-recovery.test.tssrc/main/ipc/worktrees-remove-archive-hooks.test.tssrc/main/ipc/worktrees-remove-preflight.test.tssrc/main/ipc/worktrees-test-harness.tssrc/main/ipc/worktrees-test-module-mocks.tssrc/main/ipc/worktrees/removal/register-worktree-forget-handlers.tssrc/main/ipc/worktrees/removal/remove-folder-workspace.tssrc/main/ipc/worktrees/removal/remove-registered-remote-worktree.tssrc/main/ipc/worktrees/removal/remove-unregistered-worktree-host-home.test.tssrc/main/ipc/worktrees/removal/remove-unregistered-worktree.tssrc/main/ipc/worktrees/removal/worktree-removal-ownership.tssrc/main/orcad/orcad-entry.tssrc/main/orcad/orcad-push-startup.test.tssrc/main/providers/provider-dispatch.test.tssrc/main/providers/pty-spawn-result.tssrc/main/providers/ssh-agent-session-capabilities.tssrc/main/providers/ssh-agent-session-claim-validation.tssrc/main/providers/ssh-agent-session-create-operation.tssrc/main/providers/ssh-agent-session-process-list.tssrc/main/providers/ssh-capability-probe-waiter.tssrc/main/providers/ssh-pty-applied-size.tssrc/main/providers/ssh-pty-errors.tssrc/main/providers/ssh-pty-inspect-observation-identity.test.tssrc/main/providers/ssh-pty-live-source-restore-respawn.test.tssrc/main/providers/ssh-pty-notification-recovery-activation.test.tssrc/main/providers/ssh-pty-notification-rejection-routing.test.tssrc/main/providers/ssh-pty-notification-routing-test-fixture.tssrc/main/providers/ssh-pty-notification-routing.test.tssrc/main/providers/ssh-pty-notification-routing.tssrc/main/providers/ssh-pty-process-list.tssrc/main/providers/ssh-pty-provider-agent-session-create-operation.test.tssrc/main/providers/ssh-pty-provider-claim-incarnation.test.tssrc/main/providers/ssh-pty-provider-contract.tssrc/main/providers/ssh-pty-provider-exit-race.test.tssrc/main/providers/ssh-pty-provider-mock-multiplexer.tssrc/main/providers/ssh-pty-provider-output-state.tssrc/main/providers/ssh-pty-provider-process-events.test.tssrc/main/providers/ssh-pty-provider-reattach-incarnation.test.tssrc/main/providers/ssh-pty-provider-rpc-operations.tssrc/main/providers/ssh-pty-provider-spawn.test.tssrc/main/providers/ssh-pty-provider-terminal-repair.test.tssrc/main/providers/ssh-pty-provider.test.tssrc/main/providers/ssh-pty-provider.tssrc/main/providers/ssh-pty-reattach-absence-discrimination.test.tssrc/main/providers/ssh-pty-relay-absence-verdict.test.tssrc/main/providers/ssh-pty-session-reattach.tssrc/main/providers/ssh-pty-source-delivery-ledger.test.tssrc/main/providers/ssh-pty-source-delivery-ledger.tssrc/main/providers/ssh-pty-source-delivery-state.tssrc/main/providers/ssh-pty-source-frame.tssrc/main/providers/ssh-pty-spawn-env.test.tssrc/main/providers/ssh-pty-spawn-env.tssrc/main/providers/ssh-pty-spawn-exit-race.tssrc/main/providers/ssh-pty-spawn-repair.tssrc/main/providers/ssh-pty-spawn-request.tssrc/main/providers/ssh-pty-write.test.tssrc/main/providers/ssh-pty-write.tssrc/main/remote-worktree-history-cleanup.test.tssrc/main/remote-worktree-history-cleanup.tssrc/main/runtime/folder-workspace-pty-teardown.tssrc/main/runtime/missing-worktree-terminal-reconciliation.test.tssrc/main/runtime/missing-worktree-terminal-reconciliation.tssrc/main/runtime/orca-runtime-create-runtime-owned-mobile-session-terminal.tssrc/main/runtime/orca-runtime-get-agent-session-execution-namespace.tssrc/main/runtime/orca-runtime-list-managed-worktrees.tssrc/main/runtime/orca-runtime-preserved-branch-cleanup.tssrc/main/runtime/orca-runtime-pty-foreground-process-reads.tssrc/main/runtime/orca-runtime-remove-managed-worktree.tssrc/main/runtime/orca-runtime-remove-orphan-or-folder-worktree.tssrc/main/runtime/orca-runtime-state-fields.tssrc/main/runtime/orca-runtime-test-scenario-builders.spec.tssrc/main/runtime/orca-runtime-tests/lineage-and-scan-cache-part-02.spec.tssrc/main/runtime/orca-runtime-tests/ssh-worktree-lifecycle-part-02.spec.tssrc/main/runtime/orca-runtime-tests/worktree-removal-and-reconciliation-part-02.spec.tssrc/main/runtime/orca-runtime-tests/worktree-removal-and-reconciliation-part-03.spec.tssrc/main/runtime/orca-runtime-tests/worktree-removal-execution-host.spec.tssrc/main/runtime/orchestration-mailbox-transport-settlement.test.tssrc/main/runtime/runtime-registered-remote-worktree-removal.tssrc/main/runtime/runtime-skill-command-contract.tssrc/main/runtime/runtime-skill-install-authority.test.tssrc/main/runtime/runtime-skill-install-commands.test.tssrc/main/runtime/runtime-skill-install-commands.tssrc/main/runtime/runtime-skill-install-queries.test.tssrc/main/runtime/runtime-skill-install-queries.tssrc/main/runtime/runtime-unregistered-worktree-removal-host-home.test.tssrc/main/runtime/runtime-unregistered-worktree-removal.tssrc/main/skills/skill-ssh-relay-service.tssrc/main/ssh-expired-lease-pane-readoption.test.tssrc/main/ssh/ssh-multiplexer-transport-writer.tssrc/main/startup/headless-serve-ssh-registration.test.tssrc/main/startup/main-process-runtime-service.tssrc/renderer/src/components/dashboard-popout/terminal-preview-unavailable-message.test.tssrc/renderer/src/components/dashboard-popout/terminal-preview-unavailable-message.tssrc/shared/agent-session-host-authority.tssrc/shared/pty-attach-absence-evidence.tssrc/shared/pty-consumer-owner-admission.tssrc/shared/pty-consumer-owner-recovery.tssrc/shared/pty-consumer-session-capabilities.tssrc/shared/pty-consumer-session-contract.tssrc/shared/pty-consumer-session-hello.tssrc/shared/pty-consumer-session.test.tssrc/shared/pty-consumer-session.tssrc/shared/pty-source-receiving-activation.tssrc/shared/pty-source-recovery-contract.tssrc/shared/skill-ssh-relay-contract.tssrc/shared/terminal-unavailable-cause.tstests/e2e/__mocks__/native-chat-ssh-delivery.ts
💤 Files with no reviewable changes (85)
- src/main/ipc/ssh-target-registry.test.ts
- src/main/ipc/ssh-connect-decision-cancellation.test.ts
- src/main/remote-worktree-history-cleanup.test.ts
- src/main/providers/ssh-pty-provider-reattach-incarnation.test.ts
- src/main/providers/ssh-pty-provider-exit-race.test.ts
- src/main/ipc/worktrees/removal/remove-unregistered-worktree-host-home.test.ts
- src/main/providers/ssh-pty-provider-agent-session-create-operation.test.ts
- src/main/providers/ssh-pty-write.test.ts
- src/main/providers/ssh-capability-probe-waiter.ts
- src/shared/pty-consumer-session.test.ts
- src/main/providers/ssh-pty-notification-routing.test.ts
- src/main/remote-worktree-history-cleanup.ts
- src/main/providers/ssh-pty-provider-terminal-repair.test.ts
- src/main/ipc/ssh-disconnect-cancellation.test.ts
- src/main/providers/ssh-pty-provider-claim-incarnation.test.ts
- src/main/runtime/orca-runtime-remove-managed-worktree.ts
- src/main/providers/ssh-pty-live-source-restore-respawn.test.ts
- src/main/providers/ssh-pty-relay-absence-verdict.test.ts
- src/main/providers/ssh-pty-notification-recovery-activation.test.ts
- src/shared/pty-source-recovery-contract.ts
- src/main/startup/headless-serve-ssh-registration.test.ts
- src/shared/skill-ssh-relay-contract.ts
- src/main/ipc/ssh.test.ts
- src/main/providers/ssh-pty-process-list.ts
- src/main/providers/ssh-agent-session-process-list.ts
- src/main/ipc/worktrees-mutation-scan-generation-order.test.ts
- src/main/providers/ssh-pty-errors.ts
- src/main/providers/ssh-pty-provider-spawn.test.ts
- src/shared/pty-consumer-session.ts
- src/main/providers/ssh-pty-notification-rejection-routing.test.ts
- src/shared/agent-session-host-authority.ts
- src/shared/pty-source-receiving-activation.ts
- src/main/runtime/runtime-unregistered-worktree-removal-host-home.test.ts
- src/main/providers/pty-spawn-result.ts
- src/main/providers/ssh-pty-applied-size.ts
- src/main/providers/ssh-pty-provider.ts
- src/shared/terminal-unavailable-cause.ts
- src/main/runtime/runtime-skill-command-contract.ts
- src/main/ipc/ssh-handler-reregistration.test.ts
- src/main/providers/ssh-pty-provider.test.ts
- src/main/providers/ssh-pty-source-delivery-state.ts
- src/main/providers/ssh-pty-source-delivery-ledger.ts
- src/main/providers/ssh-pty-inspect-observation-identity.test.ts
- src/main/runtime/orca-runtime-list-managed-worktrees.ts
- src/main/ipc/ssh-app-shutdown.test.ts
- src/main/providers/ssh-pty-reattach-absence-discrimination.test.ts
- src/main/providers/ssh-pty-provider-contract.ts
- src/main/providers/ssh-pty-write.ts
- src/shared/pty-consumer-session-capabilities.ts
- src/main/ipc/worktrees/removal/remove-unregistered-worktree.ts
- src/main/ipc/worktrees/removal/remove-registered-remote-worktree.ts
- src/main/runtime/runtime-unregistered-worktree-removal.ts
- src/main/providers/ssh-pty-provider-output-state.ts
- src/main/providers/ssh-pty-spawn-env.ts
- src/main/runtime/orca-runtime-preserved-branch-cleanup.ts
- src/main/ipc/ssh-state-broadcast-fanout.test.ts
- src/main/providers/ssh-pty-spawn-exit-race.ts
- src/main/providers/ssh-agent-session-capabilities.ts
- src/main/providers/ssh-pty-notification-routing.ts
- src/main/runtime/runtime-skill-install-commands.test.ts
- src/main/providers/ssh-agent-session-claim-validation.ts
- src/main/providers/ssh-pty-spawn-env.test.ts
- src/main/providers/ssh-pty-spawn-repair.ts
- src/main/providers/ssh-pty-spawn-request.ts
- src/main/skills/skill-ssh-relay-service.ts
- src/main/providers/ssh-pty-provider-process-events.test.ts
- src/main/providers/ssh-pty-provider-mock-multiplexer.ts
- src/shared/pty-consumer-owner-admission.ts
- src/main/providers/ssh-pty-source-delivery-ledger.test.ts
- src/main/providers/ssh-pty-notification-routing-test-fixture.ts
- src/shared/pty-consumer-session-hello.ts
- src/main/providers/ssh-pty-provider-rpc-operations.ts
- src/shared/pty-attach-absence-evidence.ts
- config/scripts/ci-shard-timings.json
- src/main/runtime/orca-runtime-state-fields.ts
- src/main/runtime/orchestration-mailbox-transport-settlement.test.ts
- src/shared/pty-consumer-owner-recovery.ts
- src/main/providers/ssh-agent-session-create-operation.ts
- src/main/ipc/ssh-ipc-mock-shapes.ts
- src/main/ipc/worktrees-remove-archive-hooks.test.ts
- src/main/providers/ssh-pty-source-frame.ts
- src/main/providers/ssh-pty-session-reattach.ts
- src/main/ipc/pty-ssh-undelivered-kill.test.ts
- src/main/ipc/ssh-ipc-module-mocks.ts
- src/main/runtime/runtime-registered-remote-worktree-removal.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review.
| // Why: this surfaces verbatim in `terminal create`; keep the prefix — the renderer matches it. | ||
| return ( | ||
| `No PTY provider for connection "${connectionId}": the SSH relay for this host is not attached ` + | ||
| '(reconnecting or disconnected). Wait for the host to reconnect, or use Reconnect on the SSH target.' | ||
| ) |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
The SSH error message tells users to take an action that cannot work.
After this change, getProvider throws PtyHostNotDispatchableError for every SSH host. The registry has no SSH provider slot, so reconnecting never makes a provider available. The message suffix still says the relay "is not attached (reconnecting or disconnected)". It also tells users to "Wait for the host to reconnect, or use Reconnect on the SSH target." The terminal create output shows this text verbatim. Users who follow the instruction will see the same failure every time.
The renderer matches only the No PTY provider for connection "<id>" prefix. Keep that prefix. Replace the suffix with text that says this process does not run SSH terminals.
Proposed fix
--- "a/src/main/ipc/pty/provider/registry.ts"
+++ "b/src/main/ipc/pty/provider/registry.ts"
@@ -61,11 +61,11 @@
if (connectionId === null) {
return `PTY host "${hostId}" is not dispatchable from this process`
}
- // Why: this surfaces verbatim in `terminal create`; keep the prefix — the renderer matches it.
- return (
- `No PTY provider for connection "${connectionId}": the SSH relay for this host is not attached ` +
- '(reconnecting or disconnected). Wait for the host to reconnect, or use Reconnect on the SSH target.'
- )
+ // Why: this surfaces verbatim in `terminal create`; keep the prefix — the renderer matches it.
+ return (
+ `No PTY provider for connection "${connectionId}": this process does not drive terminals ` +
+ 'on SSH hosts.'
+ )
}
/** Only this machine's PTYs are driven here; a paired runtime drives its own over runtime RPC. */📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| // Why: this surfaces verbatim in `terminal create`; keep the prefix — the renderer matches it. | |
| return ( | |
| `No PTY provider for connection "${connectionId}": the SSH relay for this host is not attached ` + | |
| '(reconnecting or disconnected). Wait for the host to reconnect, or use Reconnect on the SSH target.' | |
| ) | |
| // Why: this surfaces verbatim in `terminal create`; keep the prefix — the renderer matches it. | |
| return ( | |
| `No PTY provider for connection "${connectionId}": this process does not drive terminals ` + | |
| 'on SSH hosts.' | |
| ) |
Nothing in production registers an SSH PTY provider, so the registry's SSH map was always empty: every SSH lookup answered undefined or threw the 'No PTY provider for connection' error. Delete the provider stack, its consumer-session and source-recovery contracts, the registry maps and the getSshProvider dependency, keeping each caller's existing result for an absent provider. The registry now dispatches only 'local'; any other host throws PtyHostNotDispatchableError, which keeps the renderer-matched message for SSH ids and is never read as a gone or exited PTY.
d7a241b to
dfc77a2
Compare
…alls and ps fallbacks (#31783) (#36282) * fix(terminal): bound the in-process macOS process table's blocking calls and ps fallbacks (#31783) Follow-up to #35987 from its post-merge reviews. - cwd and executable path: node-pty's readProcessCwd/readProcessPath now run PROC_PIDVNODEPATHINFO and proc_pidpath on a libuv worker (the synchronous exports are gone, so an older pty.node falls back to ps/lsof). JS caps them at two outstanding lookups and 250ms; a wedged mount or a full cap answers from lsof -b, which never stats, so a dead NFS/SMB/FUSE mount cannot freeze the daemon's event loop or take the whole pool. - Unreadable argv prints "(comm)", as ps does, instead of a proc_pidpath lookup under Orca's credentials on the table worker. - The table exports each row's euid. Argv recovery runs setuid ps only for another user's processes, never for our own mid-exec or exiting ones (or SIDL/exiting rows), which ps cannot read either: a pane looping short commands forked ps on ~15% of full reads, now none. - Recovery is coalesced per process across concurrent readers and a failed recovery waits 5s before costing another ps. The cache keys on comm and start time. - Full-table and shell-foreground captures, which feed strict evidence with the capture's age, take only argv ps read after their request; display readers keep the 30s cache. - While the reader is down (stalled-pool breaker open, or a rejecting addon, which now backs off 1s..30s), runPsInProcess runs /bin/ps itself through one shared budget: identical invocations share a run, a burst of 4 forks then one a second, and a run spawned before a request never answers it. Descendant teardown and foreground-group signalling keep their own full-timeout ps (callerRunsPs). 13 pollers at 750ms: 1,040 ps/min before, 63 after. No daemon protocol bump: the wire format is unchanged, and each daemon loads JS and pty.node from the same runtime copy. * fix(terminal): make the libproc reader survive worker teardown, fail closed and share one fair fork budget (#31783) Review follow-ups to the previous commit. - Native: every libproc AsyncWorker derives from OrcaPromiseWorker, which skips JS completion once an env cleanup hook marks the env closing and swallows a Napi::Error thrown mid-teardown. Terminating a worker_thread with cwd or table reads in flight aborted the process; 200 terminates each now survive. - (comm) in a terminal's foreground group (argv neither reader recovered, e.g. a root `su`) judges 'unknown', never 'agent', so the launch line is not typed into it. - Fresh argv only for getFreshSnapshot captures; the 500ms TTL readers keep the 30s cache. Argv recovery runs through its own fork budget (2, then one per 2s). Root `su` pane, 13 pollers at 750ms: TTL 79 -> 2 ps/min, fresh 158 -> 31. - The fork budget serves invocations in FIFO turns, grouping each one's waiters onto one run. 13 streams: served 80,42,1,1,2,0x8 -> 10-12 each. - Forced subprocess captures (a held naming pass) go through the fallback budget: 5 readers, 400 direct ps/min -> 63, 395 of 400 captures served. - A failed recovery is retried 5s after ps gave up, not after it started. - Tests pin Orca's euid instead of reading the runner's and assuming root is 0. - process-cwd keeps one lsof per pid until it exits, so a dead mount no longer leaks one per poll; shell readiness reads the exe path through runProcess, which gives up on an lsof that ignores SIGTERM. - A #35987 pty.node (table reader, no async path reads) keeps the in-process table; cwd/path use lsof, with a one-time warning. - captureProcessTable moves to process-table-ps-capture.ts. * fix(terminal): make withheld argv unverifiable and reuse recovered argv for at most 2s (#31783) Round-2 review follow-ups. - Worker teardown: drop OrcaPromiseWorker and its env flag (Node drains the pool before cleanup hooks, so it never fired). node-pty's mac pty target now builds with NODE_API_SWALLOW_UNTHROWABLE_EXCEPTIONS, which covers both the call-in and completion paths. The smoke test now calls the reads from a timer while terminating: the previous build aborted 2 of 3 runs, this one survives 3/3 x 100. pty.cc is back to the first follow-up's exact content. - A foreground process whose argv ps withheld (`(comm)`: another user's, exiting, or a recovery the budget skipped) makes the batch resolver, and so host-stamped evidence, `argv_unreadable`/unverifiable rather than live with no agent; agent-foreground resolution reports it unavailable. - judgeTerminalForeground fails closed only for an unreadable shell (`(bash)` from a root `su`), not our own exiting `(git)`. - Recovered argv is reused for at most 2s per identity (pid, start, comm) for every reader (the next commit ages evidence by it), and fresh reads no longer queue behind the recovery budget. Root `su` pane, 13 fresh pollers: p50 2,989ms -> 53ms, 31 -> 26 ps/min (TTL reader 1 -> 26). - The fork budgets serve interactive and fresh readers before display polls (cheap and TTL snapshot captures), FIFO within each. 20 display streams plus a 3s launch-paste read every 5s: 0/12 -> 12/12 served, polls 4-7 each. - On a selected terminal, the foreground group's argv is recovered even with no process of ours left (`exec su`); the root login is not. - Budgeted captures keep the 32 MiB output ceiling. * fix(terminal): age strict evidence by its oldest recovered argv (#31783) Round-3 review follow-ups. - Recovered argv carried no read time, so a capture reusing it (cached, or a recovery still in flight) stamped its own capture time over argv up to 2s older, and the remote write guard could take a same-comm re-exec for the agent. Rows now carry when ps read their recovered argv; runPsInProcess reports the oldest through onArgvReadAt, and the snapshot reader stamps capturedAtMs at that input, so capturedAgeMs is the age of the oldest input and consumers' own freshness checks (the write guard's 500ms) decide. A recovery begun more than 2s before a reader asked no longer answers it, and an older recovery finishing late cannot replace a newer one. - resolveSpawnFileForegroundFromRows reports a withheld `(node)` foreground unavailable. - One budget queue entry per invocation: an interactive request promotes a queued poll's, a poll joins an interactive one. - parseShellForegroundRows gets its JSDoc back. * fix(terminal): keep a cached name from authorizing a refused write; integer, under-2s argv ages (#31783) Round-4 review follow-ups. - When the relay's evidence declines a write (stale, unverifiable, another agent), its foreground name may still prove the shell but no longer proves the agent: that name can be the tracker's 1s display cache, e.g. `claude` cached just before Claude exited to a root shell under su. Relays that send no evidence keep the name as before. - Snapshot ages round up to whole milliseconds; the wire rejects fractions from the monotonic-to-wall conversion. - Recovered argv is reused for at most 1.5s, so reuse plus the 500ms snapshot cache stays under the 2s freshness gate; reuse ages from when that ps spawned, not from the wait for its fork token, and only an answer is remembered (a timed-out or withheld run proves nothing). Fork budget unchanged. Root su pane, 13 pollers: 30 ps/min; fresh p50 51ms; strict evidence age p50 752ms, max 1,508ms. * fix(terminal): keep the relay's agent name behind structurally unverifiable evidence (#31783) The previous commit refused the name fallback whenever the relay sent any evidence, so `unverifiable` evidence for structural reasons also blocked writes: npm Codex (node codex.js spawning native codex) and Gemini (relaunching itself) put two agent rows in the foreground group (ambiguous_foreground_group), and remote tmux reads multiplexer_boundary. On SSH POSIX hosts that dropped launch prompts and failed worker briefs, conversation send/cancel and automations with agent_not_in_foreground. The name now cannot authorize only when the evidence saw the group (`live`: stale, or no agent in it, as in the cached-`claude`-over-root-shell repro) or withheld a foreground argv (`argv_unreadable`, possibly a root `su` shell). Other unverifiable reasons keep the name fallback, as before this branch. * fix(terminal): let a relay name complete only fresh agent-positive evidence (#31783) The SSH name fallback still let a stale or cached name authorize a write under any unverifiable reason but argv_unreadable: ps EAGAIN (process_table_unreadable) after the tracker cached `claude` over a root bash, anchor_missing, tty_boundary (`sudo -i` with use_pty, a root shell on a new pty), or a 1.5s-old ambiguous capture. - The name now completes evidence only when it is fresh (within the guard's 500ms bound), its reason is one that saw an agent row (ambiguous_foreground_group, multiplexer_boundary, candidate_start_time_missing), and the name is the launched agent. Every other reason, including ones this build does not know, reads unknown. Relays that send no evidence keep the name, for mixed versions. - The relay's evidence names one agent that holds two rows of the group (npm Codex: node codex.js spawning native codex; Gemini relaunching itself), so a new relay proves them live even when its name is `node`. Two different agents stay ambiguous. No wire change. * fix(terminal): judge a relay name by the host's capture age; keep old relays' npm Codex (#31783) - Name completion compared the capture's start with the read's start, so a slow response made old evidence look fresh: a capture 1,500ms old arriving after 1,100ms passed. It now uses the host-reported capturedAgeMs against the 500ms bound, which latency cannot shrink. Live evidence keeps its capture-start rule. - Relays before same-agent dedupe report npm Codex (node wrapper plus native binary) as ambiguous_foreground_group and name it `node`. For that reason only, `node` now completes the evidence when the launched agent is npm-installed per the node entrypoint tables; other agents and reasons stay fail-closed. * fix(terminal): bound relay-name completion by twice the snapshot TTL (#31783) The 500ms bound refused ~9.5% of tmux name completions on a host with 13 pollers (cached snapshot up to one 500ms TTL old plus ~30ms capture, max 528ms), and a refusal drops the launch prompt or throws with no retry. The bound is now 2 x PROCESS_TABLE_SNAPSHOT_MAX_STALENESS_MS (1s), still on the host-reported age: 0 of 767 reads exceed it, the delayed 1,500ms repro still refuses, and the cached-name hazard (the tracker's ~1s display cache) is no wider. * fix(terminal): complete relay evidence with a name read now, not the display cache (#31783) With the 1s bound, a capture at 0-528ms, `codex` cached at 100ms, Codex exiting at 101ms and the guard at 999ms still let the cached name authorize a write over the bash that replaced it. - Name completion (structural reasons, host age within 2x the snapshot TTL) now asks confirmForegroundProcess, which reads the foreground now (a fresh scan, or node-pty's raw process name) rather than the tracker's 1s display cache; a null answer reads unknown. No new wire surface: the local daemon answers confirmForegroundProcess, paired runtimes evaluate guards locally, and the production controller returns null (read as unknown, failing safe) when a provider lacks it. Controllers without the method, and relays sending no evidence, keep the cached name as the legacy path. - Live evidence also accepts a host-reported age within 2x the TTL, so a real agent behind a 500-528ms cached snapshot on a fast link is no longer refused; a capture begun after the read was asked still counts, and 5,000ms-old evidence still refuses. * fix(terminal): confirm live evidence older than one snapshot TTL with a fresh read (#31783) Accepting live evidence up to 2x the TTL reopened the window the previous commit closed for name completion: a capture at 0-528ms, the agent exiting at ~529ms, and at 999ms `live claude` still read as agent over a bash. Live evidence begun no more than one TTL before the read was asked (so any host age within one TTL, however long ps took) still answers alone. Between that and 2x the TTL, confirmForegroundProcess reads the foreground now: the launched agent proves it, a shell reads shell, anything else unknown. Controllers without that read fall through and refuse, as before. Reachability: the remote (host.remote) write-guard path has no production caller since the SSH provider's removal (#27499); the registry dispatches only local providers and paired runtimes evaluate guards locally. This is defence in depth for any future remote provider.
ELI5
Orca used to drive terminals on SSH hosts through a "relay" program. Each SSH host got its own terminal provider in the app, kept in a small table next to the provider for this computer. The relay was removed (#27214, #27215), and nothing in the app adds a row to that table any more. It is always empty, so every SSH lookup in it already came back "not found". This PR deletes the empty table and the SSH terminal provider code behind it. Nothing changes for the user.
What Changed
ipc/pty/provider/registry.ts) now holds only this computer's provider. ThesshProviders/sshProvidersByGenerationmaps andregisterSshPtyProvider/unregisterSshPtyProvider/getSshPtyProviderare gone. Any host other thanlocalthrows one typedPtyHostNotDispatchableError. For anssh:host it keeps the exact message it threw before ("No PTY provider for connection …"), because the renderer matches that text to show the reconnect hint.getSshProviderdependency removed fromOrcaRuntimeServiceand from both places that built it:main-process-runtime-service.tsandorcad-entry.ts. That covers the runtime's worktree removal, orphan and folder cleanup, missing-worktree sweep, foreground-process stop, agent-session capability probe and skill-install paths. Each one keeps the result it already produced when the provider was missing:PTY provider unavailable for worktree deletion;includeProviderInventory: falseandincludeLocalRegistry: false, so they never touch the local registry;skill-install-ssh-relay-unavailable.getSshPtyProvidercall sites inipc/worktrees/removal/get the same treatment. They live in five files, and this PR owns them (codex P1-6); B4 rebases after it.providers/ssh-pty-*(keepingssh-pty-idandssh-pty-errors),ssh-agent-session-*andssh-capability-probe-waiter;shared/pty-consumer-session{,-capabilities,-hello},pty-consumer-owner-{admission,recovery},pty-source-recovery-contract,pty-attach-absence-evidenceandpty-source-receiving-activation.pty-consumer-session-contract.tsshrinks to the one type the WSL guest still uses;remote-worktree-history-cleanup.ts(it always receivedundefined) and thedeleteHistorystep of the runtime removal helpers;listSkillInstallsOnSshHost,toWriteSettlement, two agent-session protocol constants,SSH_PTY_SOURCE_RESTORE_REQUIRED_ERROR(main only; the renderer token stays for A7), and three unusedterminal-unavailable-causehelpers.ssh-intake.ts: the generation lookups that always missed become fixed answers ("no producer to pause"). A3 deletes the rest of this file.ssh:id never reaches the local provider. Three SSH-delete tests now assert the refusal instead of a delete.native-chat-ssh-delivery.unit.test.tskeeps all 12 cases, with a small settling fake in place of the relay provider.reliability-gates.jsoncandci-shard-timings.jsondrop the deleted files.Net lines: prod +62 / −3,531 (−3,469), tests +339 / −9,754 (−9,415), config −118.
Why
Phase 3.99 (A2) removes code that is still compiled, wired and tested but that nothing in production feeds. Leaving the empty slot in place means every terminal, removal and inventory path keeps an SSH branch that cannot run. The tests then pin behaviour of a provider that never exists. Two alternatives were rejected:
Proof the deleted code is unreachable:
registerSshPtyProviderhad no production caller, only thepty.tsre-export and test mocks; A1's review confirmed this as well. SosshProviderswas always empty,getSshPtyProvider(…)andgetSshProvider(…)always returnedundefined, andgetProvider('ssh:…')always threw.SshPtyProviderwas constructed only in tests.rg -woversrc tests mobile config .githubfinds zero hits for every deleted symbol:sshProviders(registry),sshProvidersByGeneration,registerSshPtyProvider,unregisterSshPtyProvider,getSshPtyProvider,getSshProviderFn,getSshProvider,SshPtyProvider(as code),deleteRemoteWorktreeHistory,listSkillInstallsOnSshHost,SKILL_SSH_RELAY_LIST_METHOD,PTY_CONSUMER_SESSION_PROTOCOL_VERSION,parsePtySourceReceivingActivation,sourceActivation,toWriteSettlement,writeToSshPty(WithSettlement),terminalUnavailableCauseFromError,mayRepairFromCause,parseTerminalUnavailableCause,SSH_PTY_SOURCE_RESTORE_REQUIRED_ERRORandAGENT_SESSION_{EXECUTION_OWNER,CREATE_OPERATION}_PROTOCOL_VERSION. The remainingsshProvidershits are local variables in the SSH git and filesystem dispatch modules and two tests. The two remainingSshPtyProvidermentions are comments, which this PR rewords.rg -wover all 159@ts-nocheckfiles finds zero hits.build:electron-vite,build:cliandbuild:orcadall succeed after the deletion.SSH execution boundary (P1-4): an SSH-owned PTY that this process cannot dispatch stays unverifiable. A new registry test proves
isPtyAlreadyGoneError,isHostReportedPtyAbsenceErrorandisObservedPtyExitEvidenceare all false forPtyHostNotDispatchableError.ssh-expired-lease-pane-readoption.test.tsproves an SSH pane's adoption fails with that error and keeps its persisted binding. No removed branch falls back to the local provider.Small change on an already-failing path:
listManagedSkillInstalls(<ssh id>)now throwsskill-install-ssh-relay-unavailablebefore it lists resolved worktrees, not after. Before, a failure of that listing could surface first; either way the call failed. Nothing else changes.Wire / mixed versions / folder workspaces: no RPC, stream frame or published field changes.
PtySpawnResult.sourceActivationwas an optional, never-read type field. Folder-workspace removal keeps its host fence and its local-provider sweep. Windows and WSL are unaffected: the WSL guest'sPtyConsumerCloseCausetype stays.Linked Issue
N/A (maintainer, Phase 3.99 cleanup plan, PR A2)
Visual Proof
N/A. No UI or behaviour change; only unreachable code is removed.
Testing
src/main/ipc,src/main/providers,src/main/skills,src/main/startup,src/main/orcad,src/wsl-guest,src/shared, the runtime removal/skill suites,orca-runtime.test.ts, the serialize-grid transcript replay test andtests/e2e/native-chat-ssh-delivery.unit.test.ts: 1,945 files and 22,573 tests passed.pnpm tc,oxlint,pnpm run check:code-quality:changed(0 new findings),pnpm lint,check:reliability-gates, andbuild:electron-vite/build:cli/build:orcad.AI Disclosure
Review
Agent skill upstream boundary
Notes
Ensure no issues in: Security, Cross-platoform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)