Repository navigation
Layout groundwork (switched off): main tells the window whether its start resumed a pane's agent, so the restored banner and reopen count come back - #31908
Conversation
…yout-owner build) A status-only frame changes one store entry and no pane tree, so the pane's view stays mounted.
…t is written (layout-owner build)
…start shows why (layout-owner build) Fixes owner-visible row 15: a failed agent or setup start no longer opens a plain shell.
…ontact (layout-owner build)
…s host, never the window's copy (layout-owner build only)
…'s current terminal (layout-owner build only)
These 8 have failed switch-on since #31130 moved the exit close to main.
…s, through its one restored-pane starter (layout-owner build only) The model's start and stop effects reach the runtime once the command is written, never the reply. startPane starts a pane whose binding has a start status, and a slept pane from its record. A wake keeps a pane's resume record until its start binds; a failed start keeps it and shows why. With the switch on, main owns a running agent's wake even with a window open.
…ly, so main does not start it again (layout-owner build only)
…erminal's host, never the window's copy (layout-owner build only)" This reverts commit a646d89.
…form, so a host crash resumes the agent again (layout-owner build only)
…; the window attaches (layout-owner build) The window's split, a startup split with its command, and a CLI split all go through main's terminal.split; main's frame mounts the pane, with or without a window intent. Deletes the window's split wait and withdraw, the split appear intents, and the queued-split skip and cancel. The e2e helper uses the real split. A startup split leaves focus on its source pane.
…d panes to their restore path
…; a taken pane id is refused Also restores the proof that a split closed while it starts gets one answer and leaves no pane or start status behind.
…terminal's host, never the window's copy (layout-owner build only)" This reverts commit 420e605.
…rite joins that start, not a second one (layout-owner build only)
… failed, with why
…y await, and a failed start with its reason; startPane starts a pane whose bound terminal ended (layout-owner build only)
…esume record for the live mark Claude-Session: W5b
… agent, for the window's banner (switch-on builds only) Claude-Session: W5b
…esume unavailable" banner again (switch-on builds only) Claude-Session: W5b
Claude-Session: W5b
…s the pane's own sleeping record, and each new start clears the old one (switch-on builds only) Claude-Session: W5b
…c-restore-view-attach Main's layout-command-commit.ts is the one commit module now: it gains C1c's run hooks (live facts, stop-before-write, noted effects), and topology-partition-write.ts is gone. The restored-pane starter keeps its started-terminal cache over main's StartedPty result, and materialize returns main's create result after marking a resumed record live. Claude-Session: W5b
…ane main started, and the window stops waiting once that pane holds another terminal (switch-on builds only) Claude-Session: W5b
…r-fallback notice and a hidden pane's wait for its first view are helpers, and the answering-transport lookup moves to its one test caller Claude-Session: W5b
… terminal it names, a same-id respawn included (switch-on builds only) Claude-Session: W5b
…n resumed again (switch-on builds only) Claude-Session: W5b
…me type Claude-Session: W5b
…one rebinds nothing, it shows once per start, and no saved session holds it Claude-Session: W5b
…tore-view-attach apply-mobile-session-tab-navigation.ts takes main's renamed selection-projection import; C1c's numbered-record lookup keeps replacing the stable-key read, so main's makePaneKey import is unused and dropped. Claude-Session: W5b
…budget after the main merge Claude-Session: W5b
Claude-Session: W5b
…blishes its outcome, and the sidebar resume keeps its restored banner (switch-on builds) Claude-Session: W5b
Claude-Session: W5b
… source, keeping the runtime in its line budget Claude-Session: W5b
…minal id shows its banner again, and a start whose bind fails leaves no outcome (switch-on builds only) Claude-Session: W5b
…e attached terminal since the attach began, and the banner reads main's outcome once at attach (switch-on builds only) Claude-Session: W5b
…ich every attach now reads Claude-Session: W5b
…esume outcomes Claude-Session: W5b
…eps its banner, and a start that lost its pane leaves the winner's outcome (switch-on builds only) Claude-Session: W5b
📝 Walkthrough
Priority: ➖ Normal Merge Risk: 🔵 Low · up to
|
There was a problem hiding this comment.
Actionable comments posted: 3
ℹ️ 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:
99763eb8-2610-4a5e-a923-765443c13de9
📒 Files selected for processing: 44
src/main/ipc/pty/runtime/spawn-commit-response.test.tssrc/main/ipc/pty/runtime/spawn-commit-response.tssrc/main/ipc/pty/runtime/spawn-commit.tssrc/main/ipc/pty/runtime/spawn-preflight.tssrc/main/ipc/pty/runtime/spawn-state.tssrc/main/runtime/orca-runtime-layout-owner-start-fixture.tssrc/main/runtime/orca-runtime-resume-outcome-layout-owner.test.tssrc/main/runtime/orca-runtime.tssrc/main/runtime/pane-live-facts.test.tssrc/main/runtime/pane-live-facts.tssrc/main/runtime/pane-resume-outcome-layout-owner.test.tssrc/main/runtime/pane-start-statuses.test.tssrc/main/runtime/pane-start-statuses.tssrc/main/runtime/runtime-pane-admission.tssrc/main/runtime/runtime-pty-controller-contract.tssrc/main/runtime/runtime-terminal-contracts.tssrc/main/runtime/session-lifecycle/projection/restored-pane-materialize.tssrc/main/runtime/terminal/launch/failed-start-pane.tssrc/main/runtime/terminal/launch/mobile-terminal-owned-create.tssrc/main/runtime/terminal/surface/terminal-surface-index.tssrc/main/runtime/workspace-layout-stream.tssrc/renderer/src/components/terminal-pane/fish-color-scheme-child-stdin.node-pty.test.tssrc/renderer/src/components/terminal-pane/pty-connection-sleeping-resume-banner.spec.tssrc/renderer/src/components/terminal-pane/pty-connection-test-main-pane-start-fixtures.tssrc/renderer/src/components/terminal-pane/pty-connection-test-store-fixtures.tssrc/renderer/src/components/terminal-pane/pty-connection-test-store-state.tssrc/renderer/src/components/terminal-pane/pty-connection/deferred-session-reattach-connect.tssrc/renderer/src/components/terminal-pane/pty-connection/deferred-session-reattach-newer-daemon-hold.test.tssrc/renderer/src/components/terminal-pane/pty-connection/main-pane-resume-banner.test.tssrc/renderer/src/components/terminal-pane/pty-connection/main-pane-resume-banner.tssrc/renderer/src/components/terminal-pane/pty-connection/reattach-result-handler-park-reveal-verdict.test.tssrc/renderer/src/components/terminal-pane/pty-connection/reattach-result-handler.tssrc/renderer/src/components/terminal-pane/remote-hidden-output-restore-outcomes.test.tssrc/renderer/src/components/terminal-pane/remote-hidden-output-restore-unavailable-banner.repro.test.tssrc/renderer/src/lib/sleeping-agent-session-launch-layout-owner.test.tssrc/renderer/src/lib/workspace-session-resume-outcome.test.tssrc/renderer/src/runtime/workspace-layout-frame-binding.test.tssrc/renderer/src/runtime/workspace-layout-frame-pane-resume-outcomes.test.tssrc/renderer/src/runtime/workspace-layout-frame-pane-starts.tssrc/renderer/src/runtime/workspace-layout-frame-sync.tssrc/renderer/src/store/slices/terminals.tssrc/renderer/src/store/terminals/terminal-state.tssrc/shared/workspace-layout/workspace-layout-published.tssrc/shared/workspace-layout/workspace-layout-records.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.
| return 'resume-unavailable' | ||
| } | ||
| // A resume dropped silently named another agent's session: nothing came back, and nothing is owed. | ||
| return ctx.codexResumeArgvDropped ? null : 'restored' |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
#!/bin/bash
# Inspect launch planning and sleeping-record callers; do not execute repository code.
rg -n -C 6 -g '*.ts' \
'\bresolvePaneOwnedResumeStartup\s*\(|\bresolvePtySpawnHostEnv\s*\(|\bresumeProviderSession\b' \
src/main/runtime/session-lifecycle/projection/restored-pane-materialize.ts \
src/main/runtime/runtime-pane-admission.ts \
src/main/ipc/pty/runtimeRepository: stablyai/orca
Length of output: 12350
🏁 Script executed:
set -o pipefail
printf '%s\n' '--- declarations and references ---'
rg -n -F --glob '*.ts' \
-e 'resolvePaneOwnedResumeStartup' \
-e 'function resolvePtySpawnHostEnv' \
-e 'const resolvePtySpawnHostEnv' \
-e 'resolvePtySpawnHostEnv =' \
-e 'codexResumeArgvDropped' \
src/main/runtime src/main/ipc/pty src/main | head -240
printf '%s\n' '--- restored materialization ---'
sed -n '120,225p' src/main/runtime/session-lifecycle/projection/restored-pane-materialize.ts
printf '%s\n' '--- host environment resolver ---'
rg -l -F --glob '*.ts' 'resolvePtySpawnHostEnv' src/main | while read -r f; do
echo "FILE $f"
rg -n -C 8 -F -- 'resolvePtySpawnHostEnv' "$f"
done
printf '%s\n' '--- spawn preflight and commit relevant blocks ---'
sed -n '1,175p' src/main/ipc/pty/runtime/spawn-preflight.ts
sed -n '1,310p' src/main/ipc/pty/runtime/spawn-commit.tsRepository: stablyai/orca
Length of output: 31916
🏁 Script executed:
set -o pipefail
printf '%s\n' '--- exact resolver definitions ---'
rg -n -F --glob '*.ts' \
-e 'resolvePaneOwnedResumeStartup' \
-e 'resolvePtySpawnHostEnv' \
-e 'codexResumeArgvDropped' \
src/main/runtime src/main/ipc/pty | head -320
printf '%s\n' '--- materialization logical block ---'
sed -n '145,220p' src/main/runtime/session-lifecycle/projection/restored-pane-materialize.ts
printf '%s\n' '--- all resolver owners ---'
for f in $(rg -l -F --glob '*.ts' 'resolvePaneOwnedResumeStartup' src/main); do
echo "FILE $f"
sed -n '1,260p' "$f" | rg -n -C 18 -F -- 'resolvePaneOwnedResumeStartup'
done
printf '%s\n' '--- host-env call and definition candidates ---'
for f in $(rg -l -F --glob '*.ts' 'resolvePtySpawnHostEnv' src/main); do
echo "FILE $f"
rg -n -C 25 -F -- 'resolvePtySpawnHostEnv' "$f"
doneRepository: stablyai/orca
Length of output: 21397
🏁 Script executed:
set -o pipefail
printf '%s\n' '--- pane-owned resume resolver ---'
sed -n '145,255p' src/main/runtime/session-lifecycle/projection/apply-mobile-session-tab-navigation.ts
printf '%s\n' '--- host environment resolver complete ---'
sed -n '1,230p' src/main/ipc/pty/spawn-host-env.ts
printf '%s\n' '--- resume launch contracts and implementations ---'
rg -n -F --glob '*.ts' \
-e 'resolveCodexResumeLaunch' \
-e 'prepareCodexResumeHome' \
-e 'noCodexResumeLaunch' \
-e 'stripSequencedStartupResumeArgv' \
src/main | head -240Repository: stablyai/orca
Length of output: 20181
🏁 Script executed:
set -o pipefail
printf '%s\n' '--- Codex resume launch implementation ---'
sed -n '1,155p' src/main/ipc/pty/host-env/codex-resume.ts
printf '%s\n' '--- mobile resume command declarations and producer ---'
rg -n -F --glob '*.ts' \
-e 'resolveMobileSessionResumeCommand' \
-e 'MobileTerminalResumeCommand' \
-e 'AgentProviderSessionMetadata' \
src/main src/shared | head -260
printf '%s\n' '--- producer definitions ---'
for f in $(rg -l -F --glob '*.ts' 'resolveMobileSessionResumeCommand' src/main); do
echo "FILE $f"
rg -n -C 35 -F -- 'resolveMobileSessionResumeCommand' "$f"
doneRepository: stablyai/orca
Length of output: 26452
🏁 Script executed:
set -o pipefail
printf '%s\n' '--- production resume metadata assignments and spawn entrypoints ---'
rg -n -C 8 -F --glob '*.ts' \
-e 'resumeProviderSession:' \
-e 'resumeProviderSession?' \
-e 'createRuntimeOwnedMobileSessionTerminal' \
-e 'RuntimePtySpawnArgs' \
src/main src/shared | head -420
printf '%s\n' '--- mobile terminal create and owned-create contracts ---'
sed -n '1,190p' src/main/runtime/terminal/launch/mobile-terminal-create.ts
sed -n '1,150p' src/main/runtime/terminal/launch/mobile-terminal-owned-create.ts
sed -n '1,115p' src/main/ipc/pty/ipc/spawn-types.tsRepository: stablyai/orca
Length of output: 41741
🏁 Script executed:
set -o pipefail
printf '%s\n' '--- launch command through spawn execution ---'
rg -n -C 10 -F --glob '*.ts' \
-e 'ctx.launchCommand' \
-e 'launchCommand' \
-e 'command: args.command' \
-e 'command: ctx' \
-e 'provider.spawn' \
src/main/ipc/pty | head -320
printf '%s\n' '--- PTY provider command contract and default handling ---'
rg -n -C 12 -F --glob '*.ts' \
-e 'command?: string' \
-e 'command: string | undefined' \
-e 'command ??' \
-e 'spawn(args' \
-e 'spawn(options' \
src/main/providers src/main/ipc/pty src/main | head -360
printf '%s\n' '--- relevant no-command IPC test body ---'
sed -n '220,280p' src/main/ipc/pty-spawn-codex-home-unavailable.test.tsRepository: stablyai/orca
Length of output: 41763
Do not report restored without an actual resume launch.
The pty:spawn contract allows resumeProviderSession without command. resolveCodexResumeLaunch preserves command: undefined, and assemblePtySpawnLaunchOptions omits spawnOptions.command. The PTY then starts without a resume command, but resumeOutcomeOf still returns restored because the metadata exists and codexResumeArgvDropped is false.
The sleeping-record path supplies a required command, but the broader PTY spawn path does not. Require an actual resume launch before reporting restored.
| startStatus?.resumeOutcomes?.clear(paneKey) | ||
| const resumeOutcomes = startStatus?.resumesSleepingRecord ? startStatus.resumeOutcomes : undefined | ||
| // A pane never bound in this process is at 0: every bind here is numbered from 1. | ||
| const generationNow = (): number | undefined => | ||
| store?.getPtyBindingGeneration | ||
| ? (store.getPtyBindingGeneration( | ||
| normalizeExecutionHostId(hostIdOf(args)) ?? LOCAL_EXECUTION_HOST_ID, | ||
| args.leafId | ||
| ) ?? 0) | ||
| : undefined | ||
| const afterGeneration = resumeOutcomes ? generationNow() : undefined | ||
| let reported: { ptyId: string; outcome: PaneResumeOutcome } | undefined | ||
| if (resumeOutcomes) { | ||
| // Why the generation now: a respawn may keep the terminal id, so only a later bind is this one. | ||
| spawnArgs.onResumeOutcome = (ptyId, outcome) => { | ||
| reported = { ptyId, outcome } | ||
| resumeOutcomes.set(paneKey, outcome, { ptyId, afterGeneration }) | ||
| } | ||
| } |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
sed -n '135,255p' src/main/runtime/runtime-pane-admission.ts
rg -n 'PaneOwnerContentionError|spawnInAdmittedPane|getPtyBindingGeneration' src/main/runtimeRepository: stablyai/orca
Length of output: 9978
🏁 Script executed:
set -e
printf '%s\n' '--- runtime-pane-admission imports and admission definitions ---'
sed -n '1,170p' src/main/runtime/runtime-pane-admission.ts
printf '%s\n' '--- resume outcome definitions/usages ---'
rg -n -F --glob '*.ts' -e 'class PaneResumeOutcomes' -e 'type PaneResumeOutcome' -e 'interface PaneResumeOutcomes' -e 'resumeOutcomes' -e 'resumesSleepingRecord' src
printf '%s\n' '--- relevant tests ---'
sed -n '1,250p' src/main/runtime/pane-start-statuses.test.ts
sed -n '1,240p' src/main/runtime/pane-live-facts.test.ts
printf '%s\n' '--- direct callers ---'
sed -n '80,145p' src/main/runtime/terminal/launch/terminal-create.ts
sed -n '40,125p' src/main/runtime/terminal/launch/terminal-split-surface.ts
sed -n '80,125p' src/main/runtime/terminal/launch/terminal-split-in-main.ts
printf '%s\n' '--- changed diff ---'
git diff --no-ext-diff --unified=80 ed13ca1e6f6085b23d6892627ea969f7119c5b82 165dc2acf50bdf8de8ccddf82688baf17913929b -- src/main/runtime/runtime-pane-admission.ts src/main/runtime/pane-start-statuses.test.ts src/main/runtime/pane-live-facts.test.tsRepository: stablyai/orca
Length of output: 41847
🏁 Script executed:
set -e
printf '%s\n' '--- admission implementations and callers ---'
rg -n -F --glob '*.ts' -e 'admitTerminalPane' -e 'getPtyBindingGeneration' src/main src/shared
printf '%s\n' '--- outcome/fact implementation ---'
sed -n '1,220p' src/main/runtime/pane-start-statuses.ts
sed -n '1,240p' src/main/runtime/pane-live-facts.ts
printf '%s\n' '--- renderer outcome consumption ---'
sed -n '1,190p' src/renderer/src/runtime/workspace-layout-frame-pane-starts.ts
rg -n -F --glob '*.ts' -e 'resumeOutcome' -e 'resumeOutcomes' src/renderer src/main | head -160
printf '%s\n' '--- complete caller blocks ---'
sed -n '90,145p' src/main/runtime/terminal/launch/terminal-create.ts
sed -n '95,140p' src/main/runtime/terminal/launch/terminal-split-in-main.ts
sed -n '90,145p' src/main/runtime/terminal/launch/failed-start-pane.ts
printf '%s\n' '--- generation implementation context ---'
rg -n -F --glob '*.ts' -e 'ptyBindingGeneration' -e 'bindingGeneration' src/main | head -160Repository: stablyai/orca
Length of output: 28685
🏁 Script executed:
set -e
printf '%s\n' '--- concrete admission and scheduling ---'
sed -n '220,330p' src/main/persistence/loading-store/pty-binding-persistence.ts
sed -n '1,125p' src/main/persistence/loading-store/write-scheduling.ts
sed -n '1,130p' src/main/persistence/terminal-topology/layout-command-binding-generations.ts
rg -n -F --glob '*.ts' -e 'withRuntimePaneAdmission' -e 'PaneOwnerContentionError' -e 'terminal_pane_owner_changed' src/main
printf '%s\n' '--- pane owner claim/arbitration ---'
rg -n -F --glob '*.ts' -e 'claimPane' -e 'ownerChanged' -e 'owner changed' -e 'pane owner' src/main/ipc src/main/persistence | head -200
sed -n '1,260p' src/main/ipc/pty/pane/pane-spawn-operation.ts
printf '%s\n' '--- restored-pane launch path ---'
sed -n '170,235p' src/main/runtime/session-lifecycle/projection/restored-pane-materialize.ts
sed -n '90,145p' src/main/runtime/terminal/launch/failed-start-pane.ts
rg -n -F --glob '*.ts' -e 'ensureRestoredPaneStarted' -e 'resumesSleepingRecord' src/main/runtime src/main | head -120
printf '%s\n' '--- concurrency and contention tests ---'
sed -n '110,180p' src/main/ipc/pty-pane-claim-arbitration.test.ts
sed -n '450,525p' src/main/ipc/pty-pane-claim-arbitration.test.tsRepository: stablyai/orca
Length of output: 40030
🏁 Script executed:
set -e
printf '%s\n' '--- admitPane implementation and durable mutation runner ---'
rg -n -F --glob '*.ts' -e 'function admitPane' -e 'const admitPane' -e 'runDurableMutation' src/main/persistence
sed -n '1,240p' src/main/persistence/terminal-topology/terminal-pane-admission.ts
rg -n -F --glob '*.ts' -e 'async runDurableMutation' -e 'runDurableMutation<' -e 'runDurableMutation(' src/main/persistence/loading-store src/main/persistence/terminal-topology | head -120
printf '%s\n' '--- pane spawn contention checks ---'
sed -n '1,125p' src/main/ipc/pty/runtime/spawn-execute.ts
sed -n '130,215p' src/main/ipc/pty/runtime/spawn-commit.ts
sed -n '285,330p' src/main/ipc/pty/runtime/spawn-commit.ts
sed -n '1,125p' src/main/ipc/pty/ipc/spawn-commit-persist.ts
printf '%s\n' '--- pane start invocation and overlap guards ---'
sed -n '1,135p' src/main/runtime/session-lifecycle/projection/restored-pane-materialize.ts
sed -n '170,220p' src/main/runtime/session-lifecycle/projection/perform-mobile-session-pty-records-refresh.ts
rg -n -F --glob '*.ts' -e 'ensureRestoredPaneStarted' -e 'startedPane' -e 'starting' src/main/runtime/session-lifecycle src/main/runtime/terminal | head -160Repository: stablyai/orca
Length of output: 42121
🏁 Script executed:
set -e
printf '%s\n' '--- restored starter implementation ---'
sed -n '1,180p' src/main/runtime/terminal/recovery/restored-pane-start.ts
printf '%s\n' '--- durable mutation implementation ---'
sed -n '1,115p' src/main/persistence/loading-store/primary-state-writes.ts
sed -n '1,150p' src/main/persistence/loading-store/store.ts
printf '%s\n' '--- mobile terminal spawn option propagation ---'
sed -n '1,190p' src/main/runtime/terminal/launch/mobile-terminal-owned-create.ts
sed -n '1,180p' src/main/runtime/terminal/launch/failed-start-pane.ts
printf '%s\n' '--- all spawnInAdmittedPane call contexts ---'
rg -n -F --glob '*.ts' 'spawnInAdmittedPane(' src/main/runtimeRepository: stablyai/orca
Length of output: 33918
🏁 Script executed:
set -e
printf '%s\n' '--- exact second-start caller ---'
nl -ba src/main/runtime/terminal/launch/failed-start-pane.ts | sed -n '132,175p'
nl -ba src/main/runtime/terminal/launch/failed-start-pane.ts | sed -n '180,215p'
printf '%s\n' '--- exact contention path ---'
nl -ba src/main/ipc/pty/runtime/spawn-commit.ts | sed -n '292,323p'
nl -ba src/main/ipc/pty/runtime/spawn-execute.ts | sed -n '45,70p'
printf '%s\n' '--- exact clear, generation, and outcome publication ---'
nl -ba src/main/runtime/runtime-pane-admission.ts | sed -n '165,192p'
nl -ba src/main/runtime/runtime-pane-admission.ts | sed -n '214,250p'
nl -ba src/main/persistence/loading-store/primary-state-writes.ts | sed -n '48,72p'Repository: stablyai/orca
Length of output: 10770
🏁 Script executed:
set -e
printf '%s\n' '--- callers of the existing-pane window start ---'
rg -n -F --glob '*.ts' 'startWindowTabTerminal(' src
printf '%s\n' '--- outcome state consumers ---'
rg -n -F --glob '*.{ts,tsx}' -e 'terminalPaneResumeOutcomesByPaneKey' -e 'resumeOutcome' src/renderer/src | head -240Repository: stablyai/orca
Length of output: 6686
Preserve the incumbent resume outcome when an existing-pane start loses ownership.
startWindowTabTerminal can start a pane that main already owns. The current code clears that pane's outcome before the asynchronous admission. If the incumbent binding wins before the new spawn persists, persistFreshPaneBinding throws PaneOwnerContentionError. The contention handler skips its later clear, but the incumbent outcome was already deleted. The renderer then removes the resume outcome, so the resume banner is lost.
Move the general clear to successful or non-contention completion. Keep a reported outcome when the spawn produced one.
Suggested fix
let admittedAs: TerminalPaneAdmissionOutcome | undefined
startStatus?.sink.set(paneKey, { status: 'starting' })
- startStatus?.resumeOutcomes?.clear(paneKey)
const resumeOutcomes = startStatus?.resumesSleepingRecord ? startStatus.resumeOutcomes : undefined
@@
// lost the pane to another owner leaves the winner's outcome alone.
if (!(error instanceof PaneOwnerContentionError)) {
- resumeOutcomes?.clear(paneKey)
+ startStatus?.resumeOutcomes?.clear(paneKey)
}
@@
if (elsewhere) {
- resumeOutcomes?.clear(paneKey)
+ startStatus?.resumeOutcomes?.clear(paneKey)
} else if (reported && afterGeneration !== undefined && generationNow() === afterGeneration) {
// A bind that matched the pane's existing one (an SSH relay's same-id reattach) writes and
// publishes nothing new: the outcome holds for the binding the pane already shows.
resumeOutcomes?.set(paneKey, reported.outcome, { ptyId: reported.ptyId })
+ } else if (!reported) {
+ startStatus?.resumeOutcomes?.clear(paneKey)
}| const live = new Set(Object.values(outcomes).map(startOf)) | ||
| try { | ||
| globalThis.sessionStorage.setItem( | ||
| SHOWN_STARTS_KEY, | ||
| JSON.stringify([...shown.filter((key) => live.has(key)), start]) | ||
| ) |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
set -u
printf '%s\n' '--- target file ---'
nl -ba src/renderer/src/components/terminal-pane/pty-connection/main-pane-resume-banner.ts
printf '%s\n' '--- relevant symbols and callers ---'
rg -n -F --glob '*.{ts,tsx}' \
-e 'showFramePaneStarts' \
-e 'terminalPaneResumeOutcomesByPaneKey' \
-e 'source.draws(state)' \
-e 'noteShown' \
-e 'showMainPaneResumeOutcome' \
src/renderer/src || test "$?" -eq 1
printf '%s\n' '--- changed-file diff ---'
git diff --unified=40 ed13ca1e6f6085b23d6892627ea969f7119c5b82..165dc2acf50bdf8de8ccddf82688baf17913929b -- src/renderer/src/components/terminal-pane/pty-connection/main-pane-resume-banner.ts
printf '%s\n' '--- tests mentioning shown starts or reload ---'
rg -n -F --glob '*.{test,spec}.{ts,tsx}' \
-e 'SHOWN_STARTS_KEY' \
-e 'shown starts' \
-e 'sessionStorage' \
-e 'reload' \
-e 'showMainPaneResumeOutcome' \
src/renderer/src || test "$?" -eq 1Repository: stablyai/orca
Length of output: 41305
🏁 Script executed:
set -u
printf '%s\n' '--- frame pane starts producer ---'
nl -ba src/renderer/src/runtime/workspace-layout-frame-pane-starts.ts | sed -n '1,180p'
printf '%s\n' '--- frame sync draw gating and publication ---'
nl -ba src/renderer/src/runtime/workspace-layout-frame-sync.ts | sed -n '100,225p'
printf '%s\n' '--- focused banner tests ---'
nl -ba src/renderer/src/components/terminal-pane/pty-connection/main-pane-resume-banner.test.ts | sed -n '1,220p'
printf '%s\n' '--- relevant state reset and layout draw declarations ---'
rg -n -F --glob '*.{ts,tsx}' \
-e 'terminalPaneResumeOutcomesByPaneKey:' \
-e 'draws(state)' \
-e 'function draws' \
-e 'draws:' \
src/renderer/src/runtime src/renderer/src/store src/renderer/src | head -200Repository: stablyai/orca
Length of output: 25828
🏁 Script executed:
nl -ba src/renderer/src/runtime/workspace-layout-frame-pane-starts.ts | sed -n '95,140p'
nl -ba src/renderer/src/runtime/workspace-layout-frame-sync.ts | sed -n '120,215p'
nl -ba src/renderer/src/components/terminal-pane/pty-connection/main-pane-resume-banner.test.ts | sed -n '50,180p'Repository: stablyai/orca
Length of output: 11964
🏁 Script executed:
nl -ba src/renderer/src/components/terminal-pane/pty-connection/reattach-result-handler.ts | sed -n '305,335p'Repository: stablyai/orca
Length of output: 1294
Do not prune shown starts by the current outcome store.
The frame sync adds a workspace to changed only when drawn(key) is true. An undrawn workspace can therefore be absent from terminalPaneResumeOutcomesByPaneKey. When another pane attaches, noteShown can remove that workspace's previously shown start from session storage. A later reload can then show its banner again.
Keep a bounded history instead of filtering by store membership.
Suggested fix
const SHOWN_STARTS_KEY = 'orca.mainPaneResumeBannersShown'
+const MAX_SHOWN_STARTS = 500
/** This document's shown starts, for when session storage is unavailable. */
const shownHere = new Set<string>()
@@
-function noteShown(start: string, outcomes: Outcomes): boolean {
+function noteShown(start: string): boolean {
const shown = readShownStarts()
if (shownHere.has(start) || shown.includes(start)) {
return false
}
shownHere.add(start)
- const live = new Set(Object.values(outcomes).map(startOf))
try {
globalThis.sessionStorage.setItem(
SHOWN_STARTS_KEY,
- JSON.stringify([...shown.filter((key) => live.has(key)), start])
+ JSON.stringify([...shown, start].slice(-MAX_SHOWN_STARTS))
)
@@
- if (found?.ptyId === ptyId && noteShown(startOf(found), outcomes)) {
+ if (found?.ptyId === ptyId && noteShown(startOf(found))) {|
Switch-off per-test comparison, head 165dc2a against base ed13ca1. Same folders as the switch-on comparison.
|
ELI5
In the build where the main process owns terminal layouts (switched off by default), main is the one that restarts a sleeping agent's terminal. The window used to be the one that knew whether the agent's session came back, and it showed a "session restored" or "resume unavailable" banner. Once main does the restart, the window no longer knows, so the banner and the "N agent sessions resumed." count disappeared. With this change, main tells the window what happened.
What Changed
Before (switch-on builds only):
After:
restoredorresume-unavailable, but only when that start wakes the pane's own sleeping record (resumesSleepingRecord).resumeOutcomefield.restoredresult for the terminal it attached to, recorded since that attach began.Mechanism:
PaneLiveFactsis a new generic base for main's live, per-pane facts that are never saved. Start statuses and resume outcomes both use it.Why
resumesSleepingRecordas an explicit optional parameter. This PR leaves that hook in place.Linked Issue
Internal refactor (layout-owner series), no issue.
Visual Proof
N/A. The change is switched off in every shipped build. With the switch on, it restores the existing banners and toast count (no new copy).
Testing
Switch-off: no behaviour change. These hunks run with the switch off:
spawn-preflight.ts: setsctx.codexResumeUnavailable, which is read only with the switch on.spawn-commit.ts: callsreportRuntimeResumeOutcome, which returns early with the switch off.reattach-result-handler.ts: callsshowMainPaneResumeOutcome, which returns whenmainStartsPaneis false.deferred-session-reattach-connect.ts:attachResumeCheckgives the same result as before with the switch off.workspace-layout-frame-sync.ts: usesframePaneFactsShown(), a shape-only change.terminalPaneResumeOutcomesByPaneKey.splitPublishedLayout: copiesresumeOutcome, which is never set with the switch off.orca-runtime.ts: passespaneFactSources, which the stream reads only with the switch on.terminal-surface-index.ts: changes only an import path.Wire compatibility:
resumeOutcomeis a new optional field. Older peers ignore it, and older hosts never send it.Server specs: 4/4 pass at the head and at the merge base, on fresh switch-on builds: paired-mobile-desktop-tab-composition, paired-desktop-server-layout-frames, headless-serve-focused-terminal-create and live-background-terminal-mount-authority.
Per-test switch-on comparison (renderer terminal-pane, runtime, store and lib; main ipc, runtime and terminal-topology; shared; preload):
filesystem-watcher-realaliased root) failed only in the head run. It touches nothing here, and rerun alone it fails at both the base and the head on this machine.Switch-off run of the touched suites (971 files):
remote-snapshot-alt-screen-host-chaintimes out in setup, the same as with the switch on.terminal-tail-redraw-wall-timeis a wall-time test that passes on its own.Wire contract for
resumeOutcome: each condition is pinned by a test.workspace-layout-frame-binding.test.ts.main-pane-resume-banner.test.tsandpane-resume-outcome-layout-owner.test.ts.workspace-session-resume-outcome.test.ts.orca-runtime-resume-outcome-layout-owner.test.tsandsleeping-agent-session-launch-layout-owner.test.ts.pane-live-facts.test.ts.Unit tests: new tests cover the outcome contract, the pin to the binding (including a same-id respawn, a never-bound relaunch and a fast-lane rebind), clearing on a failed start, the contention winner keeping its outcome, show-once, the toast count, and the switch-on branches of
pty-connection-sleeping-resume-banner.spec.ts. Each behaviour test fails without its change.Static checks: the CI static-analysis steps and
pnpm tcpass locally.Review
Agent skill upstream boundary
Notes
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)