Repository navigation
fix(layout-owner): main wakes slept panes it owns (B1, B2, B3, B5) - #51731
Merged
Merged
Conversation
Runs ORCA_LAYOUT_OWNER=main on PRs that touch layout, tabs, session, persistence, PTY or terminal code: the units whose imports reach a switch-reading file plus restored layout invariants, checked against a list of known switch-on failures, and 34 restored layout e2e specs in three shards. Known switch-on failures are marked expected-fail with their census row.
Seed the worktree-cards notice as seen, skip orcad oracle cases when out/orcad is not built, mark the layout-compat baseline drift (L311), keep A3 marked on darwin only, retry once in CI, and rebalance shards.
…c that fails both modes
Main reinstalling its own panes no longer counts as a newer window graph, so the window's pending graph reply stops throwing. A slept agent in a main-owned pane shows as the idle agent, not its stopped process. Close and move steps in the wake tests go through main's layout when the switch is on.
…aches parked panes With the new layout path, main published a pane bound to a terminal that had exited, so after a sleep the CLI and phones still named the stopped terminal while the window drew none. Main now publishes such a pane with no terminal, as the window draws it; the layout keeps the binding. A hidden pane that main starts waited for its first view even when a phone wake asked for it. A workspace wake now has main start a parked pane right away, and a tab mounted by that wake starts on mount.
…er-b1-b3-sleep-wake # Conflicts: # .github/workflows/layout-owner-switch-on.yml # config/scripts/ci/layout-owner/check-switch-on-unit-results.mjs # config/scripts/ci/layout-owner/switch-on-known-unit-failures.json # src/main/runtime/orchestration/mailbox/routing/slept-agent-wake-no-window.test.ts # src/shared/workspace-layout/commands/workspace-layout-command.test-fixture.ts # src/shared/workspace-layout/workspace-layout-command-model.test.ts # tests/layout-owner-e2e/relaunch-sleeping-agents-resume-on-view.spec.ts # tests/layout-owner-e2e/workspace-layout-oracle.spec.ts
…t a window With the new layout path on, every slept-pane wake (a message, a CLI act, a worker start, a phone opening the workspace) now has main start the pane itself through its restored-pane starter, which already shares one start per pane. A mail wake's attempt id is carried into the started process, so the wake can confirm it. The window no longer drives these wakes; the window-side wake code from the last commit is removed. A record whose tab is gone stays with the window, which reopens it in a fresh tab. This also lets a host with no window wake a slept agent. Also: a slept agent's pane lists and shows as the writable idle agent even though main marks it sleeping, and a terminal's certified exit now updates what main publishes right away instead of at the next window graph.
…er-b1-b3-sleep-wake # Conflicts: # config/scripts/ci/layout-owner/switch-on-known-unit-failures.json
…er-b1-b3-sleep-wake
…er-b1-b3-sleep-wake
…fter a window close or restart too - A terminal main starts into an Agent-slept pane takes the handle the pane answers to, as a window-started resume already did, so mail, waits and worker lists keep naming the agent. - A wake by handle finds the pane again after the window closes or the host restarts: the pane's saved sleep record names the handle, and main's binding names the stopped terminal when no sleep row is left. - A pane closed out of a split no longer counts as held because its sibling keeps the tab. - A phone told about a wake now hears that main resumes what it holds. - Main resumes an originless legacy sleep record in a pane it holds instead of starting a plain shell.
…er-b1-b3-sleep-wake # Conflicts: # tests/layout-owner-e2e/workspace-layout-oracle.spec.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Into
layout-owner-v2. Fixes census rows B1, B2 (L308), B3 (L309) and B5 with the new layout path on.ELI5
Sleeping agents broke in four ways when main owns the layout:
orca serve, a closed window) could not wake a slept agent at all.Now main wakes the panes it owns itself, whoever asks, and the window only draws.
Before / after
Runtime graph publisher belongs to a superseded renderer generation, wake failsorca terminal show/terminal.liston a slept agentconnected/writable: falsewritable: true(same as switch off)terminal.list/ session tabsagent_wake_failedMechanism
slept-pane-resume.ts): handle wakes, mail wakes (and their prepare step), and phone workspace wakes now go throughresumeSleptPaneTerminal. If main's layout owns the tab and still holds the pane, main starts it withensureRestoredPaneStarted, the starter behindstartPane/wake. That starter already shares one start per pane, so a handle wake and a phone wake that race start one process. Otherwise the window relay is used as before. That covers switch off, paired-server tabs, and a record whose tab is gone, which the window reopens in a fresh tab.restored-pane-start.ts,restored-pane-materialize.ts,mobile-terminal-owned-create.ts): the mail wake's attempt id rides the start trigger into the created terminal'slaunchToken, so the wake confirms it as before.slept-workspace-wake.ts,runtime-workspace-sleep-operations.ts): main also resumes the hibernated and quit agents the window used to resume. It still skips tab-open-only panes ([Bug]: Interrupted agent sessions are never auto-hibernated, and manual workspace sleep silently discards them on wake #11598). It sends the window relay only for panes main does not hold.session-window-graph.ts): main's own pane reinstall no longer counts as a newer window graph, so the window's pending reply does not throw.write-orchestration-pointer-pty.ts,resolve-terminal-pane.ts): main marks an Agent-slept pane sleeping, but list and show now report the idle agent.terminal-create.ts,preallocated-terminal-handles.ts): a terminal main starts into an Agent-slept pane takes the handle the pane already answers to, as a window-started resume does, so mail, waits and worker lists keep naming the agent.slept-leaf-handles.ts,unmounted-slept-agents.ts): after the window closes or the host restarts, a wake by handle finds the pane again. The pane's saved sleep record names the handle, and when no sleep row is left, main's binding names the stopped terminal.stored-pane-binding.ts): a pane closed out of a split no longer counts as held because its sibling keeps the tab.workspace-sleep.ts): a phone opening a workspace with no window hearsrequestedfor the agents main now resumes.agent-session-resume-ownership.ts): an originless sleep record (Paired-client pane resume treats originless legacy done records as pane-owned #29303) in a pane main holds resumes its agent instead of a plain shell.terminal-surface-index.ts,pty-exit-lifecycle.ts): a pane whose terminal certainly exited is published with no terminal. The exit now re-composes main's panes right away, so this holds with no window graph too.The #44113 policy layer (held mail, one wake per handle, wait for idle) is unchanged.
How it was tested
New
slept-pane-main-wake.test.ts(switch on). Three of its tests run main's real start, faking only the PTY spawn and the Git worktree listing. They check that the resumed terminal keeps the slept handle and carries the mail wake's id, and that an originless record resumes its agent. The others cover:With fix 1 or fix 5 reverted, those tests fail.
slept-agent-wake-no-window.test.tsnow passes with the switch on (B5). With the switch off it stays an expected failure, because the window owns the pane.The tests fake only the process main spawns (a harness override of
startRestoredPaneTerminal). The real one-start-per-pane starter runs.Both modes,
--maxWorkers=1:orchestration/mailbox,session-graph,session-lifecycle,workspaces/sleep,terminal/{surface,recovery,lifecycle},terminal-authoritypass. The only switch-on failures are the D1 rows already listed.E2E, local darwin build with
ORCA_LAYOUT_OWNER=main(plain build, setting given at run time):relaunch-sleeping-agents-resume-on-view3/3. Its phone step now pairs a real phone client and callsworktree.activate, instead of sending the window a fake message. Oraclesleep-quit-resumepasses.tc:node, oxlint, oxfmt clean.Not covered
startPaneintent from the window. That is a view intent, not a wake.Performance
None, because each wake does what it did before (one start per pane), and main now does that start itself. The other changes add one counter compare per graph reply, one exit-verdict lookup per main-owned pane on compose, and one re-compose per certified terminal exit.
Visible changes
None with the switch off. With the switch on, these are bug fixes only: hidden tabs resume on a phone wake, a windowless host can wake a slept agent, and the CLI/phone no longer list a stopped terminal id for a sleeping pane.