Repository navigation
Browser, chat and simulator tabs main-first: the window asks main for each change and draws only main's update (dark, layout-owner build only) - #31516
Conversation
…reading its session back (dark, layout-owner build only) A records frame no longer re-serializes the window's whole session and runs the Loader. Panes' terminal bindings and live titles apply alone, to the tabs the frame names; any other record builds only its own workspace's slices, with the view and facts read from the store. Only a workspace the store does not show from frames yet (startup, a reopened stream, a first visit, one sent whole) takes the full build. Tests install an apply check that, after every flush, compares the store with the full build for the same cache and pre-flush store; the shared layout-apply transport now sends main's records frames and fails a flush that differs.
…ack or running the Loader (test, layout-owner build only)
…ing generations, so it passes with the switch on (test only)
…type errors are gone (test only)
…ave's own writers, as the full build does (dark, layout-owner build only)
…anwhile (test, layout-owner build only)
… builds one in full, and the shared transport keeps a test's own check (test only)
…ld, and the shared transport restores only the check it installed (test only)
…s the open file it lacks from it Main's in-memory editor view now carries the file facts an open file needs; it rides the tab row (PublishedTab.editorView) and a frame build rebuilds a diff, conflict, preview or check-details tab. Inert with the switch off: views are set only by layout.apply (switch builds) and read only in frame-sync.
…ons to main and draws the tabs from its frames Layout-owner build only; the switch-off path is unchanged. An open proposes the tab id and sends openEditorTab with the edit file's record or the tab's view (a reopen also its index); the open file is written at once and the tab is selected once its frame draws it. Callers that act on the tab (focus request, link reveal, group focus) wait for that frame through layout-owner-pending-tabs. A close sends closeTabs; the tab goes with the frame and the file's content after it, and a refusal keeps both. A promotion sends promotePreviewTab and the frame clears the flag. Deleted: the drawn editor senders, their before/after captures, the editor drawn-tab holds and the window-record keep rule (a transient tab is kept by its frame view).
…draw # Conflicts: # src/renderer/src/runtime/layout-apply-test-transport.test-fixture.ts # src/renderer/src/runtime/workspace-layout-frame-builds.ts # src/renderer/src/runtime/workspace-layout-frame-pending.ts
…k names its group, and main stamps an open's time Layout-owner build only. After main's frame drops a closed editor tab, the window selects the group's previous tab and its surface through activateTab and focusGroup, after closeFile's content cleanup rather than before it; a reopen sent while the close was in flight keeps the file. openFileForLink's proposed view names the group the open asked for. The window's openEditorTab sends no createdAt: main stamps the tab's time (ledger L186). Preview promotion writes no tab itself: the window ends a preview only where a paired server owns the layout.
… and frame (test only) Each store and hook test that assumed an immediate editor-tab draw now runs with main's model through the T1 transport in apply mode and its frames (tabs-drawn-from-main.test-fixture), and asserts the tab, its selection and its content after main's frame. The fixture fills the frame slices a partial editor-and-tabs store lacks.
…ab's path, and keeps one tab per file per group Layout-owner build only (the switch gates every change; shipped builds unchanged). moveTabToWorkspace no longer skips a tab "the window's save got there first" (L160): window saves no longer carry the move, so a repeat is tab_not_found; tab_exists and invalid_params stay. A move or rename may carry a non-plain tab's new view (its file under the new path or owner), which replaces editorViews[tab] (L180). Main refuses a moveTab or moveTabToWorkspace that would put a second tab for a file into a group (tab_exists), and its loader folds a saved session's duplicate into the first, as the window's restore does (dedupeEditorTabsWithinGroups): the window's frame dedupe hid the second, which no close could reach.
…ands, and the frame that shows them rekeys the content Layout-owner build only; the switch-off path is unchanged. A restored editor tab re-owned by its file's workspace (L157, L158) sends moveTabToWorkspace (a re-own in place sends renameEditorFiles) under the ids and group the window proposes, with each view tab's new view; a disk rename (L180) sends renameEditorFiles per workspace and draws nothing first. The window's content rekey (open file records, drafts, buffers, the editorBuffers echo gate, pendingLiveDiskVerification and pendingSelfMoveEcho) waits in layout-owner-content-rekeys and the frame flush that first shows main's change applies it, in the same store update as the frame (a flush now writes one patch). A change no tab shows is rekeyed on main's answer; a refusal drops it and changes nothing. The move coordinator and the restored-owner loader wait for that outcome; a refused rename rolls the disk move back. A rename picks a runtime-owned or floating file's owned id, as main's frames restore it. Deleted: recordRestoredEditorMoveInLayoutOwner, recordRenamedEditorFilesInLayoutOwner, the reparent's before/after capture and the drawn-tab holds for moves and renames. Tests that assumed the window moves or renames first now run through main's T1 transport in apply mode and its frames.
…r the switch-on move, rename and gap fixes Layout-owner build only. The content rekey's pure store change stays in rekey-open-files-action (its writer count drops 4 -> 2, pruned); a twin tab main routes to a paired server ends its preview through patchTab, the existing tab writer, instead of a new one; a frame-only editor tab takes its label through the frame build's tab-label facts, read from its view or file record; the moved file's activation names the moved tab, writing no surface field. Test casts are typed or carry a SAFETY note.
…argument, so the two modules do not import each other Layout-owner build only; no behaviour change. Clears the static gate's no-cycle finding.
… closes and page changes to main and draws them from its frames Main places the chats its host lists (twin h), a local cancel keeps no tombstone (L155), and the listing no longer writes chat tab structure where frames draw it (L153). Co-Authored-By: Claude <[email protected]>
…'s frame, lands an emptied workspace as today, and its tests read main's frames
…ch-on local cancel through main, with a presence precondition and per-test resets
…irst group, not beside the window's anchor (L150)
…ch-on host's chat tab through main's layout
…e files the writer ratchet counts them in, and a drawn browser close carries its position instead of a rebuilt layout
…nd draws editor tabs only from main's frames (dark, layout-owner build only) With ORCA_LAYOUT_OWNER_IS_MAIN on, editor open (preview replace, open to the side), reopen at its position, close, close-all, promote, the resolved conflict placeholder, a restored-editor move and a disk rename are layout commands the window sends before it draws anything. Window content (open file records, drafts, buffers, the autosave gate) is written at once for an open, and rekeyed in the same store update as the frame for a move or rename. Main publishes each non-edit tab's view, keeps views in memory across applies and partition changes, stamps the tab's time, folds same-file duplicates, and republishes a windowless host's session.tabs after its own file open. The switch-off path is unchanged.
The shared close joins a close already in flight and marks its ask as a close; the editor file's close keeps closeFile's per-file cleanup from D3a-2.
…e tab's content as tab_not_found does, and placement reads a missing active-group map safely
…n's command and draw from its frame (test only)
…nset through the restore projection's own rule, not a second write
…s without assertions (test only)
… no wait; only the switch-on move waits for main
…window's own open, so a reserved chat slot keeps its place (switch-on)
…eue reaches it, through the one rule the switch-off save uses, so a close right after an open closes it
…s main draws, not past a hidden launch slot, so it still replaces the chat (switch-on)
…ow wins, and a test shows a window-listed diff keeps its dirty state (comments and test only)
…he fields main's frame keeps; no caller reads more
…wn-from-main store fixture as a support bridge (test only)
…rs (comment only)
…as a saved session, and one failed change no longer stops the ones after it (switch-on)
…d the batches after it still land (switch-on)
…ugh main, after the tab before its hidden slot (test only)
…he chat open, close or fix paths reach it (test only)
… main's workspace-record selector, as the new ratchet requires
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the
Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ➖ Normal Merge Risk: 🔵 Low · up to
|
There was a problem hiding this comment.
Actionable comments posted: 3
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
43312239-c709-41a5-8f94-f7b7fa2799e0
📒 Files selected for processing: 244
config/renderer-layout-writer-baseline.txtconfig/scripts/pr-unit-support-routing.test.mjssrc/main/persistence/loading-store/layout-editor-views.tssrc/main/persistence/loading-store/primary-state-write-runtime.tssrc/main/persistence/loading-store/store-runtime-state.tssrc/main/persistence/loading-store/workspace-session-write-listeners.tssrc/main/persistence/loading-store/write-scheduling.tssrc/main/persistence/terminal-topology/cross-partition-tab-move.tssrc/main/persistence/terminal-topology/duplicate-pty-pane-repair.tssrc/main/persistence/terminal-topology/editor-renames-across-partitions.test.tssrc/main/persistence/terminal-topology/layout-command-commit.tssrc/main/persistence/terminal-topology/layout-command-persistence.tssrc/main/persistence/terminal-topology/terminal-layout-renames-commit.tssrc/main/persistence/terminal-topology/terminal-pane-admission.tssrc/main/persistence/terminal-topology/terminal-topology-commit.tssrc/main/persistence/terminal-topology/terminal-topology-profile-fixture.tssrc/main/runtime/agent-session-tab-layout-command.test.tssrc/main/runtime/agent-session-tab-layout-queue.test.tssrc/main/runtime/agent-session-tab-layout-queue.tssrc/main/runtime/agent-session-tab-layout.tssrc/main/runtime/editor-view-layout-apply.test.tssrc/main/runtime/editor-view-partition-changes.test.tssrc/main/runtime/editor-view-switch-off.test.tssrc/main/runtime/restored-editor-move-restart.test.tssrc/main/runtime/rpc/methods/structured-agent-session-close-before-create.test.tssrc/main/runtime/rpc/methods/structured-agent-session-create-handler.tssrc/main/runtime/rpc/methods/structured-agent-session-create-window-placement.test.tssrc/main/runtime/rpc/methods/structured-agent-session-create.tssrc/main/runtime/rpc/methods/structured-agent-session.tssrc/main/runtime/rpc/methods/workspace-layout-apply.test.tssrc/main/runtime/runtime-layout-apply.test.tssrc/main/runtime/runtime-layout-apply.tssrc/main/runtime/runtime-store-contract.tssrc/main/runtime/session-layout-apply.test-fixture.tssrc/main/runtime/session-tabs/main-session-tab-rows.test.tssrc/main/runtime/session-tabs/main-session-tab-rows.tssrc/main/runtime/session-tabs/structured-session-tab-close.tssrc/main/runtime/session-tabs/structured-session-tab-restoration.tssrc/main/runtime/structured-agent-session-windowless-layout-host.test.tssrc/main/runtime/structured-agent-session-windowless-layout.test.tssrc/main/runtime/terminal/launch/mobile-terminal-chat-fork.test.tssrc/main/runtime/workspace-layout-projection.tssrc/renderer/src/components/browser-pane/host-guest/browser-page-annotation-document.test.tssrc/renderer/src/components/editor/editor-restored-tab-conflict-scan.test.tssrc/renderer/src/components/editor/markdown-preview-link-actions.tssrc/renderer/src/components/editor/migrate-restored-editor-file-owner.tssrc/renderer/src/components/editor/restored-editor-same-workspace-reown.test.tsxsrc/renderer/src/components/native-chat/structured-agent-session-status-bridge-unconfirmed-start.test.tsxsrc/renderer/src/components/right-sidebar/AiVaultSessionVirtualList.keyboard.test.tsxsrc/renderer/src/components/tab-bar/cli-chat-resume-run.test.tssrc/renderer/src/components/terminal-pane/floating-file-link-selection.test.tssrc/renderer/src/components/terminal-pane/terminal-file-link-editor-open.tssrc/renderer/src/components/terminal-pane/terminal-link-handlers-test-fixtures.tssrc/renderer/src/components/terminal-pane/terminal-link-open-beside-source.test.tssrc/renderer/src/components/terminal/initial-terminal-admission-wait.test.tsxsrc/renderer/src/components/worktree-jump-palette-browser-navigation.test.tsxsrc/renderer/src/hooks/ipc-events/floating-workspace-reveal-routing.test.tssrc/renderer/src/hooks/ipc-events/mobile-terminal-close-ipc-bridge-reveal.test.tssrc/renderer/src/hooks/ipc-events/mobile-terminal-close-ipc-bridge.test.tssrc/renderer/src/hooks/ipc-events/runtime-file-position.test.tssrc/renderer/src/lib/ensure-simulator-tab-behavior.test.tssrc/renderer/src/lib/ensure-simulator-tab.tssrc/renderer/src/lib/execute-open-editor-path-move.test.tssrc/renderer/src/lib/execute-open-editor-path-move.tssrc/renderer/src/lib/launch-cancel-tombstones-compat/structured-agent-session-launch-cancellation.test.tssrc/renderer/src/lib/pane-manager/client-hosted-browser-row-ephemerality.test.tssrc/renderer/src/lib/remap-open-editor-tabs-for-path-change.test.tssrc/renderer/src/lib/rename-user-named-tab-access.test.tssrc/renderer/src/lib/simulator-tab-layout-owner.test.tssrc/renderer/src/lib/simulator-tab-layout-owner.tssrc/renderer/src/lib/structured-agent-session-action-launch.tssrc/renderer/src/lib/structured-agent-session-launch-admission.test.tssrc/renderer/src/lib/structured-agent-session-launch-close-race.test.tssrc/renderer/src/lib/structured-agent-session-launch-registry.tssrc/renderer/src/lib/structured-agent-session-launch-surface.tssrc/renderer/src/lib/structured-agent-session-local-launch-cancel.tssrc/renderer/src/lib/structured-agent-session-new-chat-own-launch.test.tssrc/renderer/src/lib/structured-agent-session-provisional-tab.test.tssrc/renderer/src/lib/structured-agent-session-provisional-tab.tssrc/renderer/src/lib/structured-agent-session-tab-open-through-layout-owner.tssrc/renderer/src/runtime/agent-session-tab-layout-owner.test.tssrc/renderer/src/runtime/agent-session-tab-layout-owner.tssrc/renderer/src/runtime/layout-apply-send.test.tssrc/renderer/src/runtime/layout-apply-send.tssrc/renderer/src/runtime/layout-apply-test-transport.test-fixture.tssrc/renderer/src/runtime/layout-frame-workspaces.tssrc/renderer/src/runtime/layout-owner-content-rekeys.test.tssrc/renderer/src/runtime/layout-owner-content-rekeys.tssrc/renderer/src/runtime/layout-owner-content-tab-open.tssrc/renderer/src/runtime/layout-owner-drawn-tab-placement.test.tssrc/renderer/src/runtime/layout-owner-drawn-tab-placement.tssrc/renderer/src/runtime/layout-owner-pending-tab-facts.tssrc/renderer/src/runtime/layout-owner-pending-tabs.tssrc/renderer/src/runtime/local-structured-session-tabs-sync/frame-drawn-chat-tabs.test.tssrc/renderer/src/runtime/local-structured-session-tabs-sync/frame-drawn-chat-tabs.tssrc/renderer/src/runtime/local-structured-session-tabs-sync/inventory-refresh.tssrc/renderer/src/runtime/local-structured-session-tabs-sync/snapshot-apply.tssrc/renderer/src/runtime/restored-editor-move-reload.test.tssrc/renderer/src/runtime/session-tab-rows-main-window-parity.test.tssrc/renderer/src/runtime/structured-agent-session-tab-retirement.tssrc/renderer/src/runtime/structured-launch-cancel-layout-owner.test.tssrc/renderer/src/runtime/sync-runtime-graph-conversion-publish.test.tssrc/renderer/src/runtime/workspace-layout-frame-bindings.tssrc/renderer/src/runtime/workspace-layout-frame-builds.tssrc/renderer/src/runtime/workspace-layout-frame-editor-views.test.tssrc/renderer/src/runtime/workspace-layout-frame-held-tabs.test.tssrc/renderer/src/runtime/workspace-layout-frame-sync.tssrc/renderer/src/runtime/workspace-layout-frame-tab-props.test.tssrc/renderer/src/store/editor-buffer-record-lifecycle.test.tssrc/renderer/src/store/slices/active-selection-owner-scoping.test.tssrc/renderer/src/store/slices/agent-status.test.tssrc/renderer/src/store/slices/browser-annotation-retention.test.tssrc/renderer/src/store/slices/browser-cleanup-close.test.tssrc/renderer/src/store/slices/browser-layout-owner-commands.test.tssrc/renderer/src/store/slices/browser-mount-admission-removal.test.tssrc/renderer/src/store/slices/browser-page-close-intent-recording.test.tssrc/renderer/src/store/slices/browser-page-conversion.test.tssrc/renderer/src/store/slices/browser-page-conversion.tssrc/renderer/src/store/slices/browser-remote-page-lifecycle.test.tssrc/renderer/src/store/slices/browser-remote-tab-creation.test.tssrc/renderer/src/store/slices/browser-slice-drawn-from-main.test-fixture.tssrc/renderer/src/store/slices/browser-slice-test-harness.tssrc/renderer/src/store/slices/browser-tab-creation-placement.test.tssrc/renderer/src/store/slices/browser-workspace-doc-location.test.tssrc/renderer/src/store/slices/browser-workspace-host-ownership.test.tssrc/renderer/src/store/slices/browser.test.tssrc/renderer/src/store/slices/browser/browser-close-actions.tssrc/renderer/src/store/slices/browser/browser-hydration-actions.tssrc/renderer/src/store/slices/browser/browser-hydration-state.tssrc/renderer/src/store/slices/browser/browser-layout-owner-commands.tssrc/renderer/src/store/slices/browser/browser-page-conversion-actions.tssrc/renderer/src/store/slices/browser/browser-page-create-actions.tssrc/renderer/src/store/slices/browser/browser-tab-actions.tssrc/renderer/src/store/slices/browser/browser-tab-close-through-layout-owner.tssrc/renderer/src/store/slices/browser/browser-tab-focus-actions.tssrc/renderer/src/store/slices/browser/browser-tab-open-through-layout-owner.tssrc/renderer/src/store/slices/content-tabs-from-main-frames.test.tssrc/renderer/src/store/slices/content-tabs-paired-server-workspace.test.tssrc/renderer/src/store/slices/editor-check-details-tabs.test.tssrc/renderer/src/store/slices/editor-close-document-siblings.test.tssrc/renderer/src/store/slices/editor-close-file-cleanup.test.tssrc/renderer/src/store/slices/editor-close-file-stale-active.test.tssrc/renderer/src/store/slices/editor-close-workspace-selection.test.tssrc/renderer/src/store/slices/editor-file-rename-twin-layout-owner.test.tssrc/renderer/src/store/slices/editor-layout-owner-records.test.tssrc/renderer/src/store/slices/editor-open-diff.test.tssrc/renderer/src/store/slices/editor-open-link-placement.test.tssrc/renderer/src/store/slices/editor-preview-tab-setting.test.tssrc/renderer/src/store/slices/editor-recently-closed-tabs.test.tssrc/renderer/src/store/slices/editor-rekey-open-files.test.tssrc/renderer/src/store/slices/editor-right-sidebar-state.test.tssrc/renderer/src/store/slices/editor-session-duplicate-restore.test.tssrc/renderer/src/store/slices/editor-tab-layout-owner.test.tssrc/renderer/src/store/slices/editor-tab-placement.test.tssrc/renderer/src/store/slices/editor/actions/close-file-action.tssrc/renderer/src/store/slices/editor/actions/git-status-actions.tssrc/renderer/src/store/slices/editor/actions/markdown-preview-actions.tssrc/renderer/src/store/slices/editor/actions/open-conflict-file.tssrc/renderer/src/store/slices/editor/actions/open-file-action.tssrc/renderer/src/store/slices/editor/actions/open-file-mutations.tssrc/renderer/src/store/slices/editor/actions/recently-closed-editor-tabs.tssrc/renderer/src/store/slices/editor/actions/rekey-open-files-action.tssrc/renderer/src/store/slices/editor/actions/restored-editor-owner-transition.tssrc/renderer/src/store/slices/editor/actions/restored-editor-owner.tssrc/renderer/src/store/slices/editor/buffers/editor-buffer-views.test.tssrc/renderer/src/store/slices/editor/file-ids/same-owned-editor-document.tssrc/renderer/src/store/slices/editor/tabs/editor-file-rename-through-layout-owner.tssrc/renderer/src/store/slices/editor/tabs/editor-tab-close-through-layout-owner.tssrc/renderer/src/store/slices/editor/tabs/editor-tab-label.tssrc/renderer/src/store/slices/editor/tabs/editor-tab-layout-owner.tssrc/renderer/src/store/slices/editor/tabs/editor-tab-open-through-layout-owner.tssrc/renderer/src/store/slices/editor/tabs/open-file-layout-view.test.tssrc/renderer/src/store/slices/editor/tabs/open-file-layout-view.tssrc/renderer/src/store/slices/editor/tabs/restored-editor-move-through-layout-owner.tssrc/renderer/src/store/slices/editor/tabs/workspace-editor-item.tssrc/renderer/src/store/slices/editor/types/editor-files-slice.tssrc/renderer/src/store/slices/native-chat-launch-draft-teardown.test.tssrc/renderer/src/store/slices/new-markdown.test.tssrc/renderer/src/store/slices/project-removal-host-twin-state.test.tssrc/renderer/src/store/slices/project-removal-owner-host.test.tssrc/renderer/src/store/slices/recently-closed-tabs.test.tssrc/renderer/src/store/slices/restored-editor-owner-layout-owner.test.tssrc/renderer/src/store/slices/restored-editor-owner-reparent.test.tssrc/renderer/src/store/slices/restored-editor-owner-restart.test.tssrc/renderer/src/store/slices/server-editor-file-restart-identity.test.tssrc/renderer/src/store/slices/store-active-worktree-removal-successor.test.tssrc/renderer/src/store/slices/store-active-worktree-split-groups.test.tssrc/renderer/src/store/slices/store-active-worktree-tab-close.test.tssrc/renderer/src/store/slices/store-open-to-side-layout-owner.test.tssrc/renderer/src/store/slices/tabs-close-dangling-group.test.tssrc/renderer/src/store/slices/tabs-drawn-from-main.test-fixture.tssrc/renderer/src/store/slices/tabs-hydration.tssrc/renderer/src/store/slices/tabs-label-and-pin-state.test.tssrc/renderer/src/store/slices/tabs-open-close-lifecycle.test.tssrc/renderer/src/store/slices/tabs-unread-and-focus.test.tssrc/renderer/src/store/slices/tabs/content-tab-close-through-layout-owner.tssrc/renderer/src/store/slices/tabs/content-tab-open-placement.tssrc/renderer/src/store/slices/tabs/moved-tab-selection.tssrc/renderer/src/store/slices/tabs/preview-tab-promotion.test.tssrc/renderer/src/store/slices/tabs/preview-tab-promotion.tssrc/renderer/src/store/slices/tabs/structured-chat-close-owner.test.tssrc/renderer/src/store/slices/tabs/tabs-close-actions.tssrc/renderer/src/store/slices/tabs/tabs-focus-actions.tssrc/renderer/src/store/slices/tabs/tabs-label-actions.tssrc/renderer/src/store/slices/tabs/tabs-layout-owner-groups-order.test.tssrc/renderer/src/store/slices/tabs/tabs-reconciliation-empty-groups.test.tssrc/renderer/src/store/slices/workspace-attention/attention-removal-follow-up.tssrc/renderer/src/store/slices/workspace-attention/workspace-unread-removal-characterization.test.tssrc/renderer/src/store/slices/worktrees/listing/stale-listing-purges-created-worktree.test.tssrc/renderer/src/store/workspace-layout-frame-held-tabs.tssrc/renderer/src/store/workspace-layout-frame-slices.tssrc/shared/rpc-contract/workspace-layout-editor-file-params.test.tssrc/shared/rpc-contract/workspace-layout-editor-file-params.tssrc/shared/rpc-contract/workspace-layout-params.tssrc/shared/workspace-layout/layout-editor-view.tssrc/shared/workspace-layout/old-client/old-client-session-editor-rows.tssrc/shared/workspace-layout/old-client/old-client-session-row-ids.tssrc/shared/workspace-layout/old-client/old-client-session-tab-rows.tssrc/shared/workspace-layout/old-client/old-client-session-tabs-projection.tssrc/shared/workspace-layout/workspace-layout-browser-commands.test.tssrc/shared/workspace-layout/workspace-layout-command-types.tssrc/shared/workspace-layout/workspace-layout-commands.test.tssrc/shared/workspace-layout/workspace-layout-content-commands.tssrc/shared/workspace-layout/workspace-layout-editor-duplicates.test.tssrc/shared/workspace-layout/workspace-layout-editor-rekey.test.tssrc/shared/workspace-layout/workspace-layout-editor-rekey.tssrc/shared/workspace-layout/workspace-layout-editor-tab-file.tssrc/shared/workspace-layout/workspace-layout-fact-locations.test.tssrc/shared/workspace-layout/workspace-layout-from-published.tssrc/shared/workspace-layout/workspace-layout-group-commands.tssrc/shared/workspace-layout/workspace-layout-load-tabs.tssrc/shared/workspace-layout/workspace-layout-load-types.tssrc/shared/workspace-layout/workspace-layout-load-workspace.tssrc/shared/workspace-layout/workspace-layout-model.tssrc/shared/workspace-layout/workspace-layout-move-tab-pin.test.tssrc/shared/workspace-layout/workspace-layout-published-editor-view.test.tssrc/shared/workspace-layout/workspace-layout-published.tssrc/shared/workspace-layout/workspace-layout-tab-commands.tssrc/shared/workspace-layout/workspace-layout-workspace-move.test.tssrc/shared/workspace-layout/workspace-layout-workspace-move.tstests/e2e/cross-version-wire/structured-agent-session-surface-execution.tstests/e2e/layout-compat-baselines.jsontests/e2e/layout-compat-old-phone-on-new-server.spec.tstests/e2e/structured-session-tab-close-regressions.unit.test.ts
💤 Files with no reviewable changes: 5
- src/renderer/src/runtime/agent-session-tab-layout-owner.test.ts
- src/renderer/src/runtime/layout-owner-drawn-tab-placement.ts
- src/renderer/src/runtime/workspace-layout-frame-bindings.ts
- src/renderer/src/runtime/agent-session-tab-layout-owner.ts
- src/renderer/src/runtime/layout-owner-drawn-tab-placement.test.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 3 remain after this review.
| asToday: () => { | ||
| release() | ||
| settle(open.drawHere()) | ||
| }, |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win
Settle the pending tab when drawHere throws.
The asToday handler calls settle(open.drawHere()). If drawHere() throws, settle never runs, and the entry stays in layout-owner-pending-tabs for good. Two consequences follow:
hasPendingEntityTabreturns true for that chat forever.openAgentSessionTabThroughLayoutOwnerthen returns the tab without sending an open.openingSimulatorTabIdkeeps returning the dead id.ensureSimulatorTabthen never opens a simulator tab for that worktree.
The apply handler here and openEditorTabThroughLayoutOwner already use try/finally for this reason ("A throwing selection must not leave the tab pending"). Use the same guard here.
🛡️ Proposed fix
--- "a/src/renderer/src/runtime/layout-owner-content-tab-open.ts"
+++ "b/src/renderer/src/runtime/layout-owner-content-tab-open.ts"
@@ -46,10 +46,15 @@
settle(shownId)
}
},
asToday: () => {
release()
- settle(open.drawHere())
+ let shownId: string | null = null
+ try {
+ shownId = open.drawHere()
+ } finally {
+ settle(shownId)
+ }
},
refused: () => {
release()
settle(null)📝 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.
| asToday: () => { | |
| release() | |
| settle(open.drawHere()) | |
| }, | |
| asToday: () => { | |
| release() | |
| let shownId: string | null = null | |
| try { | |
| shownId = open.drawHere() | |
| } finally { | |
| settle(shownId) | |
| } | |
| }, |
|
|
||
| /** Kept until the release, which is a no-op once a later expectation for the tab replaced it. */ | ||
| export function expectTabFacts(facts: PendingTabFacts): () => void { | ||
| pending.set(facts.tabId, facts) |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
#!/bin/bash
# Inspect expectation callers and the tab IDs they pass.
rg -n -C 6 -F 'expectTabFacts(' src/renderer/src
rg -n -C 5 'tabId:|tabId =' \
src/renderer/src/store/slices/editor/tabs/editor-tab-open-through-layout-owner.ts \
src/renderer/src/store/slices/browser/browser-tab-open-through-layout-owner.ts \
src/renderer/src/lib/structured-agent-session-tab-open-through-layout-owner.tsRepository: stablyai/orca
Length of output: 10509
🏁 Script executed:
set -o pipefail
printf '%s\n' '--- expectTabFacts callers ---'
rg -n -C 12 -F 'expectTabFacts(' src/renderer/src || test "$?" -eq 1
printf '%s\n' '--- ID constructors and uses ---'
rg -n -C 8 -F 'function structuredAgentSessionTabId' src/renderer/src src || test "$?" -eq 1
rg -n -C 8 -F 'structuredAgentSessionTabId' src/renderer/src || test "$?" -eq 1
rg -n -C 8 -F 'function createBrowserUuid' src/renderer/src src || test "$?" -eq 1
rg -n -C 8 -F 'createBrowserUuid' src/renderer/src | head -240 || true
printf '%s\n' '--- tab ID uniqueness and structured tab ID tests/contracts ---'
rg -n -i -C 4 'unique.*tab|tab.*unique|tab id|tabId' src/renderer/src/lib src/renderer/src/store src/renderer/src/runtime --glob '*.{ts,tsx}' | head -320 || trueRepository: stablyai/orca
Length of output: 42426
🏁 Script executed:
set -o pipefail
printf '%s\n' '--- structured agent layout-owner open ---'
sed -n '1,220p' src/renderer/src/lib/structured-agent-session-tab-open-through-layout-owner.ts
printf '%s\n' '--- structured agent callers and session/worktree inputs ---'
rg -n -C 10 -F 'openAgentSessionTabThroughLayoutOwner' src/renderer/src src/shared || test "$?" -eq 1
rg -n -C 8 -e 'sessionId:.*worktree|worktreeId:.*sessionId|sessionId.*worktreeId' src/renderer/src src/shared --glob '*.{ts,tsx}' | head -240 || true
printf '%s\n' '--- createBrowserUuid binding ---'
rg -n -C 6 -F 'createBrowserUuid' src/renderer/src src/shared --glob '*.{ts,tsx}' | head -180 || true
printf '%s\n' '--- structured session identity declarations ---'
rg -n -C 8 -e 'type .*Session.*Open|interface .*Session.*Open|sessionId.*string|worktreeId.*string' src/shared/structured-agent* src/renderer/src/lib/structured-agent* --glob '*.{ts,tsx}' | head -280 || trueRepository: stablyai/orca
Length of output: 41942
🏁 Script executed:
set -o pipefail
printf '%s\n' '--- pending entity-tab guard ---'
rg -n -C 12 -F 'function hasPendingEntityTab' src/renderer/src/runtime src/renderer/src || test "$?" -eq 1
rg -n -C 8 -F 'hasPendingEntityTab(' src/renderer/src/runtime src/renderer/src/lib | head -160 || true
printf '%s\n' '--- pending facts overlay ---'
sed -n '1,180p' src/renderer/src/runtime/layout-owner-pending-tab-facts.tsRepository: stablyai/orca
Length of output: 10832
Key pending tab facts by worktree and tab ID.
hasPendingEntityTab suppresses duplicate opens only within the same worktree. Two worktrees can therefore open the same sessionId, which produces the same tabId. The second pending.set replaces the first, so withPendingTabFacts cannot provide the first worktree’s facts.
Use both worktreeId and tabId for pending-fact storage, lookup, and release.
| const reopened = | ||
| hasPendingEntityTab(file.worktreeId, file.fileId) || | ||
| (get().unifiedTabsByWorktree[file.worktreeId] ?? []).some( | ||
| (tab) => tab.entityId === file.fileId | ||
| ) |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
#!/bin/bash
# Does the frame store patch replace openFiles/editorDrafts wholesale (which would mask the leak)?
rg -n -C5 'openFiles|editorDrafts' --type=ts -g '*workspace-layout-frame-store-patch*' -g '*workspace-layout-frame-builds*'
fd -i 'frame-store-patch' src | xargs -r rg -n 'openFiles'Repository: stablyai/orca
Length of output: 9117
The pending-close path can be mistaken for a reopen. hasPendingEntityTab includes pending opens and pending closes, so the cleanup waiter can skip cleanUp() after the file’s own close request is registered. Count only pending opens when computing reopened.
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
b9475b8d-24ed-408b-b0fa-1ea07d0eb9a4
📒 Files selected for processing: 4
src/main/runtime/runtime-layout-apply.tssrc/renderer/src/runtime/structured-agent-session-tab-retirement.tssrc/renderer/src/store/slices/store-active-worktree-split-groups.test.tssrc/shared/workspace-layout/old-client/old-client-session-tabs-projection.ts
💤 Files with no reviewable changes: 1
- src/shared/workspace-layout/old-client/old-client-session-tabs-projection.ts
🚧 Files skipped from review as they are similar to previous changes: 1
- src/main/runtime/runtime-layout-apply.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
| reacceptHostSessionTabs( | ||
| args.target, | ||
| args.worktreeId, | ||
| intentOwner, | ||
| !hostTabClosed && args.reopen | ||
| ? { sessionId: args.sessionId, reopen: args.reopen } | ||
| : undefined | ||
| ) |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
sed -n '75,185p' src/renderer/src/runtime/structured-agent-session-tab-retirement.ts
sed -n '45,115p' src/renderer/src/store/slices/tabs/tabs-close-actions.ts
rg -n 'beginStructuredAgentSessionTabClose|reopen:' src/renderer/src/runtime src/renderer/src/store/slices/tabsRepository: stablyai/orca
Length of output: 10349
🏁 Script executed:
set -o pipefail
printf '%s\n' '--- tabs-close-actions caller ---'
sed -n '1,145p' src/renderer/src/store/slices/tabs/tabs-close-actions.ts
printf '%s\n' '--- retirement owner and close ---'
sed -n '1,90p' src/renderer/src/runtime/structured-agent-session-tab-retirement.ts
printf '%s\n' '--- reopenChatTab definitions/usages ---'
rg -n -F --glob '*.ts' --glob '*.tsx' -e 'function reopenChatTab' -e 'const reopenChatTab' -e 'reopenChatTab' src/renderer/src
printf '%s\n' '--- focused tests ---'
sed -n '1,360p' src/renderer/src/runtime/structured-agent-session-tab-retirement.test.ts
sed -n '1,340p' src/renderer/src/runtime/structured-launch-cancel-layout-owner.test.tsRepository: stablyai/orca
Length of output: 34461
🏁 Script executed:
set -o pipefail
printf '%s\n' '--- closeUnifiedTab remainder ---'
sed -n '135,360p' src/renderer/src/store/slices/tabs/tabs-close-actions.ts
printf '%s\n' '--- local inventory refresh ---'
rg -n -F --glob '*.ts' -e 'refreshLocalStructuredSessionWorktreeTabs' -e 'reacceptCurrentVersion' src/renderer/src/runtime src/renderer/src
printf '%s\n' '--- refresh implementation ---'
rg -l -F --glob '*.ts' 'refreshLocalStructuredSessionWorktreeTabs' src/renderer/src | while read -r f; do echo "FILE $f"; sed -n '1,260p' "$f"; done
printf '%s\n' '--- layout close helper ---'
rg -n -F --glob '*.ts' --glob '*.tsx' -e 'closeContentTabThroughLayoutOwner' -e 'closeTabThroughLayoutOwner' src/renderer/srcRepository: stablyai/orca
Length of output: 41892
🏁 Script executed:
set -o pipefail
printf '%s\n' '--- layout owner close helper ---'
sed -n '1,180p' src/renderer/src/store/slices/tabs/content-tab-close-through-layout-owner.ts
printf '%s\n' '--- provisional tab opener ---'
rg -n -F --glob '*.ts' --glob '*.tsx' -e 'openStructuredAgentSessionProvisionalTab' src/renderer/src
rg -l -F --glob '*.ts' 'openStructuredAgentSessionProvisionalTab' src/renderer/src | while read -r f; do echo "FILE $f"; rg -n -F -C 20 -- 'openStructuredAgentSessionProvisionalTab' "$f"; done
printf '%s\n' '--- close helper usages/tests ---'
rg -n -F --glob '*.test.ts' --glob '*.test.tsx' -e 'closeContentTabThroughLayoutOwner' -e 'layout owner' src/renderer/src/store src/renderer/src/runtime
printf '%s\n' '--- main close/open handlers ---'
rg -n -F --glob '*.ts' --glob '*.tsx' -e 'session.tabs.close' -e 'session.tabs.list' -e 'agentSession.reveal' src | head -200Repository: stablyai/orca
Length of output: 41940
🏁 Script executed:
set -o pipefail
printf '%s\n' '--- provisional opener body ---'
sed -n '140,215p' src/renderer/src/lib/structured-agent-session-launch-surface.ts
printf '%s\n' '--- layout apply sender ---'
sed -n '1,280p' src/renderer/src/runtime/layout-apply-send.ts
printf '%s\n' '--- pending tab state ---'
sed -n '1,300p' src/renderer/src/runtime/layout-owner-pending-tabs.ts
printf '%s\n' '--- layout apply/frame consumers ---'
rg -n -F --glob '*.ts' --glob '*.tsx' -e 'pendingTab' -e 'isPendingTab' -e 'closeTabs' src/renderer/src/runtime src/renderer/src/store | head -240
printf '%s\n' '--- close race tests ---'
sed -n '1,300p' src/renderer/src/lib/structured-agent-session-launch-close-race.test.tsRepository: stablyai/orca
Length of output: 35954
🏁 Script executed:
set -o pipefail
printf '%s\n' '--- agent-session layout open helper ---'
rg -n -F --glob '*.ts' --glob '*.tsx' -e 'openAgentSessionTabThroughLayoutOwner' src/renderer/src
rg -l -F --glob '*.ts' 'openAgentSessionTabThroughLayoutOwner' src/renderer/src | while read -r f; do echo "FILE $f"; sed -n '1,240p' "$f"; done
printf '%s\n' '--- layout transport fixture and runtime command path ---'
sed -n '1,180p' src/renderer/src/runtime/layout-apply-test-transport.test-fixture.ts
rg -n -F --glob '*.ts' --glob '*.tsx' -e 'layout.apply' -e 'sendLayoutApply' src/main src/renderer/src/runtime | head -160
printf '%s\n' '--- open-after-close sequencing tests ---'
rg -n -F --glob '*.test.ts' --glob '*.test.tsx' -e 'openAgentSessionTab' -e 'open after' -e 'close then open' -e 'reopen' src/renderer/src/store src/renderer/src/runtime src/renderer/src/lib | head -240Repository: stablyai/orca
Length of output: 42286
Wait for the layout close before reopening the listed chat.
When closeTabs is still pending, openAgentSessionTabThroughLayoutOwner returns early for the same pending entity and sends no openAgentSessionTab command. The later close frame can then remove the tab, leaving the still-listed chat hidden. Defer the reopen until the pending entity close settles.
Suggested fix
+import { afterPendingEntityTabs } from './layout-owner-pending-tabs'
...
- stillListed.reopen()
+ afterPendingEntityTabs(worktreeId, stillListed.sessionId, stillListed.reopen)
ELI5
Orca is moving the job of deciding the tab layout from the window to the app's background process ("main"). This is behind a build switch that is off in every shipped build, so users see no change. With the switch on, browser, chat and simulator tabs now work the way editor tabs do since #31438. When you open, close or change one, the window asks main, and the tab appears or goes away only when main's update arrives. The window no longer draws the change first and tells main afterwards.
Follows #31438 (editor tabs), now merged. This branch merged main after #31438 landed and again at cd8b289. In the second merge,
runtime-layout-apply.tstakes main's #31571 close (refused pinned tabs and the launch mark only for a closed tab) with D3b's comment, andstore-active-worktree-split-groups.test.tskeeps both sides.What Changed
Everything below happens only with
ORCA_LAYOUT_OWNER=main:moveTabtakes an optionalisPinned, so a move and a pin are one step.workspace_not_foundis handled liketab_not_found, so the tab leaves.chatTabLayoutCommandnow serves main and the switch-off save;Drawn-tab holds (L263): D3b removes every content-tab caller of the hold, as listed above. These
drawn: truecallers remain:terminal-tab-create-through-layout-owner.ts, D1a);terminal-tab-close-layout-owner.ts, D1b);tab-order-layout-owner.ts,recently-closed-tab-position.ts);tab-group-layout-owner-commands.ts).Sleep/wake,
setChatPaneand default tabs still go throughrecordLayoutApply, but they hold no tab. The file is deleted by whichever PR removes the last caller.Switch-on product bugs fixed here
These three bugs appeared only once these tabs were drawn from main, and none of them occurs switch-off. For each one, I took the fix back out at the final head and confirmed its test fails; with the fix in, the test passes in both builds.
cli-chat-resume-run.test.ts"keeps canonical membership through registered IPC" (×4) and "opens a resumed chat once, through main, after the tab before its hidden slot";structured-agent-session-create-window-placement.test.ts;structured-agent-session-windowless-layout.test.ts"puts a window's chat where the window opens it".moveTabcarriesisPinned, at the chat's index among the tabs main draws, before main closes the chat.workspace-layout-move-tab-pin.test.ts(pin and unpin);structured-agent-session-provisional-tab.test.ts"owns the destination through terminal completion" (typed-before, typed-during) and "places a declined chat's terminal right after the chat past a hidden launch slot".structured-session-tab-close-regressions.unit.test.ts"shows the chat again when the host could not close it".Why
The plan's target is a single owner for the layout, with or without a window. Browser, chat and simulator tabs were the remaining content tabs where the window decided first and main found out afterwards. That ordering is what lets a closed tab come back, or a tab flicker out and back in.
The approach follows #31438. Content stays in the window (page records, chat drafts, emulator attachment) and only layout commands go to main. Moving content to main would be a much larger change for no gain, since that content is per-window by design.
Linked Issue
Internal (terminal-layout final design, D3b).
Visual Proof
N/A: this is a dark path behind a build switch that is off in shipped builds. With the switch on, the tests and e2e runs below cover the behaviour.
Testing
Converted tests: 155 switch-on tests failed at head and passed at base. Two more (
pty-connection-spawn-and-startup) pass on re-run, so they are flaky. All 155 are STALE: they share one cause, a test store with no main to answer the command. After conversion, 8 of them exposed the three bugs above, which are now fixed in product code. All 29 files pass at the final head, both switch-on and switch-off (379 tests).Switch-on comparison, head 78a2d24 against merge-base cfd9e9c (main with Editor tabs main-first: the window asks main for every editor tab change and draws only main's update (dark, layout-owner build only) #31438). Folders: src/main/runtime, src/main/persistence, src/renderer/src/runtime, terminal-pane, store, lib, browser-pane, tab-bar, native-chat, editor and shared/workspace-layout. No test fails at head that does not also fail at base. Head has 37 failures in 18 files, out of 46,085 tests; base has 50 failures.
After the second main merge (cd8b289, head 7bf2dd2): switch-on comparison over src/main/runtime and src/renderer/src/store, which hold the two conflicted files. No test fails at head that passes at base: 22 head failures in 7 files out of 18,748, all failing at base too (base: 26).
Server specs: tab-composition, layout-frames and focused-terminal-create pass at head 7bf2dd2 and at base cd8b289, each on a fresh switch-on build (earlier: head 78a2d24 against base cfd9e9c, same result). layout-intents is absent at both.
Latency, switch-on, base a75b039 (Editor tabs main-first: the window asks main for every editor tab change and draws only main's update (dark, layout-owner build only) #31438) against head, interleaved, 3 runs of 40 samples, p50:
Both are far below the 16 ms rule. Chat open was not timed. The window's chat open is reachable only inside a lazy chunk, and only from a structured launch. Timing it would need a fake structured agent host wired into the latency harness, which is more than about an hour of work. It moves to the pre-flip latency gate (gate 9), where it is measured once.
Switch-off bundle diff against a75b039: 241 hunks, none a switch-off behaviour change.
layout.apply, or only switch-on senders reach them (the anchor fallback,isPinned, main's phone rows).Unchanged ratchets and gates:
ci-static-gatepasses, and the census and routing tests pass both ways.Switch-on tests this PR changed, classified:
No REGRESSION remains; the three bugs found are fixed above.
Review
One independent review, then a delta review for each fix round. The last delta review covered the six fixes in bab77a6 and everything after it, up to the final head 1d796cb, including the queue fix 9b5f10e and the test-only commit 1d796cb. Verdict: APPROVE. Its one finding, a CLI-chat resume dropping its tab, was withdrawn: 1d796cb shows the window opens that tab once, through main. That review read the code only. It ran no tests. SSH has since been traced; see Notes.
Agent skill upstream boundary
Notes
ssh:owner (structured-agent-session-owner.ts:15-25,runtime-client-target.ts:55-66), so a launch there takes the terminal route (agent-launch-route-input.test.ts, "never consults the local project runtime for a worktree on an SSH connection"). The new test incontent-tabs-paired-server-workspace.test.tschecks that an SSH worktree has no chat owner. So none of the chat open, close or three-fix paths reach SSH.runtime:and handled as a paired server's workspace. That workspace keeps today's path for browser and chat tabs, and main never lays it out (runtime-layout-apply.ts:71-73answershost_not_owned;content-tabs-paired-server-workspace.test.ts).tabs-close-actions.ts:84-87); a paired server's chat comes back through today's re-read, as the e2e "does not bring a paired server's closed chat back either" covers.structured-agent-session-action-launch.ts:194-224).isPinnedis a new optional field onmoveTab. Only the local window sends it, and only to its own main.workspace-layout-group-commands.tsit silently produced a duplicatemoveTabblock (the same-filetab_existscheck, twice). I redid every D3b file as a three-way merge against a75b039, the base this branch was built on. The diff from main now matches D3b's original diff line for line, and every file D3b does not touch equals main. The merge also brought in main's new workspace-record-read ratchet, socontent-tab-open-placement.tsnow reads folder workspaces throughselectFolderWorkspaces.session-tab-rows-main-window-parity.test.ts). For a diff tab the window lists, the window's own row still wins, soisDirtyis not lost.isDirtyfor a diff row, or rows for conflict-review and check details. The window's rows cover these until reportView carries the draft versions.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)