Repository navigation
Conversation
A host with no window now saves the browser tabs it opens in the same shape a desktop window saves its own, and restores them the same way: listed at once with their last address, each page started when a client first opens or drives it. A closed tab is forgotten; a page that ends with the process is not a close.
…e id Review fixes: a page's address is written onto its saved records without reloading the layout, and only on committed navigations; reopening a saved page writes nothing; a command naming only the page finds the workspace that saved it; a refused save no longer throws from a page event or a close. The browser-tab map is renamed to say it lists saved tabs too.
…hat name no page or worktree
…ing on a page does
…the mover; a drop that changes no order is a no-op
…al when its binding is lost; serve-restart baseline names untitled rows by position before the restart too
…es, whichever caller stored it
…al names its launch agent; tests follow the saved-layout contract
…s, not the first saved one A host now records the browser tab a window would show: the one it just opened, and the one a tab switch picks. With nothing running, a command that names no page starts that tab; when the layout shows none it starts nothing and reports no browser tab open.
Claude-Session: p2-headless
…und contract Claude-Session: p2-headless
…yout writer Claude-Session: p2-headless
…-browser-tabs-saved
… tab with it Claude-Session: p2-headless
Claude-Session: p2-headless
…l holds it Claude-Session: p2-headless
… into fix/client-hosted-browser-tabs-saved
…aved' into pr3/session-tabs-from-saved-layout
…ut module Claude-Session: p2-headless
…m-saved-layout Claude-Session: p2-headless
…to pr3/session-tabs-from-saved-layout
…titions Claude-Session: p2-headless
… settled retire removes Claude-Session: p2-headless
…to pr3/session-tabs-from-saved-layout
…ts view edits Claude-Session: p2-headless
…nder its own epoch; review fixes Claude-Session: p2-headless
Claude-Session: p2-headless
|
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: 🟡 Moderate · 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:
8e753c31-769e-4846-9f3e-d6c0aa9d778e
📒 Files selected for processing: 90
config/main-layout-writer-baseline.txtconfig/scripts/check-compat-boundary-imports.mjsconfig/scripts/vitest-node-runtime-files.mjssrc/main/browser/offscreen-browser-backend.tssrc/main/ipc/pty-launch-parity-caller.test-cases.tssrc/main/ipc/pty-launch-parity-host.test-cases.tssrc/main/ipc/pty-launch-parity.test-fixture.tssrc/main/persistence/loading-store/pty-retirement-publication-during-read.test.tssrc/main/runtime/agent-session-tab-layout.tssrc/main/runtime/client-hosted-browser-page-persistence.tssrc/main/runtime/client-hosted-browser-tab-layout.integration.test.tssrc/main/runtime/client-hosted-session-browser-tabs.tssrc/main/runtime/created-mobile-session-tab-caller-selection.test.tssrc/main/runtime/orca-runtime-apply-mobile-session-tab-navigation.tssrc/main/runtime/orca-runtime-browser-client-hosted.test.tssrc/main/runtime/orca-runtime-build-headless-mobile-session-browser-tabs.tssrc/main/runtime/orca-runtime-close-headless-mobile-terminal-tab.tssrc/main/runtime/orca-runtime-close-mobile-session-tab.tssrc/main/runtime/orca-runtime-close-structured-agent-session-tab.tssrc/main/runtime/orca-runtime-create-terminal.tssrc/main/runtime/orca-runtime-get-pty-record-for-pane-key.tssrc/main/runtime/orca-runtime-get-runtime-id.tssrc/main/runtime/orca-runtime-hydrate-headless-mobile-session-tabs-from-workspace-session.tssrc/main/runtime/orca-runtime-move-headless-mobile-session-tab.test.tssrc/main/runtime/orca-runtime-perform-mobile-session-pty-records-refresh.tssrc/main/runtime/orca-runtime-persist-headless-session-tab-props.tssrc/main/runtime/orca-runtime-persist-headless-terminal-title.tssrc/main/runtime/orca-runtime-prune-mobile-session-tab-group-layout.tssrc/main/runtime/orca-runtime-pty-foreground-process-reads.tssrc/main/runtime/orca-runtime-refuse-unattributed-mobile-session-tab-close.tssrc/main/runtime/orca-runtime-resolve-terminal-split-source-authority.tssrc/main/runtime/orca-runtime-restore-structured-agent-session-tabs-once.tssrc/main/runtime/orca-runtime-runtime-id.tssrc/main/runtime/orca-runtime-schedule-mobile-session-tabs-changed.tssrc/main/runtime/orca-runtime-serve-browser-restore.test.tssrc/main/runtime/orca-runtime-stored-mobile-snapshot-has-stale-preserved-tab.tssrc/main/runtime/orca-runtime-structured-session-restore.test.tssrc/main/runtime/orca-runtime-terminal-close-spill-partition.test.tssrc/main/runtime/orca-runtime-terminal-drivers.tssrc/main/runtime/orca-runtime-test-fixtures.spec.tssrc/main/runtime/orca-runtime-tests/exit-retirement-activation.spec.tssrc/main/runtime/orca-runtime-tests/mobile-session-tabs-cold-serve-hydrate.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-09.spec.tssrc/main/runtime/orca-runtime-tests/windowless-terminal-start.spec.tssrc/main/runtime/orca-runtime-wait-for-mobile-terminal-surface.tssrc/main/runtime/orca-runtime.test.tssrc/main/runtime/orca-runtime.tssrc/main/runtime/renderer-browser-session-reconciliation.test.tssrc/main/runtime/rpc/methods/session-tab-browser-placement-mutations.test.tssrc/main/runtime/rpc/methods/session-tab-mutation-methods.tssrc/main/runtime/rpc/methods/session-tabs-move-validation.test.tssrc/main/runtime/rpc/methods/session-tabs.test.tssrc/main/runtime/rpc/methods/structured-chat-tab-table.test-fixture.tssrc/main/runtime/rpc/methods/structured-worker-tab-retirement.test.tssrc/main/runtime/runtime-browser-commands-active-screencasts-by-page-id.tssrc/main/runtime/runtime-browser-commands-browser-command-target-params.tssrc/main/runtime/runtime-browser-commands-browser-tab-close.tssrc/main/runtime/runtime-browser-commands-browser-tab-create.tssrc/main/runtime/runtime-browser-commands-browser-tab-list.tssrc/main/runtime/runtime-browser-commands-list-logical-browser-tabs.tssrc/main/runtime/serve-browser-tab-layout.test.tssrc/main/runtime/serve-browser-tab-layout.tssrc/main/runtime/serve-browser-tabs.tssrc/main/runtime/structured-agent-session-host-refusal.test.tssrc/main/runtime/structured-agent-session-startup-tab-restore.test.tssrc/main/runtime/structured-agent-session-windowless-layout-host.test.tssrc/main/runtime/structured-agent-session-windowless-layout.test.tssrc/main/runtime/unbound-terminal-tabs.tssrc/main/runtime/unlisted-terminal-tab-close.tssrc/main/runtime/windowless-session-tab-move.tssrc/main/runtime/windowless-session-tabs.test.tssrc/main/runtime/windowless-session-tabs.tssrc/main/startup/main-process-runtime-launch.tssrc/shared/workspace-layout/old-client/index.tssrc/shared/workspace-layout/old-client/old-client-session-tab-groups.tssrc/shared/workspace-layout/old-client/old-client-session-tabs-projection.test.tssrc/shared/workspace-layout/old-client/old-client-session-tabs-projection.tssrc/shared/workspace-layout/workspace-layout-command-types.tssrc/shared/workspace-layout/workspace-layout-content-commands.tssrc/shared/workspace-layout/workspace-layout-load-order.tstests/e2e/headless-serve-browser-tab-restart.spec.tstests/e2e/headless-serve-mixed-tab-order.spec.tstests/e2e/layout-compat-baselines.jsontests/e2e/layout-compat-serve-restart-keeps-at-at-terminals.spec.tstests/e2e/paired-client-hosted-browser-ghost-close.spec.tstests/e2e/paired-desktop-mixed-tab-order.spec.tstests/e2e/paired-mobile-desktop-tab-composition.spec.tstests/e2e/workspace-layout-oracle-known-on-main.ts
💤 Files with no reviewable changes: 1
- tests/e2e/workspace-layout-oracle-known-on-main.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.
| for (const sessionId of this.savedAgentSessionTabs().keys()) { | ||
| if (!host?.deps?.store?.isSessionUnreadable?.(sessionId)) { | ||
| this.removeWindowlessAgentSessionTab(sessionId) |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
Remove a confirmed missing chat even when the tab index is absent.
If a legacy profile has no tab index and its saved chat record is gone, restored is empty. Index seeding then writes nothing. removeWindowlessAgentSessionTab(sessionId) also does nothing because its retirement check requires a present index. The dead tab remains saved across restarts. For a session absent from restored and not marked unreadable, use the settled removal path; keep restored and unreadable sessions. (raw.githubusercontent.com)
| const listed = new Set((await strip(a, worktree)).flat()) | ||
| await expectStrip('warm restart', [[first, browser, third].filter((id) => listed.has(id))]) |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Require both terminal tabs after restart.
If either first or third disappears but two other tabs remain, filtering by listed removes the missing terminal from the expectation. The restart check can then pass despite losing a terminal. Assert that first and third are present before allowing the browser tab to be optional.
| await expect | ||
| .poll(take, { timeout: 90_000 }) | ||
| .toBe(expected) | ||
| .catch(() => undefined) |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift
Wait for the trigger before accepting the retained strip.
takeDesktopStrips retains the last strip, which already equals expected after the setup step. After a network restore or another asynchronous trigger, this poll can pass on that old strip before the desktop processes the trigger. A later regroup is then absent from findings. Add a trigger-specific completion check before settlement, then observe the strip through a bounded quiet period.
Claude-Session: p2-headless
Claude-Session: p2-headless
…ishes its own list Claude-Session: p2-headless
|
E2E evidence for this head and main at the same base (3a011e4):
|
Review pass: the saved tab reuses the id status and attention address, the close checks for a window before scanning partitions, and the host tests seed readable records with unreadable, other-host and no-index cases. Claude-Session: p2-headless
A desktop document page or a remote page recorded as active no longer leaves a pageless command with no tab. Adds a test for the first-saved-worktree scope. Claude-Session: p2-headless
… into fix/client-hosted-browser-tabs-saved # Conflicts: # src/main/runtime/serve-browser-tabs.ts
…aved' into pr3/session-tabs-from-saved-layout
…to pr3/session-tabs-from-saved-layout # Conflicts: # src/main/runtime/orca-runtime-close-structured-agent-session-tab.ts
Claude-Session: p2-headless
The window's existing-tab lookup moves to the shared projection so the windowless-layout test exercises it without importing the renderer. Claude-Session: p2-headless
…to pr3/session-tabs-from-saved-layout
Claude-Session: p2-headless
|
Replaced by a smaller series; follow-up PRs link here. |
ELI5
On a computer running Orca without a window (a server that phones and other desktops connect to), the list of tabs those devices see was rebuilt from several in-memory sources that drifted apart: a moved tab could snap back, a closed tab could return, and the order could differ between devices. Now the server builds that list the way the desktop window builds its own tab strip: from the saved tab layout. Every change is saved first, and the list is read back from the save.
What Changed
Before: a host with no window kept its own tab list in memory, patched by each operation (create, move, close, select), and only some of those patches reached the saved layout. Phones and paired desktops saw that in-memory list, so it could disagree with what a window opening the same profile would show, and with itself after a restart.
After: with no window attached:
projectWindowlessSessionTabs), the same model and loader a window uses; it is re-projected after every saved-layout write, keeps one publication epoch, and tells subscribers about every change it stores;UnboundTerminalTabs, on the existing stable-pane-create claim), so a client never types into a half-made tab;closeSnapshotFor, through fix(runtime): a terminal close commits in the session partition that holds the tab #27119'sgetWorkspaceSessionHostIdsForTab);With a window attached the list is unchanged: the window publishes its own list, as today. One shared read changes for both: when splitting or closing a terminal, the check that the tab is saved now reads the partition that holds the tab, not only the routed one (#18202).
Visible changes:
Stacked on: #28166 (serve browser tabs), the client-hosted browser tab change (not yet opened; lands after #28166), and #28354 (chat tabs saved in the layout). The diff includes them until they merge.
Why
The window already has one rule for its tab strip: the saved layout, with live state overlaid. Giving the windowless host the same rule removes the separate in-memory bookkeeping that every bug in this area came from, and is the step before one runtime owner for the layout.
Alternatives considered:
Linked Issue
Workspace layout single-copy plan, part 2 (session tabs from the saved layout). Refs #18202.
Visual Proof
N/A: the list content is what the tests and the layout oracle check; the visible changes above are covered by the e2e specs listed below.
Testing
Unit: new
windowless-session-tabs.test.tsandorca-runtime-tests/windowless-terminal-start.spec.ts; the [Bug]: exact terminal close snaps back when one worktree is split across local and runtime session partitions #18202 close tests now run without a seeded list and add a check that the list shows only the owner partition; existing suites moved to the saved-layout contract where they asserted the old in-memory list (pty-launch-parity,pty-retirement-publication-during-read, the [Bug]: exact terminal close snaps back when one worktree is split across local and runtime session partitions #18202 close tests).src/main/runtimepasses in full. Acrosssrc/mainandsrc/shared, the remaining failures also fail on main at the same base on this machine (browser-manager identity and viewport, packaged CLI assets, shell live tests, ssh/omp wrappers, serve-sim).E2E: new
headless-serve-mixed-tab-order.spec.tsandpaired-desktop-mixed-tab-order.spec.ts(tab order across a phone and a paired desktop). The full suite on this head against main at the same base, and the layout oracle (runs in a comment).Writer ratchet: a windowless host's layout writes go through one runtime method,
applyWorkspaceSessionChange(counted once); the two view-selection edits inwithSavedTabSelectionare counted, since selection has no layout command yet. Both move onto the runtime's layout command channel.I manually tested these changes locally
Automated tests added/updated, or explained why not below
AI Disclosure
Review
Agent skill upstream boundary
Notes
unlisted-terminal-tab-close.tsis deleted.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)