Repository navigation
Never let a non-owning provider answer a PTY presence question false during the daemon swap window - #16953
Conversation
…ng the daemon swap window During cold start the installed local provider is still the plain in-process LocalPtyProvider until daemon-init swaps in the daemon router. It does not own restored daemon PTY ids, but pty:hasPty and the runtime controller's sync hasPty still let it answer — and its "not in my table" false read as an observed absence: the renderer dead-session reconciler tears panes down on exactly that false, remount recovery refuses on it, and terminal.list records an observed absence instead of an unverifiable verdict. - pty:hasPty now waits for the local-provider startup barrier before choosing an answering provider (the same #7742 guard pty:kill uses), so the post-swap owner answers. - hasPtyFromRuntimeController is sync and cannot wait; while the startup barrier is unsettled it answers null (unverifiable), and it inherits the async probe's remote-handle guard: no locally routed provider may answer for a paired runtime handle. - SSH-owned ids keep answering from their own provider without waiting, and a registration without a startup barrier (headless/orcad) keeps the in-process provider's false authoritative (#12393).
|
Push verified: |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 3 remain after this review. 📝 WalkthroughWalkthroughPTY presence and process inspection now wait for the relevant local or SSH provider during startup transitions. The runtime controller returns Merge Risk: ⚪ Minimal · up to The change narrows PTY presence answers to the owning provider during daemon startup and preserves an unverifiable state until ownership is settled; no actionable merge-blocking risk remains after normal checks and review. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Description checkExplanation The description gives detailed context, behavior changes, testing, performance, compatibility, and residual risk. However, it omits several template sections, including the required Linked Issue, Visual Proof or an explicit N/A statement, AI Disclosure, Review, Agent skill upstream boundary, Notes, and Checklist. Resolution Add the missing template sections. Include a linked issue after “Fixes #”. For this behavior-only change, add “N/A” with a brief reason under Visual Proof. Complete or explicitly mark the remaining sections as applicable or not applicable, and include the required checklist items and validation status.
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 9e84c62a-85ac-435f-b068-0b07091b34ff
📒 Files selected for processing (4)
src/main/ipc/pty-startup-swap-window-presence.test.tssrc/main/ipc/pty/ipc/inspect.tssrc/main/ipc/pty/runtime/controller.tssrc/main/ipc/pty/runtime/operations.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 2 remain after this review.
|
CI state on
Both main-side breakages need fixes on main (a one-line expectation update for #15420's test; a look at #16752's new spec), and they will hit every open PR's merge ref until then. |
Independent adversarial review — head
|
| Ablation | Removed | Result |
|---|---|---|
| A1 | pty:hasPty barrier await (inspect.ts) |
1 red — IPC defer test |
| A2 | remote: guard (operations.ts) |
1 red — remote-handle test (isolated: that test runs with no barrier, so the outer gate cannot mask it) |
| A3 | sync swap-window null gate | 1 red — sync-null test |
| A4 | settle watcher (arm-once .then) |
1 red — post-settle recovery times out (gate never reopens): the watcher is load-bearing, not decoration |
6/6 green at head. Every functional hunk is individually pinned.
3. Attacks on the new waiting behavior
(a) Latency / who waits. Renderer callers of pty:hasPty are exactly two production sites plus a stub (derived, below); both are fire-and-forget liveness probes (visibility-resume reconcile, input-undeliverable recovery) — nothing paint-blocking awaits it. Worst case bound, proven from first-window-startup-services.ts: the barrier is Promise.race([daemon.ready, failOpen(60s)]); failOpenTimeout is cleared only after both services settle, so the race settles ≤60s after services start. On win32-packaged the window opens before services start, adding shell-path hydration bounded at 10s per probed shell (hydrate-shell-path.ts:25 SIGKILL timeout). This is the same wait class pty:kill (#7742) and pty:spawn already carry on this exact path; in practice it's daemon-adoption time (seconds).
(b) Can it hang / reject? No hang: startService wraps startDaemonPtyProvider in .catch(onError) — daemon.ready never rejects and always settles, including daemon crash mid-swap (crash → catch → resolve → race settles → post-swap registry answers; a degraded/local provider is then the legitimate owner). The 60s fail-open timer backstops a wedged start. Rejection is possible only if the outer services promise rejects (win32 shellPathReady.then(startServices)): then pty:hasPty rejects across IPC — both renderer callers catch (terminal-pane-recovery.ts try/catch, session-reconcile-dispose.ts .catch(() => {})), and the sync path's two-arg .then(markSettled, markSettled) treats rejection as settled and falls through to the provider (sole owner after a failed swap — correct). Same exposure pty:kill has had since #7742.
(c) Null-vs-false caller audit (the most likely failure mode — absent). Derived myself, not read from the PR. The controller installed by installPtyRuntimeController is consumed only in orca-runtime.ts; renderer consumers derived from the preload bridge (pty.hasPty → invoke('pty:hasPty'), typed boolean | null).
Sync (5 sites):
orca-runtime.ts:9389— capability presence check only, no call.:19330controllerKnowsPtyIsLive(=== true) — null merely skips the live shortcut; absence is then decided by asyncprobePtyLiveness, which awaits the same barrier;isLeafPtyProvenAbsenttreats null/error as doubt and doubt never gates a write.:33751inventory sweep — explicit three-way:truerescues,false→forgetPtyLivenessVerdict(observed absence),null→markPtyLivenessUnverifiable(NO_OBSERVING_PROVIDER_REASON). This is the claimed terminal.list improvement, and it exists in production code, not just tests.:33844refreshFloatingWorkspacePtyLiveness—live === nullaborts the targeted fast path (returns null; caller at:33518falls back to the full inventory path) instead of demoting.:34052buildTerminalSummaryleafprovenAbsent(!== true) — null lands like false here, but that is decision-identical to main's false (both ≠ true), guarded byprovenLivePtyIds !== nullplus remote/SSH exclusions, and composes with Never read an unanswerable hasPty probe as proven PTY absence #16932's confirmed-absence gate. No regression; see P2-2.
Renderer (3 consumers):
terminal-pane-recovery.ts:227— explicitlive === falseearly-return; null proceeds to remount unlessrequireAuthoritativeLiveness; rejection caught.session-reconcile-dispose.ts:64→shouldReconcileMissingSession— first line isif (args.isLive !== false) return false: null can never tear down a pane (pinned byterminal-dead-session-reconcile.test.ts).web-terminal-api.ts:46— paired-web stub already returns null.
No if (!hasPty)-style collapse exists anywhere in the consumer set.
(d) Exemptions can't reach the old confident-false. SSH exemption requires a non-null ptyOwnership entry or a strict ssh:<conn>@@<id> parse (src/shared/ssh-pty-id.ts); local ids listed by the local provider get ptyOwnership = null, which still gates (if (connectionId) is falsy for null). A retained-ownership id whose SSH provider is gone routes to getProvider → throw → null, never a local false (parity rows A.sync.owned-provider-gone, A.ipc.ssh-no-provider). The no-barrier exemption is reachable in production only via register-headless-runtime.ts (headless serve: daemon installed before registration, sole owner per #12393); the desktop path always threads the accessor (index.ts:1633 → attach-main-window-services.ts:137, the only production caller). Barrier identity is a module-level let bound once per launch (index.ts:3286/3289 → :1148), so the WeakSet-by-identity gate is sound; a hypothetical rebind degrades to one extra conservative null, and ablation A4 proves the suite catches a gate that fails to reopen.
4. Legacy byte-parity — mechanical differential harness
Built a 22-probe scratch harness (5 phases: no-barrier local, SSH registered, unsettled barrier, settled barrier + daemon owner, headless re-registration; sync + IPC probes each) writing one JSON row per probe; ran it against merge-base production code and head production code and diffed the outputs.
18/22 rows byte-identical. The only 4 diffs are the fix itself:
C.sync.daemon-restored:false→null(swap window)C.ipc.daemon-restored:false→PENDING(deferred, landstruefrom the post-swap owner)A/D.sync.remote-handle:false→null— the seam-2 guard, deliberately unconditional (matches the async probe's existingremote:handling on main); all five sync consumers audited above handle it (three-way,!== truedecision-identical, or abort-to-full-sweep).
All exemption rows (SSH live/dead, provider-gone, headless sole-owner false, post-settle known/unknown) are byte-identical.
5. Wire claim vs shipped v1.4.190
Verified against the tag, not the vocabulary's existence on main: local and remote v1.4.190 peel to the same commit 6e4f817101da. At that tag: src/shared/pty-liveness-verdict.ts ships the full live | unverifiable | exited union and NO_OBSERVING_PROVIDER_REASON; src/cli/terminal-format.ts formats ptyStopVerdict === 'unverifiable' (:218), host=unverifiable (:28), and unverifiable scope (:43), with shipped tests asserting each. This PR adds no wire field, opcode, or frame — pty:hasPty is same-binary Electron IPC — and the only value that can newly reach a paired v1.4.190 client is an unverifiable verdict it already decodes and prints. Rule 1/2/3 of docs/reference/remote-wire-compatibility.md: clean.
6. Overlap with sibling PRs
File-disjoint from all four: #16932 (orca-runtime.ts, pty-liveness-verdict.ts), #16955 (providers/* inspection), #16926 (relay/pty-handler*, preload), #16924 (daemon pid publish). Composition with #16932 verified in code: this PR stops the provider fabricating false; #16932 stops the summary over-trusting it; #16932's terminal-list-stale-leaf-liveness.test.ts passes at this head. The residual foreground/child-process window (pty:inspectProcess etc.) is #16955's site-5 lane, untouched here.
7. Tests / typecheck / CI (honest attribution)
- Head: new suite 6/6;
terminal-dead-session-reconcile,terminal-pane-recovery,terminal-list-stale-leaf-liveness+ new suite = 60/60;tc:nodeclean. - Full
src/main/ipc/: 3235 passed; 10 failures confined to 4 spawn-env suites (login-shell, serializer-settlement, agent-overlays, codex-home-routing) that fail identically with merge-base production code on this machine — machine-env-dependent, pre-existing, not this PR's. - CI at this SHA: shard 8/8 red on both Node versions on
web-preload-api-runtime-calls.test.ts("unwraps domain failures…") — main-red since Add parent worktree selection when creating workspace #15420, inherited;e2e / ssh docker watcher isolation+ theverifyaggregate are the main-side lane being handled separately. All 14 other test shards, both packages, static analysis, changed-e2e: green. None of the failures are attributable to this change.
8. Performance (hand review; the $perf skill is disable-model-invocation for workers, so this is the documented substitute)
Sync path adds O(1) per call: one startsWith, ≤2 map lookups + a prefix parse, one accessor call, 1–2 WeakSet lookups; no steady-state allocation. Called per leaf per terminal.list build and per send gate — negligible. IPC path adds one microtask (await of a resolved promise) after startup. No new timers or listeners; the settle watcher arms once per barrier identity; WeakSets can't grow (at most a handful of barrier identities per app lifetime). The only real cost is the intended one: presence answers defer during the cold-start swap, bounded per (3a).
9. Superseding bar
This is substantially what I'd write from scratch, with one design difference: from scratch, the barrier owner would publish settledness (e.g. a sync isLocalPtyProviderStartupSettled() set in a .finally beside localPtyProviderReady) instead of consumers inferring it via WeakSet promise-identity bookkeeping — simpler, no arm-once watcher, no one-microtask lag. The current form is contained in one function, correct, and pinned by A4; not worth blocking or widening the diff now. Non-blocking.
P2 notes (none blocking)
- P2 Consumer-side settledness inference (above) — consider migrating to an owner-published sync flag if a third sync consumer of the barrier ever appears.
- P2
buildTerminalSummary's leaf arm (orca-runtime.ts:34052) still reportsconnected:falseduring the swap window when the aggregate inventory misses a daemon-restored id — decision-identical to main, now at least accompanied by anunverifiableverdict instead of an observed absence. This is the acknowledged discovery-completeness residual, not a regression. - Observation:
reconcileDeadSessions(the listSessions-based teardown interminal-dead-session-reconcile.ts:107) has no production callers — the missed-exit path is per-PTYhasPtyonly, so no ungated listSessions teardown seam remains. Consider deleting it in a cleanup PR before someone rewires it.
Reviewed at b3008b63192392430ea40443c3e6b11637407cb2; findings apply to that SHA only.
During the cold-start swap window the routed local provider is still the pre-swap LocalPtyProvider, which does not own restored daemon ids; its answer about one is fabricated, and today reads as unavailable only because the inspection funnel happens to consult hasPty before the provider's own inspection. Completion-sensitive inspection must not ride on that internal ordering: defer until the swap lands, exactly like pty:kill (#7742) and pty:hasPty. SSH-owned ids and no-barrier (headless/orcad sole-owner, #12393) registrations keep answering immediately. The thrice-repeated barrier idiom is now one helper.
Cross-PR audit follow-up @ exact SHA
|
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
Resolve inspect.ts: #17011 moved pty:kill into renderer-kill.ts, which keeps its inline barrier await. The swap-window helper and both gates stay.
Review round — rebased onto current
|
| # | Gate | Test that goes red |
|---|---|---|
| A1 | inspect.ts — pty:hasPty barrier await |
pty:hasPty defers a restored daemon id… |
| A2 | inspect.ts — pty:inspectProcess await + reordered routing guard |
pty:inspectProcess defers a restored daemon id… |
| A3 | operations.ts — remote: early null |
runtime controller hasPty never answers a paired-runtime handle… |
| A4 | operations.ts — sync swap-window gate |
runtime controller hasPty answers null, not false… |
| A5 | operations.ts — settle watcher arming |
runtime controller hasPty answers null, not false… |
No two gates are only jointly pinned. A1/A2/A3/A4 each go red alone on a distinct test; A5 is red alone as a post-settle timeout (without it the answer never returns to authoritative). controller.ts deps threading is type-pinned — reverting it fails tc.
Composes with #16932
File-disjoint. I built the composed tree and ran both suites: 48/48 green. Then ablated each PR's gate on the composed tree:
- Never let a non-owning provider answer a PTY presence question false during the daemon swap window #16953's sync gate ablated → Never let a non-owning provider answer a PTY presence question false during the daemon swap window #16953's test red, Never read an unanswerable hasPty probe as proven PTY absence #16932's suites green.
- Never read an unanswerable hasPty probe as proven PTY absence #16932's
leaf.connectedguard ablated → Never read an unanswerable hasPty probe as proven PTY absence #16932's test red, Never let a non-owning provider answer a PTY presence question false during the daemon swap window #16953's suite green.
So neither makes the other's gate redundant.
Safety of the barrier itself
A gate that can hang is worse than the bug, so I verified rather than assumed. startService builds ready as .then(start).catch(onError).finally(…) — the .catch swallows, so daemon.ready never rejects; failOpenReady is resolve-only at 60s. So Promise.race([daemon.ready, failOpenReady]) cannot reject and cannot outlast the cap: no stuck-null, and no rejection escaping awaitSwapWindow. The sync watcher uses .then(markSettled, markSettled), settling on both arms. localPtyProviderStartupReady is a single module-level promise object, so the WeakSet identity check is stable.
Consumers of the changed value
pty:hasPty was already declared Promise<boolean | null> in preload — no type or wire change, value-level only. Both decision sites are strictly three-valued: shouldReconcileMissingSession reconciles only on isLive === false, and terminal-pane-recovery blocks only on live === false. No !hasPty collapse anywhere, and unhandled values fall to the safe branch — the opposite direction from the sibling defects.
No new type or union is introduced; the existing boolean | null shape is reused.
P2s (non-blocking, no change requested here)
pty:hasChildProcesses/pty:getForegroundProcessremain ungated.hasPtyProviderForInspectionpasses daemon-restored ids through, andLocalPtyProvider.hasChildProcessesreturnsfalsefor an id not in its table, so during the window these still answer a fabricatedfalse. Its only consumer is the window-close confirmation (Terminal.tsx:560), wherefalseskips the "processes are running" prompt — a lost confirmation, not a pane teardown, and daemon sessions survive. Deliberately left to the in-flight foreground/child lane; noting it so it isn't lost.- Sync settle-detection. Inferring "startup settled" by attaching a
.thenwatcher and recording promise identity in aWeakSetworks and is GC-bounded, but an owner-published settled flag would express it directly. Behaviour-identical — better as a follow-up than as churn in a chain that ships together.
Gates
tc:node and tc:web clean · oxlint clean (verified live with a canary) · changed-code quality gate 0/0/0 new findings across 4 files since 94e7586665 · oxfmt --check clean · git diff --check clean · no node:child_process imports added · inspect.ts 277 lines, no max-lines suppression.
CI on c90e2df0c3: 19 success / 8 skipped, with e2e / ssh docker watcher isolation still running at time of writing — a long lane unrelated to these files.
Not verified
No Electron UI validation: this diff has no rendered surface to assert on, and the swap window is a sub-second cold-start race that dev-mode CDP cannot deterministically hit. No Windows host validation, and no packaged-build coverage.
Reconcile the daemon-swap barrier (#16953) with the unverifiable absence return in pty:inspectProcess: main split one guard into two around awaitSwapWindow, so the unverifiable return lands at both halves rather than one. Neither invariant is relaxed — the barrier still runs before the routing check, and neither absence answer can read as a confirmed exit. The sole-owner swap-window assertion now expects the published `unverifiable` evidence: immediate is not observed, and a never-spawned id was never watched exiting.
…during the daemon swap window (stablyai#16953) * fix(pty): answer unverifiable, not false, for presence questions during the daemon swap window During cold start the installed local provider is still the plain in-process LocalPtyProvider until daemon-init swaps in the daemon router. It does not own restored daemon PTY ids, but pty:hasPty and the runtime controller's sync hasPty still let it answer — and its "not in my table" false read as an observed absence: the renderer dead-session reconciler tears panes down on exactly that false, remount recovery refuses on it, and terminal.list records an observed absence instead of an unverifiable verdict. - pty:hasPty now waits for the local-provider startup barrier before choosing an answering provider (the same stablyai#7742 guard pty:kill uses), so the post-swap owner answers. - hasPtyFromRuntimeController is sync and cannot wait; while the startup barrier is unsettled it answers null (unverifiable), and it inherits the async probe's remote-handle guard: no locally routed provider may answer for a paired runtime handle. - SSH-owned ids keep answering from their own provider without waiting, and a registration without a startup barrier (headless/orcad) keeps the in-process provider's false authoritative (stablyai#12393). * test(pty): isolate the remote-handle guard from the swap-window gate * refactor(pty): arm the swap-window settle watcher once per startup promise * Gate pty:inspectProcess on the daemon-swap startup barrier During the cold-start swap window the routed local provider is still the pre-swap LocalPtyProvider, which does not own restored daemon ids; its answer about one is fabricated, and today reads as unavailable only because the inspection funnel happens to consult hasPty before the provider's own inspection. Completion-sensitive inspection must not ride on that internal ordering: defer until the swap lands, exactly like pty:kill (stablyai#7742) and pty:hasPty. SSH-owned ids and no-barrier (headless/orcad sole-owner, stablyai#12393) registrations keep answering immediately. The thrice-repeated barrier idiom is now one helper. (cherry picked from commit 4cb013c)
…during the daemon swap window (stablyai#16953) * fix(pty): answer unverifiable, not false, for presence questions during the daemon swap window During cold start the installed local provider is still the plain in-process LocalPtyProvider until daemon-init swaps in the daemon router. It does not own restored daemon PTY ids, but pty:hasPty and the runtime controller's sync hasPty still let it answer — and its "not in my table" false read as an observed absence: the renderer dead-session reconciler tears panes down on exactly that false, remount recovery refuses on it, and terminal.list records an observed absence instead of an unverifiable verdict. - pty:hasPty now waits for the local-provider startup barrier before choosing an answering provider (the same stablyai#7742 guard pty:kill uses), so the post-swap owner answers. - hasPtyFromRuntimeController is sync and cannot wait; while the startup barrier is unsettled it answers null (unverifiable), and it inherits the async probe's remote-handle guard: no locally routed provider may answer for a paired runtime handle. - SSH-owned ids keep answering from their own provider without waiting, and a registration without a startup barrier (headless/orcad) keeps the in-process provider's false authoritative (stablyai#12393). * test(pty): isolate the remote-handle guard from the swap-window gate * refactor(pty): arm the swap-window settle watcher once per startup promise * Gate pty:inspectProcess on the daemon-swap startup barrier During the cold-start swap window the routed local provider is still the pre-swap LocalPtyProvider, which does not own restored daemon ids; its answer about one is fabricated, and today reads as unavailable only because the inspection funnel happens to consult hasPty before the provider's own inspection. Completion-sensitive inspection must not ride on that internal ordering: defer until the swap lands, exactly like pty:kill (stablyai#7742) and pty:hasPty. SSH-owned ids and no-barrier (headless/orcad sole-owner, stablyai#12393) registrations keep answering immediately. The thrice-repeated barrier idiom is now one helper.
Summary
pty:hasPtynow waits out the same local-provider startup barrierpty:killalready waits on (Renderer crash+restart orphans open terminal PTYs, crashing shells (PowerShell FailFast on broken console pipe) #7742) and lets the post-swap owner answerhasPtyanswersnull(unverifiable) while that barrier is unsettled, and inherits the async probe's paired-runtime-handle guard: aremote:id is never answered from the local registryAuthor: @BrennanKB5
ELI5
When Orca starts up, terminals that survived the last quit live inside a background daemon, and for a moment Orca is still "plugging in" the connector to that daemon. During that moment, if anything asked "is this terminal still alive?", the question went to the old, empty connector — which confidently said "no" about terminals it had never heard of. A confident "no" from something that was never in charge is not evidence. Now Orca either waits for the real owner to answer, or says "I can't check right now" — and only the owner's "no" can ever be treated as a death certificate.
User-facing before / after
When you'd hit this: you restart Orca (or it relaunches after an update) with terminals kept alive by the daemon — agents still running in them — and within the startup window (normally sub-second, up to 60s on a slow daemon start) you switch worktree tabs, type into a restored pane, or run
orca terminal list. The renderer and CLI are live during exactly this window by design.Before: a liveness probe about a restored pane was answered
falseby the pre-swap local provider. Switching back to a hidden worktree could tear the pane down as "Process exited" while the agent inside was alive; typing into a restored pane whose input wasn't deliverable yet triggered a recovery probe that read the samefalseand refused to remount ("a dead PTY is the reconciler's job");terminal.listrecorded the pane as an observed absence, so worker-observation surfaces read a live worker asexited.After: the same probe waits for the swap to land and reports the daemon's real answer (
truefor a live restored pane), and the synchronous listing path reportsunverifiablewith a reason until the swap settles. Panes stay up, recovery remounts proceed, and observation surfaces sayunverifiable, neverexited, until the owner has answered. A post-swap confirmed "no" demotes exactly as before, and headless/relay registrations (daemon installed before the IPC layer, no barrier) keep the installed provider'sfalsefully authoritative.Reliability contract
falsefor it. During the swap window no local provider owns daemon-restored ids, so the answer is deferred (async) orunverifiable(sync) —exitedrequires positive evidence from the owner (docs/reference/ssh-execution-boundary.md, rule 2; rule 1's no-silent-substitution is the same reason aremote:handle is never answered locally).pty:hasPty(src/main/ipc/pty/ipc/inspect.ts) resolved its provider without the startup barrier every sibling destructive/authoritative handler already awaits, andhasPtyFromRuntimeController(src/main/ipc/pty/runtime/operations.ts) had no gate at all — both routed a daemon-restored id to the pre-swapLocalPtyProvider, whoseptyProcesses.has(id)is membership in a table that never contained the id.boolean | nullis the controller's documented presence answer (null= "the query could not be answered"); consumers already resolvenullto the shippedlive | unverifiable | exitedverdicts (markPtyLivenessUnverifiablewithNO_OBSERVING_PROVIDER_REASON), and the renderer reconciler'sisLive !== falseguard already treatsnullas non-evidence (pinned atterminal-dead-session-reconcile.test.ts).pty:hasPtyresolvesfalseduring the window, the sync controller answersfalseduring the window, and aremote:handle is answeredfalsefrom the local registry. The SSH-exemption and no-barrier-authority tests pass pre- and post-fix, pinning that neither surface over-gates.WeakSets (armed once per promise; no strong retention, no timers). The one-microtask lag after settlement yields at most one extraunverifiableanswer, in the conservative direction.Consumers checked (derived, all readers of both surfaces)
Renderer, via
pty:hasPty(answer typePromise<boolean | null>unchanged):shouldReconcileMissingSession→session.onExitpane teardown (use-terminal-pane-lifecycle.tsvisibility resume →session-reconcile-dispose.ts): reconciles only onfalse; the deferred answer is guarded against staleness bylivenessRequestedAt/ptyBoundAt, pty-rebind, and disposed checks — a late realfalsestill tears down.requestTerminalPaneRecovery(terminal-pane-recovery.ts): refuses remount only onfalse; already re-checks its budget across the await.web-terminal-api.ts) answers a constantnull— unchanged.mobile/has nohasPtyconsumer (grepped).Runtime, via
ptyController.hasPty(typeboolean | nullunchanged — every site compiles unchanged; per-site behavior withnullwherefalseused to arrive):orca-runtime.ts:19330(controllerKnowsPtyIsLive,=== true): decision-identical.orca-runtime.ts:33751(inventory sweep):nulltakes the existingmarkPtyLivenessUnverifiablearm instead offorgetPtyLivenessVerdict— the sweep's own comment says onlyfalseis an observed absence; this is the intended verdict correction.orca-runtime.ts:33844(refreshFloatingWorkspacePtyLiveness):nullaborts the targeted fast-path, falling back to the full inventory sweep — previously the fast-path demoted floating panes on the fabricatedfalsewith no verdict at all.orca-runtime.ts:34057(buildTerminalSummaryprovenAbsent rescue,!== true): decision-identical on main — deliberately untouched; the unverifiable-vs-demote refinement of that gate is Never read an unanswerable hasPty probe as proven PTY absence #16932's, and this change composes with it (the provider seam stops fabricating thefalsethat gate must trust).orca-runtime.ts:9389: method-presence check only.Direct
provider.hasPtycallers not routed through these seams, each still owner-scoped or out of scope: SSH provider/relay session tables (own their ids), daemon router/degraded/owner-resolution internals (post-swap authorities),writePtyInputAccepted(a delivery refusal, not a liveness fact — true during the window), andpty-process-inspection.ts:17(foreground/child inspection lane, in flight separately — listed under residual risk).Remote wire
No RPC params, stream frames, or opcodes change;
pty:hasPtyis same-binary Electron IPC. Value-level: the only delta a paired peer can see isobservation.status: 'unverifiable'withNO_OBSERVING_PROVIDER_REASONoccurring in a window that previously published an observed absence. Verified against the shipped release tag v1.4.190 (6e4f817101da): theunverifiableunion member withreason, theNO_OBSERVING_PROVIDER_REASONconstant, and CLI formatting for unverifiable rows/verdicts (src/cli/terminal-format.ts) all ship there, so old clients parse and render this value today. No capability gating needed.Performance
Steady-state sync path adds one
ptyOwnershiplookup, an SSH-id parse only for unowned ids, one thunk call, and oneWeakSetmembership test — O(1), no polling, timers, or subprocesses; no new spawns (child-process allowlists and ratchet baselines untouched). The IPC path adds one await on an almost-always-settled promise. During the window,nullshort-circuits provider work entirely; the deferred IPC answer is bounded by the existing 60s startup fail-open cap, the same boundpty:killaccepts.Verification
pnpm test src/main/ipc/pty-startup-swap-window-presence.test.ts— 6/6 post-fix; 3 fail against origin/main production filespnpm test src/main/ipc ...(333 files): all pty/ipc/liveness/reconcile suites pass; the only failures (4 files / 10 tests, spawn-env ZDOTDIR/agent-overlay expectations) reproduce identically with origin/main production code on this machine — pre-existing, unrelatedpnpm test src/main/runtime/orca-runtime.test.ts(1213 passed), stale-leaf + partial-relay liveness,terminal-dead-session-reconcile.test.tspnpm tc(gate proven live with a type-error canary),oxlint(gate proven live with a canary),oxfmt --check, changed-code quality gate: 0 new findingsResidual risk
pty:inspectProcess,pty:hasChildProcesses,pty:getForegroundProcess, andpty-process-inspection.ts:17'shasPty === falseshort-circuit) still answer from the pre-swap provider as idle/no-children. That is the foreground/child-inspection coercion family, owned by the in-flight sibling lane — deliberately not touched here.DegradedDaemonPtyProvider.hasPtyanswersfalsepost-swap for a session its init-time discovery missed; post-swap the degraded provider fronts every local backend, so this is a discovery-completeness question, not a non-owner answer — noted, not changed.