Repository navigation
Layout groundwork (switched off): every question about which pane holds a terminal asks main's layout - #32002
Conversation
…eOfPty (L80) With the layout-owner switch on, main's layout answers which tab and pane hold a terminal, and nothing reads or writes the PTY record's tabId/paneKey copies or their graph stamp. Switch-off reads the copies exactly as before.
…raph A headless host never installs a window graph, so the query asked a publisher that did not exist and every terminal read as paneless. The index is now made on first query; it publishes only once a graph is installed, as before.
…e with or without a window (switch-on only)
… before it registers (L80)
… as the spawn commit does (L80) Also, with the switch on: skip the bind-first check for a paired server's workspace, release a closed tab's terminal ownership once main has dropped the pane, and publish a pane's agent status from the terminal main's layout binds it to.
…ires (switch-on only, L80 Q2) Main's layout write records every pane it drops whose terminal no pane holds any more, in a new optional session field closedTerminalPanesByPaneKey (same TTL and cap as closed-tab records). Exit cleanup reads main's layout first, then that record by terminal id and incarnation, and removes the entry it used. Older builds ignore the field.
…switch-on only, L80 Q2) The step receives each dropped pane (host, worktree, tab, leaf, terminal, incarnation), computed across the whole layout so a moved pane is not dropped, and runs only for a commit that declares a live edit. Today it records the closed-pane entries; a drop is recorded once per terminal.
…its live terminals after main's layout drops the panes (switch-on only, L80) The headless close reads each row's live terminal before main's close drops the panes it is found by, and a renderer-retired tab releases the owned terminal main left in no pane, as the explicit close already did. Close tests now commit through main's layout and bind panes first.
…r's partition is main's pane (switch-on only, L257) Older builds could save a local worktree's tab rows into a runtime partition (#18202); its terminals are local, so main's index takes those tabs for workspaces the router homes locally. A tab or terminal the local partition also holds is indexed once, from there; SSH and server-owned workspaces are skipped as before.
…record only layout-owner builds write (L80)
…minal_not_found in layout-owner builds (L80 #7) Main's layout no longer holds the pane, so there is no pane to answer for; window-owned builds keep the disconnected stub from the exited terminal's record.
…e and spawn commit do (L80) Fake PTY spawns commit the binding into the pane the runtime wrote, stores list their partitions, and SSH sessions sit in their ssh:<conn> partition; terminals registered directly bind first.
…kspace and stamped incarnation match (switch-on only, L80) A record made before its adoption registers (a host restart) or a local id reused after one matched a saved binding by id alone, so a phone or paired desktop could be handed a second handle for the pane before the terminal's own handle arrived and stay on it.
…nd no local record rescues a paired server's tab (L80)
… production does (L80) A recoverable pane is one the host inventory dropped with no exit, live terminals register rather than appear only in the window graph, and SSH stores route as the real Store does.
# Conflicts: # src/main/runtime/orca-runtime-cold-restore-terminal-membership.test.ts # src/main/runtime/orca-runtime-terminal-cwd.test.ts # src/main/runtime/orca-runtime-tests/terminal-creation-and-readiness-part-08.spec.ts # src/main/runtime/session-tabs/session-tabs-inventory.ts # src/main/runtime/terminal/query/pty-terminal-summary.ts # src/main/runtime/terminal/surface/terminal-surface-index.ts # src/main/runtime/workspaces/persisted-surfaces/restored-terminal-placement.ts # src/main/runtime/workspaces/workspace-removal-target.ts
…tion does; PR-1's main-layout closes in the part-10 and part-11 close tests (L80)
…ofile does; PR-1's own closes in the part-05, part-08 and UUID-leaf close tests (L80)
…eeping bind-first under the line limit (L80)
… the switch on, not the record copy (L80)
… layout closes with the switch on (#31571), in the no-widening and surface-close tables (L80)
…relay ack when the switch is on (#31571) (L80)
…he other pane that held the session (layout-owner build, L80 P1)
… with no registered terminal, under the line limit (L80 P1)
…nbinds it from the saved pane of the older process (layout-owner build, L80 P2)
…leaf ids per pane, and a window that draws main's own panes (layout-owner build, L80)
…t was resolved for that pane, its own terminal ended, and the replacement is connected there now (layout-owner build, L80)
…main's layout order rules); headless phone tab order is L283
…55, L256, L259a, L259b); a same-id respawn's commit stamps its incarnation; the crossing terminal binds first
…ace fence (L256 switch-on variant); the placement test's tabs are main's saved layout
…tamp on the handle record, not a second map; moved-pane, restart and single-reader tests (layout-owner build, L80)
…n's rename, and a mobile-created tab's live shell is the one its commit registers (layout-owner build, L80)
…pane holds its terminal (review)
…rkspace and incarnation), and any exit event settles a later wait (review)
… that retires the pane, and an unbind folds into the binding write (layout-owner build, L80) The exit used to remove main's closed-pane entry in a session write of its own, before the retirement write. It now reads the entry, and the retirement write for that pane drops it, re-checked by terminal id and incarnation. An exit that keeps the surface (relay contact lost, intentional stop) keeps the entry until a confirmed exit or its TTL. A reused terminal id's unbind is now a pure computation that applyPtyBinding applies through its existing writes. Two split-pane tests still expected a -1 exit to close the pane; they now follow the ruling that any negative code keeps it. Static-gate fixes: test fixtures and tests use typed member access instead of Reflect, and no longer use type assertions.
…and the L283 store lists its partitions, as a profile Store does; L289's test passes on that store (layout-owner build, L80)
The fixture store bindPaneFirst fills now tells write listeners of every session write, direct or
by a layout command, so main's post-commit merge runs as it does on a real Store. The notice is
not enumerable, so a test's own `{ ...store }` copy, which keeps its writes elsewhere, does not
inherit a subscription it would never fire. With it, the targeted split-group create (L289) passes
at this head, so its it.fails mark goes. L283's test runs on a store that names its partitions and
stays it.fails("L283").
…ards again, so the switch-off build re-issues no handle on a refused recovery (layout-owner build, L80) The stale-handle switch point had moved the handle lookup ahead of the pane, terminal and workspace checks. That lookup can re-issue a handle, so a switch-off recovery refused on those checks gained a side effect base never had. The lookup runs after them again, and the switch-on replacement check lives in one method.
…e binding before main registers the terminal, as the host does (L80 switch-on variant) The window-tab start test came in with the main merge after bind-first; its fake spawn returned a terminal no pane was bound to, so registration refused it. The fixture's spawn now binds the pane first, as every other bind-first fixture does.
…o exit code, so an exit wait on it cannot settle on the old process's code (layout-owner build, L80) The record of a reused id kept the earlier process's lastExitCode, and with the switch on an exit wait settles on any recorded code once the terminal reads disconnected. A new incarnation now clears the code and cause. Also drops the L283 test's partition-list option: the fixture store already lists its partitions.
…ever loaded (L80) - A restored pane's host lists the terminal it started; a pane main owns vouches for none. - The other pane holding a slept session is in main's layout, so an unverifiable holder blocks the resume as it does through a window. - Main sleeps a workspace whose panes it lists itself, even with a renderer attached (#31571). - A graph sync no longer reconnects a disconnected terminal of main's pane; the inventory decides.
…store, and the untitled cases wait on L268 with the switch on The window's tab uses main's id (the file path), and the store lists its partitions and saves each open editor's unified tab and group, as the window does (the fixture from #31667). With the switch on, the three untitled cases fail on L268, main's row merge dropping the untitled flag, which #31667 fixes; they are it.fails until A1b's history includes it.
…ane-of-pty # Conflicts: # src/main/runtime/orca-runtime-mobile-markdown-tab-routes.test.ts # src/main/runtime/session-lifecycle/projection/apply-mobile-session-tab-navigation.ts # src/main/runtime/terminal/launch/mobile-terminal-chat-fork.test.ts # src/main/runtime/terminal/surface/terminal-surface-index.ts # src/shared/workspace-layout/workspace-layout-command-types.ts
…ing A1b's additions to their helpers (L80) After the main merge, the holder-pane check and a closed tab's live-terminal lookup pushed two files past the line limit. The holder check is now paneHoldsSession (main-terminal-surfaces.ts) behind one method, and the closed tab's lookup is one parent-class method. Behaviour unchanged.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ➖ Normal Merge Risk: 🟡 Moderate · up to
|
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
75cef880-a272-4bd8-9cb5-05fe96112c71
📒 Files selected for processing: 230
src/main/orca-profiles/profile-project-session-field-disposition.tssrc/main/persistence/closed-terminal-panes-registration.test.tssrc/main/persistence/loading-store/pty-binding-session-update.tssrc/main/persistence/loading-store/pty-spawn-exit-durability.test.tssrc/main/persistence/loading-store/reused-terminal-id-unbind.test.tssrc/main/persistence/loading-store/reused-terminal-id-unbind.tssrc/main/persistence/restoring-sessions/session-owner-removal.tssrc/main/persistence/restoring-sessions/session-worktree-ownership.tssrc/main/persistence/terminal-topology/layout-owner-written-session-golden.test.tssrc/main/persistence/terminal-topology/terminal-layout-pane-ops.test.tssrc/main/persistence/terminal-topology/terminal-pane-admission.tssrc/main/persistence/terminal-topology/unshown-live-terminal-placement-restart.test.tssrc/main/persistence/tracking-repos/worktree-identity-migration-field-coverage.test.tssrc/main/persistence/tracking-repos/worktree-identity-migration.tssrc/main/runtime/__fixtures__/main-layout-close-fixture.tssrc/main/runtime/__fixtures__/orca-runtime-terminal-close-continuity-fixtures.tssrc/main/runtime/agent-transcript-pane-test-harness.tssrc/main/runtime/bind-first-pane.test-fixture.tssrc/main/runtime/construction/runtime-construction-services.tssrc/main/runtime/construction/runtime-identity-state.tssrc/main/runtime/construction/runtime-service-state.tssrc/main/runtime/exited-split-pane-layout-close.test.tssrc/main/runtime/floating-terminal-inventory-ownership.test.tssrc/main/runtime/graph-sync-live-daemon-pty-tab-preservation.test.tssrc/main/runtime/headless-create-terminal-handle-main.test.tssrc/main/runtime/headless-placeholder-graph-surface-standing.spec.tssrc/main/runtime/held-pane-reopen-layout-owner.test.tssrc/main/runtime/host-sleep-resume-record.test.tssrc/main/runtime/mobile-session-resume-identity.test.tssrc/main/runtime/omp-user-bubble-launch-authority.test.tssrc/main/runtime/opencode-finished-session-authority.test.tssrc/main/runtime/orca-runtime-cold-restore-terminal-membership.test.tssrc/main/runtime/orca-runtime-default-tab-agent-status.test.tssrc/main/runtime/orca-runtime-default-tabs-layout-owner.test.tssrc/main/runtime/orca-runtime-exited-split-pane-close.test.tssrc/main/runtime/orca-runtime-failed-start-pane-layout-owner.test.tssrc/main/runtime/orca-runtime-get-status.tssrc/main/runtime/orca-runtime-hook-agent-status-projection.test.tssrc/main/runtime/orca-runtime-layout-owner-start-fixture.tssrc/main/runtime/orca-runtime-mobile-agent-status-ordering.test.tssrc/main/runtime/orca-runtime-mobile-close-preserved-resurrection.test.tssrc/main/runtime/orca-runtime-mobile-markdown-tab-routes.test.tssrc/main/runtime/orca-runtime-provider-reattach-launch-identity.test.tssrc/main/runtime/orca-runtime-session-tabs-path-alias.test.tssrc/main/runtime/orca-runtime-terminal-close-continuity.test.tssrc/main/runtime/orca-runtime-terminal-close-no-widening.test.tssrc/main/runtime/orca-runtime-terminal-create-replay-after-close.test.tssrc/main/runtime/orca-runtime-terminal-cwd.test.tssrc/main/runtime/orca-runtime-terminal-handle-incarnation.test.tssrc/main/runtime/orca-runtime-terminal-rename-retention.test.tssrc/main/runtime/orca-runtime-terminal-split-authority.test.tssrc/main/runtime/orca-runtime-terminal-surface-close.test.tssrc/main/runtime/orca-runtime-test-fixtures.spec.tssrc/main/runtime/orca-runtime-test-lifecycle.spec.tssrc/main/runtime/orca-runtime-tests/agent-status-and-waits.spec.tssrc/main/runtime/orca-runtime-tests/mobile-creation-and-orchestration-part-03.spec.tssrc/main/runtime/orca-runtime-tests/mobile-creation-and-orchestration.spec.tssrc/main/runtime/orca-runtime-tests/mobile-session-tabs-headless-chat-rebuild.spec.tssrc/main/runtime/orca-runtime-tests/mobile-session-tabs-part-03.spec.tssrc/main/runtime/orca-runtime-tests/mobile-session-tabs-part-04.spec.tssrc/main/runtime/orca-runtime-tests/mobile-session-tabs-part-05.spec.tssrc/main/runtime/orca-runtime-tests/mobile-session-tabs-part-06.spec.tssrc/main/runtime/orca-runtime-tests/mobile-session-tabs-part-07.spec.tssrc/main/runtime/orca-runtime-tests/mobile-session-tabs-part-08.spec.tssrc/main/runtime/orca-runtime-tests/mobile-session-tabs-part-09.spec.tssrc/main/runtime/orca-runtime-tests/mobile-session-tabs-part-10.spec.tssrc/main/runtime/orca-runtime-tests/mobile-session-tabs-part-11.spec.tssrc/main/runtime/orca-runtime-tests/mobile-session-tabs-part-12.spec.tssrc/main/runtime/orca-runtime-tests/mobile-session-tabs-part-13.spec.tssrc/main/runtime/orca-runtime-tests/mobile-session-tabs-shell-selection.spec.tssrc/main/runtime/orca-runtime-tests/mobile-session-tabs.spec.tssrc/main/runtime/orca-runtime-tests/mobile-summaries-part-02.spec.tssrc/main/runtime/orca-runtime-tests/mobile-summaries-part-03.spec.tssrc/main/runtime/orca-runtime-tests/program-status-osc.spec.tssrc/main/runtime/orca-runtime-tests/split-placement-session.test-fixture.tssrc/main/runtime/orca-runtime-tests/targeting-and-resilience.spec.tssrc/main/runtime/orca-runtime-tests/terminal-creation-and-readiness-part-02.spec.tssrc/main/runtime/orca-runtime-tests/terminal-creation-and-readiness-part-05.spec.tssrc/main/runtime/orca-runtime-tests/terminal-creation-and-readiness-part-08.spec.tssrc/main/runtime/orca-runtime-tests/terminal-creation-and-readiness.spec.tssrc/main/runtime/orca-runtime-tests/terminal-handles-and-agent-status-part-04.spec.tssrc/main/runtime/orca-runtime-tests/terminal-handles-and-agent-status-part-05.spec.tssrc/main/runtime/orca-runtime-tests/terminal-handles-and-agent-status.spec.tssrc/main/runtime/orca-runtime-tests/terminal-handles-part-02.spec.tssrc/main/runtime/orca-runtime-tests/terminal-handles.spec.tssrc/main/runtime/orca-runtime-tests/terminal-output-and-worker-recovery-part-02.spec.tssrc/main/runtime/orca-runtime-tests/terminal-output-and-worker-recovery-part-03.spec.tssrc/main/runtime/orca-runtime-tests/terminal-output-and-worker-recovery-part-06.spec.tssrc/main/runtime/orca-runtime-tests/terminal-output-and-worker-recovery.spec.tssrc/main/runtime/orca-runtime-tests/terminal-side-effect-facts.spec.tssrc/main/runtime/orca-runtime-tests/terminal-sleep-and-teardown.spec.tssrc/main/runtime/orca-runtime-tests/worktree-ps-agent-row-dismissal.spec.tssrc/main/runtime/orca-runtime-tests/worktree-terminal-close-reattached-relay.spec.tssrc/main/runtime/orca-runtime.tssrc/main/runtime/orchestration-mailbox-notification-consistency.test.tssrc/main/runtime/orchestration-mailbox-notification-test-harness.tssrc/main/runtime/orchestration/db/hot-path-statement-compilation.test.tssrc/main/runtime/orchestration/terminal-authority/verify-orchestration-compatibility-caller.tssrc/main/runtime/orchestration/terminal-authority/write-orchestration-pointer-pty.tssrc/main/runtime/orchestration/terminal-pane-mail-routing.tssrc/main/runtime/owned-session-teardown-policy.test.tssrc/main/runtime/paired-close-retirement-proof-publication-order.spec.tssrc/main/runtime/paired-host-terminal-close.test.tssrc/main/runtime/profile-session-store.test-fixture.tssrc/main/runtime/pty-exit-agent-status-reconciliation.spec.tssrc/main/runtime/pty-inventory-lifecycle-fixture.tssrc/main/runtime/pty-inventory-liveness-verdict.spec.tssrc/main/runtime/pty-recorded-surface-topology.test.tssrc/main/runtime/pty-recorded-surface-topology.tssrc/main/runtime/qoder-independent-spawn-review.test.tssrc/main/runtime/qoder-mobile-resume-adoption.test.tssrc/main/runtime/restored-pane-start-cli-handles.test.tssrc/main/runtime/restored-pane-start-layout-owner.test.tssrc/main/runtime/rpc/methods/orchestration/federation/federation-liveness-verdict.test.tssrc/main/runtime/rpc/methods/orchestration/worker/worker-release-mobile-report.test.tssrc/main/runtime/rpc/methods/orchestration/worker/worker-release-runtime-incarnation.spec.tssrc/main/runtime/rpc/methods/orchestration/worker/worker-release.test-support.tssrc/main/runtime/rpc/methods/structured-agent-session-adoption-replay.test.tssrc/main/runtime/rpc/orchestration-runtime-update-settlement.test.tssrc/main/runtime/runtime-agent-orchestration-projection.tssrc/main/runtime/runtime-created-worktree-terminal-target.test.tssrc/main/runtime/runtime-graph-mirror-capture.test.tssrc/main/runtime/runtime-mobile-session-projection.tssrc/main/runtime/runtime-owned-terminal-publication-lineage.test.tssrc/main/runtime/runtime-rpc-mobile-terminal-streaming.test.tssrc/main/runtime/runtime-terminal-contracts.tssrc/main/runtime/runtime-terminal-orphan-adoption-duplicate-pty.test.tssrc/main/runtime/runtime-terminal-orphan-adoption-plan.tssrc/main/runtime/runtime-terminal-orphan-adoption-rollback.test.tssrc/main/runtime/runtime-terminal-state-records.tssrc/main/runtime/runtime-worktree-ps-activity.tssrc/main/runtime/session-graph/session-graph-promotion.tssrc/main/runtime/session-graph/session-window-graph.tssrc/main/runtime/session-lifecycle/close/closed-tab-terminal.tssrc/main/runtime/session-lifecycle/close/has-live-or-persisted-serve-or-ssh-owned-pty-binding.tssrc/main/runtime/session-lifecycle/projection/apply-mobile-session-tab-navigation.tssrc/main/runtime/session-lifecycle/projection/prune-mobile-session-tab-group-layout.tssrc/main/runtime/session-lifecycle/projection/reconcile-headless-mobile-session-browser-tabs.tssrc/main/runtime/session-tabs-inventory-publication.test.tssrc/main/runtime/session-tabs/explicit-terminal-close-stops.tssrc/main/runtime/session-tabs/headless-terminal-tab-close.tssrc/main/runtime/session-tabs/main-layout-agent-launch-tabs.tssrc/main/runtime/session-tabs/mobile-session-membership.tssrc/main/runtime/session-tabs/mobile-session-preservation.tssrc/main/runtime/session-tabs/renderer-session-terminal-rescue.tssrc/main/runtime/session-tabs/session-tabs-inventory.tssrc/main/runtime/session-tabs/terminal-surface-retirements.tssrc/main/runtime/stale-title-display-surfaces.test.tssrc/main/runtime/structured-agent-cli-writers.test.tssrc/main/runtime/terminal-list-pending-pty-registration.test.tssrc/main/runtime/terminal-list-surface-lost-orphan.spec.tssrc/main/runtime/terminal-pane-recovery-liveness-gate.test.tssrc/main/runtime/terminal-restore-record-seed.test.tssrc/main/runtime/terminal-retirement-proof-emitted-frame.test.tssrc/main/runtime/terminal-retirement-proof-publication.test.tssrc/main/runtime/terminal-wait-name-only-idle.test.tssrc/main/runtime/terminal/adoption/adopt-terminal-orphans-from-inventory.tssrc/main/runtime/terminal/adoption/unshown-live-terminal-placement.tssrc/main/runtime/terminal/focus/focus-terminal.tssrc/main/runtime/terminal/identity/adopted-pane-handle-race-main.test.tssrc/main/runtime/terminal/identity/main-pane-record-arrival.test.tssrc/main/runtime/terminal/identity/pty-worktree-record.tssrc/main/runtime/terminal/identity/terminal-handle-bindings.tssrc/main/runtime/terminal/launch/mobile-terminal-chat-fork.test.tssrc/main/runtime/terminal/launch/mobile-terminal-create.tssrc/main/runtime/terminal/launch/mobile-terminal-owned-create.tssrc/main/runtime/terminal/launch/terminal-create-pane-last-grid.test.tssrc/main/runtime/terminal/launch/terminal-split-layout-owner.test.tssrc/main/runtime/terminal/launch/terminal-split-surface.tssrc/main/runtime/terminal/lifecycle/bind-first-registration-census.test.tssrc/main/runtime/terminal/lifecycle/bind-first-registration.test.tssrc/main/runtime/terminal/lifecycle/bind-first-registration.tssrc/main/runtime/terminal/lifecycle/closed-pane-of-exited-pty.tssrc/main/runtime/terminal/lifecycle/exited-split-pane-rule.test.tssrc/main/runtime/terminal/lifecycle/exited-split-pane-rule.tssrc/main/runtime/terminal/lifecycle/main-pane-liveness.test.tssrc/main/runtime/terminal/lifecycle/pty-controller-inventory-refresh.tssrc/main/runtime/terminal/lifecycle/pty-exit-lifecycle.tssrc/main/runtime/terminal/lifecycle/pty-registration.tssrc/main/runtime/terminal/lifecycle/ssh-exit-code-pane-outcome.test.tssrc/main/runtime/terminal/output/headless-terminal-hydration.tssrc/main/runtime/terminal/output/terminal-derived-agent-facts.tssrc/main/runtime/terminal/output/terminal-orchestration-authority.tssrc/main/runtime/terminal/output/terminal-transient-facts.tssrc/main/runtime/terminal/query/pty-terminal-summary.tssrc/main/runtime/terminal/recovery/replaced-pane-handle-recovery.test.tssrc/main/runtime/terminal/recovery/resolve-terminal-pane.tssrc/main/runtime/terminal/stop/worktree-sleep-resume-recording.tssrc/main/runtime/terminal/stop/worktree-terminal-stop-targets.tssrc/main/runtime/terminal/stop/worktree-terminal-stop.tssrc/main/runtime/terminal/surface/closed-pane-exit-cleanup-main.test.tssrc/main/runtime/terminal/surface/main-pane-verdict.tssrc/main/runtime/terminal/surface/main-terminal-surfaces.tssrc/main/runtime/terminal/surface/pty-pane-copies-untouched-main.test.tssrc/main/runtime/terminal/surface/pty-pane-copy-census.test.tssrc/main/runtime/terminal/surface/pty-pane-query.tssrc/main/runtime/terminal/surface/terminal-surface-index-spill.test.tssrc/main/runtime/terminal/surface/terminal-surface-index.tssrc/main/runtime/terminal/surface/terminal-surface-replies-main.test.tssrc/main/runtime/terminal/view/mobile-terminal-surface.tssrc/main/runtime/terminal/wait/terminal-wait-permission.tssrc/main/runtime/terminal/wait/terminal-wait.tssrc/main/runtime/tui-idle-delivery-and-quiescence.test.tssrc/main/runtime/tui-idle-wait-test-harness.tssrc/main/runtime/workspaces/known-workspace-file-target.tssrc/main/runtime/workspaces/persisted-surfaces/automation-operations.tssrc/main/runtime/workspaces/persisted-surfaces/has-exact-persisted-terminal-surface-identity.tssrc/main/runtime/workspaces/persisted-surfaces/restored-terminal-placement.tssrc/main/runtime/workspaces/startup/workspace-terminal-provisioning.tssrc/main/runtime/workspaces/workspace-process-listing.tssrc/main/runtime/workspaces/workspace-removal-target.tssrc/main/runtime/worktree-agent-first-surface.test.tssrc/shared/__fixtures__/layout-owner-written-session.jsonsrc/shared/closed-terminal-panes.tssrc/shared/closed-terminal-tab-tombstones.tssrc/shared/workspace-layout/workspace-layout-beside.tssrc/shared/workspace-layout/workspace-layout-command-types.tssrc/shared/workspace-layout/workspace-layout-commands.tssrc/shared/workspace-layout/workspace-layout-disk-fields.tssrc/shared/workspace-layout/workspace-layout-dropped-leaves.test.tssrc/shared/workspace-layout/workspace-layout-dropped-leaves.tssrc/shared/workspace-layout/workspace-layout-load.tssrc/shared/workspace-layout/workspace-layout-model.tssrc/shared/workspace-layout/workspace-layout-profile.test-fixture.tssrc/shared/workspace-layout/workspace-layout-save.tssrc/shared/workspace-session-host-field-ownership.tssrc/shared/workspace-session-schema-field-coverage.test.tssrc/shared/workspace-session-schema.tssrc/shared/workspace-session-state-types.tssrc/shared/wsl-move/wsl-move-dispositions.ts
💤 Files with no reviewable changes: 1
- src/main/runtime/orca-runtime.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.
| const retired = retireTerminalSurfaceFromPersistence(current, surface) | ||
| const next = | ||
| retired !== current && closedPane?.paneKey === `${surface.parentTabId}:${surface.leafId}` | ||
| ? forgetClosedPaneOfExit(retired, closedPane) | ||
| : retired |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
#!/bin/bash
# Check whether retireTerminalSurfaceFromPersistence can return its input unchanged.
ast-grep run --pattern 'export function retireTerminalSurfaceFromPersistence($$$) { $$$ }' --lang typescript src
rg -nP -C3 'return\s+session\b|return\s+current\b' $(rg -l 'function retireTerminalSurfaceFromPersistence' src)Repository: stablyai/orca
Length of output: 960
🏁 Script executed:
set -o pipefail
printf '%s\n' '--- terminal-surface-retirements.ts ---'
nl -ba src/main/runtime/session-tabs/terminal-surface-retirements.ts | sed -n '1,240p'
printf '%s\n' '--- references ---'
rg -n -F --glob '*.ts' -e 'retireTerminalSurfaceFromPersistence' -e 'forgetClosedPaneOfExit' -e 'closedTerminalPanesByPaneKey' src/main
printf '%s\n' '--- relevant diff ---'
git diff --no-ext-diff --unified=30 3b02945afe35db12fe5a3b0c3c96c16983d81a4c 2b14a668ec2c27110ca3880617b5e62d82007d69 -- src/main/runtime/session-tabs src/main | sed -n '1,420p'Repository: stablyai/orca
Length of output: 38516
🏁 Script executed:
set -o pipefail
printf '%s\n' '--- persistence retirement ---'
nl -ba src/main/runtime/mobile-session-terminal-persistence-retirement.ts | sed -n '1,290p'
printf '%s\n' '--- closed-pane helper ---'
nl -ba src/main/runtime/terminal/lifecycle/closed-pane-of-exited-pty.ts | sed -n '1,100p'
printf '%s\n' '--- cleanup test ---'
nl -ba src/main/runtime/terminal/surface/closed-pane-exit-cleanup-main.test.ts | sed -n '1,220p'
printf '%s\n' '--- stage callers ---'
rg -n -C5 -F --glob '*.ts' -e 'stageTerminalSurfaceRetirements(' -e 'retireMobileSessionSurfacesForPty(' src/main/runtime src/main/terminal src/main/ipcRepository: stablyai/orca
Length of output: 27181
🏁 Script executed:
set -o pipefail
printf '%s\n' '--- exit lifecycle ---'
nl -ba src/main/runtime/terminal/lifecycle/pty-exit-lifecycle.ts | sed -n '210,325p'
printf '%s\n' '--- closed-pane writes and lookup ---'
rg -n -C6 -F --glob '*.ts' -e 'closedTerminalPanesByPaneKey =' -e 'closedTerminalPanesByPaneKey:' -e 'closedTerminalPaneOf(' -e 'ClosedPaneOfExit' src/main
printf '%s\n' '--- focused tests for unchanged retirement and reuse ---'
rg -n -C8 -F --glob '*.test.ts' -e 'returns the same' -e 'later incarnation' -e 'reused' -e 'pty mismatch' -e 'closed-pane' src/main/runtime src/main/persistence | sed -n '1,320p'Repository: stablyai/orca
Length of output: 41246
🏁 Script executed:
set -o pipefail
printf '%s\n' '--- closed-pane exit caller ---'
nl -ba src/main/runtime/terminal/lifecycle/pty-exit-lifecycle.ts | sed -n '35,75p'
printf '%s\n' '--- delayed-incarnation retirement test ---'
nl -ba src/main/runtime/orca-runtime-terminal-retirement.test.ts | sed -n '450,535p'Repository: stablyai/orca
Length of output: 5622
Remove the closed-pane record independently of persistence retirement.
retireTerminalSurfaceFromPersistence can return current when the bound incarnation or layout PTY does not match. In that case, the current condition skips forgetClosedPaneOfExit, so a matching closed-pane record can remain persisted. forgetClosedPaneOfExit already checks the PTY and incarnation before deletion.
🐛 Suggested fix
--- "a/src/main/runtime/session-tabs/terminal-surface-retirements.ts"
+++ "b/src/main/runtime/session-tabs/terminal-surface-retirements.ts"
@@ -58,11 +58,11 @@
kept.push(surface)
continue
}
const retired = retireTerminalSurfaceFromPersistence(current, surface)
const next =
- retired !== current && closedPane?.paneKey === `${surface.parentTabId}:${surface.leafId}`
+ closedPane?.paneKey === `${surface.parentTabId}:${surface.leafId}`
? forgetClosedPaneOfExit(retired, closedPane)
: retired
if (next === current) {
continue
}📝 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.
| const retired = retireTerminalSurfaceFromPersistence(current, surface) | |
| const next = | |
| retired !== current && closedPane?.paneKey === `${surface.parentTabId}:${surface.leafId}` | |
| ? forgetClosedPaneOfExit(retired, closedPane) | |
| : retired | |
| const retired = retireTerminalSurfaceFromPersistence(current, surface) | |
| const next = | |
| closedPane?.paneKey === `${surface.parentTabId}:${surface.leafId}` | |
| ? forgetClosedPaneOfExit(retired, closedPane) | |
| : retired |
…ath, as every product path does; L283 stays it.fails for the main-owned reorder openChat recorded the chat only in the runtime's snapshot, so main's layout never held it and the phone's reorder was refused as an unknown tab. On the publish path main's layout holds it; the reorder is accepted but does not survive the row rebuild after a close (L283, reopened).
… L288 pass, so their expected-failure marks go - main-layout-session-tab-move.ts: both sides' methods and imports kept. - mobile-session-tabs-headless-chat-rebuild.spec.ts: main's L283 test (its realistic store and publish path) as a plain test; this branch's publish-path openChat kept. - mobile-session-tabs-part-03.spec.ts: the L288 placement cases are one plain it.each.
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
81e61f98-66f3-47bb-8c39-ce58b8d710b0
📒 Files selected for processing: 19
src/main/persistence/terminal-topology/terminal-pane-admission.tssrc/main/runtime/orca-runtime-layout-owner-start-fixture.tssrc/main/runtime/orca-runtime-test-fixtures.spec.tssrc/main/runtime/orca-runtime-test-lifecycle.spec.tssrc/main/runtime/orca-runtime-tests/mobile-session-tabs-headless-chat-rebuild.spec.tssrc/main/runtime/orca-runtime.tssrc/main/runtime/runtime-terminal-contracts.tssrc/main/runtime/session-lifecycle/projection/apply-mobile-session-tab-navigation.tssrc/main/runtime/session-lifecycle/projection/perform-mobile-session-pty-records-refresh.tssrc/main/runtime/session-tabs/headless-terminal-tab-close.tssrc/main/runtime/session-tabs/main-layout-session-tab-move.tssrc/main/runtime/terminal/launch/mobile-terminal-chat-fork.test.tssrc/main/runtime/terminal/launch/mobile-terminal-owned-create.tssrc/main/runtime/terminal/lifecycle/bind-first-registration.test.tssrc/main/runtime/terminal/output/terminal-orchestration-authority.tssrc/main/runtime/terminal/query/pty-terminal-summary.tssrc/main/runtime/terminal/surface/main-terminal-surfaces.tssrc/main/runtime/terminal/surface/terminal-surface-index.tssrc/shared/workspace-layout/workspace-layout-command-types.ts
💤 Files with no reviewable changes: 1
- src/main/runtime/orca-runtime.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.
| const panePtyIds = [...this.ptysById.values()].flatMap((pty) => | ||
| this.paneOfPty(pty).paneKey === paneKey ? [pty.ptyId] : [] |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
sed -n '185,255p' src/main/runtime/session-lifecycle/projection/apply-mobile-session-tab-navigation.ts
sed -n '275,305p' src/main/runtime/session-lifecycle/projection/perform-mobile-session-pty-records-refresh.ts
rg -n 'closedTerminalPanesByPaneKey|isProviderSessionLiveInAnotherPane|resolveMobileSessionResumeCommand' src/main/runtime/session-lifecycle src/main/runtime/terminal src/shared/workspace-layoutRepository: stablyai/orca
Length of output: 8170
🏁 Script executed:
set -o pipefail
rg -n -F --glob '*.ts' \
-e 'getAgentProviderSessionSnapshotFn' \
-e 'getAgentProviderSessionRowsForPaneFn' \
-e 'paneHoldsSession(' \
-e 'closedTerminalPanesByPaneKey' \
-e 'closedTerminalPaneOf' \
-e 'onPtyExit' \
src/main/runtime src/shared/workspace-layout
printf '\n--- session holder helper ---\n'
rg -n -F --glob '*.ts' -e 'function paneHoldsSession' -e 'const paneHoldsSession' src/main
printf '\n--- relevant helper and lifecycle blocks ---\n'
sed -n '1,150p' src/main/runtime/terminal/lifecycle/closed-pane-of-exited-pty.ts
sed -n '330,410p' src/main/runtime/terminal/surface/main-terminal-surfaces.ts
sed -n '1,150p' src/shared/workspace-layout/workspace-layout-dropped-leaves.ts
sed -n '1,130p' src/shared/workspace-layout/workspace-layout-model.tsRepository: stablyai/orca
Length of output: 42156
🏁 Script executed:
set -o pipefail
printf '%s\n' '--- snapshot and row bindings ---'
rg -n -F --glob '*.ts' \
-e 'getAgentProviderSessionSnapshot' \
-e 'getAgentProviderSessionRowsForPane' \
-e 'AgentProviderSessionRow' \
-e 'providerSession' \
src/main/runtime/agent-status src/main/runtime/session-lifecycle src/main/runtime/terminal src/main/runtime/construction src/shared \
| head -n 500
printf '%s\n' '--- host-service declarations and construction ---'
sed -n '95,160p' src/main/runtime/construction/runtime-host-services.ts
sed -n '190,225p' src/main/runtime/construction/runtime-construction.ts
printf '%s\n' '--- exact onPtyExit lifecycle ---'
sed -n '1,150p' src/main/runtime/terminal/lifecycle/pty-exit-lifecycle.ts
printf '%s\n' '--- closed-pane type and record helper ---'
sed -n '1,180p' src/shared/closed-terminal-panes.tsRepository: stablyai/orca
Length of output: 42302
🏁 Script executed:
set -o pipefail
printf '%s\n' '--- concrete callback bindings ---'
rg -n -F --glob '*.ts' \
-e 'getAgentProviderSessionSnapshot:' \
-e 'getAgentProviderSessionRowsForPane:' \
-e 'getAgentStatusSnapshot:' \
-e 'getAgentStatusSnapshotForPane:' \
-e 'reconcileAgentStatusForEndedProcess:' \
-e 'dropAgentStatusForRemovedWorktree:' \
-e 'reconcileAgentStatusForEndedProcess' \
-e 'getAgentProviderSessionSnapshot' \
src
printf '%s\n' '--- status store and row lifecycle declarations ---'
rg -n -F --glob '*.ts' \
-e 'class AgentStatus' \
-e 'AgentStatusStore' \
-e 'snapshot()' \
-e 'removePane' \
-e 'remove.*pane' \
-e 'drop.*pane' \
-e 'ended process' \
src/shared src/mainRepository: stablyai/orca
Length of output: 41248
🏁 Script executed:
set -o pipefail
sed -n '1,80p' src/main/agent-hooks/agent-hook-runtime-deps.ts
rg -n -F --glob '*.ts' \
-e 'getStatusSnapshot()' \
-e 'getStatusSnapshotForPane' \
-e 'reconcileAgentStatusForEndedProcess' \
-e 'class AgentHookServer' \
-e 'class AgentStatusServer' \
src/main src/shared
printf '%s\n' '--- server declarations and reconciliation blocks ---'
rg -n -F --glob '*.ts' -e 'export class AgentHookServer' -e 'class AgentHookServer' srcRepository: stablyai/orca
Length of output: 41610
🏁 Script executed:
set -o pipefail
printf '%s\n' '--- snapshot methods ---'
sed -n '205,255p' src/main/agent-hooks/server/server-listeners.ts
printf '%s\n' '--- exact reconciliation references ---'
rg -n -F --glob '*.ts' \
-e 'reconcileEndedProcessForPaneKeys' \
-e 'reconcileEndedProcess' \
-e 'forgetAgentExit' \
-e 'checkAgentPresenceSince' \
src/main/agent-hooks
printf '%s\n' '--- candidate implementation blocks ---'
rg -n -F --glob '*.ts' \
-e 'reconcileEndedProcessForPaneKeys(' \
-e 'function reconcileEndedProcessForPaneKeys' \
-e 'private reconcileEndedProcessForPaneKeys' \
-e 'protected reconcileEndedProcessForPaneKeys' \
src/mainRepository: stablyai/orca
Length of output: 12643
🏁 Script executed:
set -o pipefail
sed -n '100,175p' src/main/agent-hooks/server/server-cleanup.ts
sed -n '285,325p' src/main/agent-hooks/server/server-state.ts
rg -n -F --glob '*.ts' \
-e 'combinedStatusEntries' \
-e 'preserveResumeIdentity' \
-e 'delete.*status' \
-e 'remove.*status' \
src/main/agent-hooks/server src/main/agent-hooks/ended-process-reconciliation.test.ts
sed -n '55,175p' src/main/agent-hooks/ended-process-reconciliation.test.tsRepository: stablyai/orca
Length of output: 10549
Include the dropped pane’s closed PTY in paneHoldsSession.
A main-owned live-edit drop records the pane in closedTerminalPanesByPaneKey, but it does not reconcile the provider-session row. The row can therefore remain until PTY-exit reconciliation. During that interval, paneOfPty(pty) omits the dropped pane’s PTY, so paneHoldsSession returns false. isProviderSessionLiveInAnotherPane then skips the hook-presence check, and navigation can call resolveMobileSessionResumeCommand for the same provider session while its original PTY is still running.
Include the matching closed-pane PTY binding when collecting panePtyIds. Keep the existing PTY exit checks and closed-record TTL/cleanup behavior.
…31596); the unbound-registration test keeps its spawn from the suites' stand-in commit After the main merge both start lanes register in spawn-commit-assembly.ts, after savePtySpawnPaneBinding (or, adopted, on the live owner's pane); the census lists that file. A phone create now writes its pane before the spawn, so the suites' stand-in spawn commit bound it and the test of a path that registers unbound passed for the wrong reason; that test's controller now opts out of the stand-in commit.
Real switch-on runs showed four files whose fakes registered terminals unbound or confirmed a stop without its exit. Bind first, stamp the source as main does, and deliver the exit a confirmed stop delivers. Switch-off unchanged.
There was a problem hiding this comment.
🔇 Additional comments: 10
src/main/runtime/orca-runtime-tests/mobile-session-tabs-part-03.spec.ts: 1
315-336: LGTM!src/main/runtime/orca-runtime-terminal-split-authority.test.ts: 1
20-27: LGTM!src/main/runtime/orca-runtime-tests/mobile-session-tabs-headless-chat-rebuild.spec.ts: 1
125-126: LGTM!Also applies to: 228-245
src/main/runtime/session-tabs/main-layout-session-tab-move.ts: 1
26-36: LGTM!src/main/runtime/terminal-intentional-stop-exit.test.ts: 1
260-274: LGTM!src/main/runtime/terminal/lifecycle/bind-first-registration.test.ts: 1
1-128: LGTM!src/main/runtime/bind-first-pane.test-fixture.ts: 1
1-335: LGTM!src/main/runtime/graph-sync-live-daemon-pty-tab-preservation.test.ts: 1
135-162: LGTM!src/main/runtime/orca-runtime-codex-idle-title-chat-address.test.ts: 1
57-68: LGTM!Also applies to: 81-82
src/main/runtime/terminal/lifecycle/bind-first-registration-census.test.ts: 1
74-75: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win
⚠️ Unverified finding
Verification ran but could not confirm this finding. It is shown for review, not as a verified issue.Skip the TypeScript parse for files that cannot contain a registration call.
registrationsrunsts.createSourceFileon every production.tsfile undersrc/main. Theunlistedfilter at Line 118 calls it for each file that is not inCREATE_PATHS. This parses the wholesrc/maintree in one test. The test uses the default Vitest timeout, so it can time out on slow CI machines.Add a cheap text pre-check before parsing. The AST walk then runs only for the few files that mention a registration call.
♻️ Proposed pre-check
const text = readFileSync(path.join(ROOT, file), 'utf8') + if (!text.includes('registerPty') && !text.includes('registerPersistedPtySpawn')) { + return [] + } const source = ts.createSourceFile(file, text, ts.ScriptTarget.Latest, true)
ℹ️ Review info
⚙️ Run configuration
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
b84d91b3-50aa-4a14-9889-b8941b7453c1
📒 Files selected for processing: 10
src/main/runtime/bind-first-pane.test-fixture.tssrc/main/runtime/graph-sync-live-daemon-pty-tab-preservation.test.tssrc/main/runtime/orca-runtime-codex-idle-title-chat-address.test.tssrc/main/runtime/orca-runtime-terminal-split-authority.test.tssrc/main/runtime/orca-runtime-tests/mobile-session-tabs-headless-chat-rebuild.spec.tssrc/main/runtime/orca-runtime-tests/mobile-session-tabs-part-03.spec.tssrc/main/runtime/session-tabs/main-layout-session-tab-move.tssrc/main/runtime/terminal-intentional-stop-exit.test.tssrc/main/runtime/terminal/lifecycle/bind-first-registration-census.test.tssrc/main/runtime/terminal/lifecycle/bind-first-registration.test.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.
The PTY controller fake now takes the controller's optional pane fields, and the switch-on store is a typed RuntimeStore, so neither needs an assertion.
ELI5
Each terminal record used to keep its own copy of which tab and pane it sits in. In the layout-owner build, main's layout already knows that, so the two copies could disagree. This PR sends every "which pane holds this terminal?" question through one function. Shipped builds get the record's copy back, exactly as before. Layout-owner builds ask main's layout and never touch the copy.
What Changed
All behaviour changes are behind the layout-owner build switch. Shipped builds are unchanged; see the bundle diff below.
paneOfPty(src/main/runtime/terminal/surface/pty-pane-query.ts) is the only reader of a PTY record'stabId,paneKeyand graph stamp.paneOfcallback.terminalHoldsPane).runDroppedLeafStep,src/shared/workspace-layout/workspace-layout-dropped-leaves.ts). It records each dropped pane's terminal in a new optional session field,closedTerminalPanesByPaneKey, which has the same TTL and cap as closed-tab records.homeHostId, the same check owner partitions use).pty-exit-hibernate.tsreads only the code). Layout groundwork (switched off): main creates, starts and closes terminal tabs and panes itself #31130 closed it on a negative code a stop or the host vouched for, so an SSH pane whose host confirmed its shell ended lost its leaf instead of letting recovery start a shell in it.issuedForPaneKey, on the handle record only, never on the wire). Recovery with that handle learns the replacement terminal only when its own terminal ended, the replacement is connected and bound at that pane now, and the workspace matches; otherwise it is refused as before. The client fallback is unchanged (remote-runtime-pty-transport.ts:1616-1620).applyPtyBinding). A new process under a reused id also starts with no exit code, so an exit wait on it cannot settle on the earlier process's code.stageTerminalSurfaceRetirements), re-checked by terminal id and incarnation. An exit that keeps the surface (relay contact lost, intentional stop) keeps the entry until a confirmed exit or its TTL.terminal resolve-paneon a pane whose failed start withdrew its tab now returns the existingterminal_not_founderror, where it used to return a disconnected stub. The callers already handle it:{pane:null}.absent(:1418), the existing "no such pane" route ([Bug]: remote-runtime-pty-transport attach() latches in connecting state forever on terminal_not_found #21344) that older clients have too. Its readers: :1573 exhausts; :3068 shows "Remote terminal was closed." and retires with the host-loss sentinel; :3215 creates a fresh terminal instead of adopting a dead handle, as base did.Mobile has no caller; its two matches are
resolvePanelAction.orca terminal wait --for exiton a terminal that disconnected without an exit event keeps waiting while main's layout still binds it; base returned at once.Stopping a workspace's terminals also stops a disconnected terminal main still binds.
A split pane whose terminal ended with a negative code keeps its leaf (its "Terminal exited" card), including on SSH when the host confirmed the end, as the window already does.
A recovery with the handle of a pane whose terminal was replaced returns the connected replacement instead of
terminal_not_found.A terminal the host no longer lists reads disconnected, not exited, in
terminal listandworktree ps.The runtime: surviving-terminal rescue (renderer-session-terminal-rescue.ts:13) is unreachable in production for a paired server's workspace:
So the switch-on test asserts that nothing is rescued.
Why
Linked Issue
Part of the terminal layout final design (A1b: one reader of a terminal's pane). Ledger rows L80 and L250.
Visual Proof
N/A: no change in shipped builds (the switch is off); the switch-on server specs below cover the paired phone and desktop flows.
Testing
Head 3764776. The branch carries main up to B = f8aa685 (merged twice, no rebase; see "Merge of main"). Each gate below also ran on a scratch merge of the head with a later main, against that main: the merge was made, never committed, and its tree is recorded. Platforms: macOS, unit tests and hidden-window e2e. SSH and paired-server paths are covered by the unit suites and the four server specs.
A correction. Earlier versions of this body reported "switch-on" full-suite numbers that were in fact switch-off runs. The runner script set
ORCA_LAYOUT_OWNER=mainonly for the package build, not for vitest. The real switch-on runs below export the variable and logowner=main. The real runs found six tests that pass at base and fail at the head with the switch on; the disguised runs had hidden them. Commit 3764776 converts all six. All six are listed under "The six tests the real runs found".Full suite.
run-vitest(the CI runner) oversrc/main/runtime src/main/persistence, pinned Bun 1.4.3, per test. No file ran zero tests. Pass / fail / skipped:orca-runtime.test.ts×2 (they read this machine's git setup);owner=mainorowner=;runtime-graph-standing-contracts.test.ts"terminal inventory after a pane is dropped keeps a pane main's layout still binds attached …" andorca-runtime.test.ts"returns the exact pre-minted leaf for concurrent renderer-backed splits, each started by main".Targeted switch-on runs against later mains (pinned Bun,
owner=mainlogged):src/main/runtime/terminal,session-tabsandsession-lifecycle,src/main/persistence,src/shared/workspace-layout, and the 106 other test files this branch changes. Base 4751 / 11 / 8, head 4835 / 11 / 14. 0 pass at base and fail at head, 0 new failures.workspace-layout-record-patch.ts), tree 71340dc5740, vs e5df152. It coveredsrc/shared/workspace-layoutandsrc/main/runtime/session-tabs. Base 521 / 1 / 1, head 529 / 1 / 1. 0 pass at base and fail at head. The one failure,workspace-layout-views"pruneViewRecord keeps a record whose ids all exist", fails on both sides.The six tests the real runs found. Each verdict was checked by an Opus reviewer asked "is this conversion hiding a bug?". The answer was no for every one, so none became
it.fails.terminal-intentional-stop-exit.test.ts"never reads the exit of a later process on the same id as the stop": before, the later process registered (registerPty) and then its pane binding was saved; now the binding is saved first and the process registers after it. The assertions are unchanged: the later process's exit retires the pane and reaches the renderer as code 0 for the later incarnation. This is correct because production saves the spawn's pane binding before it registers the terminal (src/main/ipc/pty/spawn-commit-assembly.ts:155before:160), and with the switch on a registration ahead of its binding is the bind-first violationpane_unbound_at_registration(src/main/runtime/terminal/lifecycle/bind-first-registration.ts:15). No it.fails.orca-runtime-terminal-split-authority.test.ts"rejects a persisted-only source incarnation change during spawn" and "preserves the split error and takes back the pane when kill and retirement throw": before, both modes seeded the source pane's saved incarnation aspersisted-beforewhile the live source terminal carried none; now, with the switch on only, the source terminal registers aspersisted-before, so the pane and its terminal agree. The assertions are unchanged: a saved-only change topersisted-afterduring the spawn rejects the split asterminal_split_source_not_found, stops or kills the new terminal, retires it, and takes the pane back. This is correct because main stamps a pane with its spawning terminal's incarnation (src/main/persistence/loading-store/pty-binding-session-update.ts:52), and main's lookup holds a pane only for the terminal whose incarnation matches that stamp (src/main/runtime/terminal/surface/terminal-surface-index.ts:354). The old switch-on precondition, a pane stamped for a different process, cannot arise. Main correctly answered "stale handle" before the spawn even began, so the test never reached the change it exists to check. Switch-off is unchanged. No it.fails.graph-sync-live-daemon-pty-tab-preservation.test.ts"a real paired close de-persists the CLI terminal and stops preserving it": before, the fakestopAndWaitreturned true and delivered no exit; now it callsruntime.onPtyExit(ptyId, 0)and then returns true. The assertions are unchanged: the tab is de-persisted,runtimeSessionOwnedgoes false, and the tab is not preserved after the next sync. This is correct because the realstopAndWaitreturns true after the exit has been delivered or waited for: a synthetic exit atsrc/main/ipc/pty/runtime/kill.ts:319, or a wait for the observed exit record at:324(bounded by the close deadline, so on SSH it can return before the exit arrives; the exit then clears ownership on arrival), beforereturn trueat:326. That exit is what clears ownership (src/main/runtime/terminal/lifecycle/pty-exit-lifecycle.ts:250). At B the switch-on run never bound the CLI pane, so main's close (src/main/runtime/session-lifecycle/close/close-mobile-row-in-main-layout.ts:26) never ran and the window-era headless close cleared the flag instead. Switch-off does not callstopAndWaiton this path. No it.fails.orca-runtime-codex-idle-title-chat-address.test.ts(5 tests; 2 failed with the switch on): before, the runtime had no store (null) and a fake spawn that bound no pane; now, with the switch on only, it gets a minimal store, and the spawn binds the pane through the spawn-commit stand-in. The assertions are unchanged: Codex's idle title outranks the older hook state, and a shell title retires the pane. This is correct because, with the switch on, a terminal's pane comes only from main's layout (src/main/runtime/terminal/surface/pty-pane-query.ts:38-41), and production always builds the runtime with a store (src/main/startup/main-process-runtime-service.ts:88,src/main/orcad/orcad-entry.ts:223). With no store, main owns no pane, so the title facts had no pane to reach. Switch-off is unchanged. No it.fails.runtimeSessionOwnedset until the exit, where the window-era close clears it at once.Expected failures with the switch on.
it.each.it.fails, each with its row: L255, L259a and L259b.Census:
pnpm test src/main/runtime/terminal/surface/pty-pane-copy-census.test.ts;pnpm test src/main/runtime/terminal/lifecycle/bind-first-registration-census.test.ts. It now follows the single spawn-commit stepsrc/main/ipc/pty/spawn-commit-assembly.tsthat refactor(pty): one commit step for both terminal start lanes #31596 introduced;pnpm test src/main/persistence/closed-terminal-panes-registration.test.ts.Server specs, on the merge with 24f5c57 (tree c5fcc66a067d) vs 24f5c57. These ran in hidden windows on the switch-on build, with one worker:
Static gate:
pnpm tcpasses;check:code-quality:changedreports 0 new findings;Why the pinned Bun: an older local Bun (1.3.14) cannot load
node:sqlite, so 55–65 files ran no tests under it. Every comparison here has no file that ran zero tests.Merge of main
origin/main B = 4dd97f0 merged once (a0c75cb, no rebase); the branch's base was 3b02945. Conflicts, each checked against both parents:
src/shared/workspace-layout/workspace-layout-command-types.ts: both sides' new optional fields kept (this branch'sdroppedLeafReason; main'sisBindingLive,retiresBinding).src/main/runtime/terminal/surface/terminal-surface-index.ts: imports; main movedbindingOftopane-live-facts, this branch's other imports kept.bind-first-registration.test.tsnow importsbindingOffrom there too.src/main/runtime/session-lifecycle/projection/apply-mobile-session-tab-navigation.ts: imports; main'sfindPaneSleepingRecordand top-level switch import kept, this branch's duplicate import dropped, the unusedworktreeIdsEqualdropped as main did.src/main/runtime/terminal/launch/mobile-terminal-chat-fork.test.ts: both sides' imports.src/main/runtime/orca-runtime-mobile-markdown-tab-routes.test.ts: main's version. This branch had copied A phone keeps a desktop's untitled markdown tab read-only (dark, layout-owner build only) #31667's fixture and marked its three untitled cases expected-to-fail until A phone keeps a desktop's untitled markdown tab read-only (dark, layout-owner build only) #31667 arrived; main has it, so they are plain tests and pass.After the merge two files went over the line limit; b9bc689 moves this branch's additions into helpers (
paneHoldsSessioninmain-terminal-surfaces.ts, and one parent-class method for a closed tab's live terminals), behaviour unchanged. An Opus review of the resolution found nothing: no lost side, and none of main's new code reads a terminal record's pane fields directly, registers before binding, or relies on a pane existing as proof its terminal runs.Second merge: B = f8aa685 (#31924), merged as ef7b85c (no rebase).
main-layout-session-tab-move.ts: both sides' methods are kept.mobile-session-tabs-headless-chat-rebuild.spec.ts: main's version is taken, so main's L283 test is a plain test.it.failsmarks are dropped, because its cases pass.src/main/ipc/pty/spawn-commit-assembly.ts, so the bind-first census follows that step, withsavePtySpawnPaneBinding(andadopted.owneras its binds;leaveSpawnsUncommitted).AI Disclosure
Review
applyPtyBinding), and the recovery handle lookup that had moved ahead of the cheap guards and so ran with the switch off on a refused recovery.Agent skill upstream boundary
Notes
Ensure no issues in: Security, Cross-platoform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance
closedTerminalPanesByPaneKeyis optional; older builds drop it.runtime:<env>) workspaces are that server's layout and are not indexed.Switch-off bundle diff. Built with the switch off from the merge with 24f5c57 (tree c5fcc66a067d) and from 24f5c57 itself. Chunk hashes and short minified names are normalized. Counts are the same as against the older main, except Rename-only, which is 106 here (105 before) because one more minified name shifted. The renderer differs only by the build's commit stamp and the
closedTerminalPanesByPaneKeyentry in two field-ownership tables, which act only when that field is present; switch-off never writes it. Every one of the 263 hunks ofmain/index.jshas a class:paneOfPty/paneOftabId,paneKeyand stamp (pty-pane-query.ts); records always hold a string or null there, so the??never fires.null), stop targets (an empty loop), the own-handle rule, the handle stamp and the exit-code clear all fold to base behaviour;setPtyConnected's extra call is a pure read.applyPtyBindinghasLiveTerminalForPaneKey,liveTerminalsOfClosedTab,paneHoldsSession: same logic.?? 0matches the existing constant.paneOfPty's homehandleNamesRecoveredPanefolds togetPaneKeyForTerminalHandle(handle) === paneKeyafter the same guards.Chunks:
orcad-migration-source-retention, 22 hunks (20 renames; 2 closed-pane field code that acts only when the field is present);ssh-renderer-broadcast, 5 hunks (the closed-pane schema and helpers, the optional session field, a field-ownership entry, 2 unused export getters).Hunks that run with the switch off and do more than pass a value through, each identical: a dead
endVouchedread is gone (pty-exit-lifecycle.ts); the holder check re-reads the PTY list per pane (perform-mobile-session-pty-records-refresh.ts), with no side effects;workspace-removal-target.tsreads a tab id once instead of twice, and the call between only rewrites session rows; the layout command context callsDate.now(); the retirement'sclosedPaneis always undefined. One theoretical difference: a saved session that already holdsclosedTerminalPanesByPaneKey(only switch-on builds write it) keeps the field where base drops it on load.Every non-rename hunk was checked by hand against the source delta; renames by pattern, with the export shift verified.
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)