Repository navigation
Main titles agent tabs and applies phone tab moves itself, and tab moves name the tab they follow (dark, layout-owner build only) - #31812
Conversation
…its own hook status With the layout-owner switch on, main gives agent tabs their generated titles from the hook-server status it owns, on the desktop, headless serve and orcad: one renameTabs per status batch, so one write and one frame. It keeps the window's rules (setting, custom and quick-command titles, first title wins, dispatch labels). The window stops sending generated titles for tabs main holds; a paired server's tab, or one main has no tab-bar entry for, is still titled by the window as today. The title rules move to src/shared (agent-row-primary-text, and the new agent-generated-tab-title-rules) so both sides share them; switch-off behaviour is unchanged.
…lf, and a tab move names the tab it follows so a stale index can't misplace it (layout-owner build, L193)
…ow's way, a twin's agent tab keeps its window title, and orcad subscribes titles through the store attach (layout-owner build)
…ough its compat entry
…ts own, with no cyclic re-export
|
Important Review skippedReview was skipped as selected files did not have any reviewable changes. ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ➖ Normal Merge Risk: ⚪ Minimal · up to
|
… in its new group and skips the window's no-op split (layout-owner build, L289) A phone's split now goes only through main's tab move (#31812); this branch's own split routing is gone. For a split only, main's tab move now does what the window's drop does: it sends nothing for a drop that changes nothing (the window's pane-column check, reused), and after main applies the split it selects the moved tab and makes its new group active. Refusals keep that path's codes.
…lects the moved tab as the window does (dark, layout-owner build only) (#31924) * fix(session-tabs): a tab main's groups lack keeps the place its writer listed it, so a headless phone lists a chat first (layout-owner build, L283) On a host with no window, a rebuild writes its rows under a group id main's layout lacks. The row writer's reorder treated every row of that group main does not hold (a chat, a browser page) as a stray and appended it to the active group, so a chat the user moved first came back last, in both the groups and the tab list. Strays now go after the id they follow in the writer's order (else first), the same rule a group main does hold already used; the window publication path shares it. * fix(session-tabs): a phone's split move and its create after a split tab go through main's layout on a windowless host (layout-owner build, L288, L289) On a host with no window, a phone's split move only rewrote the runtime's own rows, and its new terminal anchored after a split tab reached main's layout with no anchor. Every write of the rows takes main's groups and order, so the split collapsed back into one group and the new tab landed after the trailing tab. The split is now main's splitGroup command (the moved tab selected in its new group, as a desktop drop), and the create passes the anchor's tab to main's createTerminalTab, as a window's create does. An older phone sends no anchor and still gets the end. * test(session-tabs): type the split move's async reply in the dispatch stub, and read an optional group map (L289) * fix(session-tabs): a phone's split goes to main's layout only for a tab main holds, as the window sends it (layout-owner build, L289 review) With the Store's write notices, today's runtime-only split already reached main's groups through the session write; what it lost on a windowless host was the selection: the moved tab and its new group did not become the active ones, as they do after a window's drop. The split stays main's splitGroup for a tab main's groups hold, with the window's checks: a drop main's groups make a no-op sends nothing (the window's pane-column rule, now in shared), and a refusal is dropped silently. A row main does not hold (a chat or browser tab) splits as today, with no error. The create anchor and its layout-owner hand-off move to their own module. The surface test fixture's session writes now notify listeners, as the Store's do. * chore(session-tabs): log when main refuses a phone's split, as the window logs its own refusals * fix(session-tabs): a phone's terminal created after a chat or browser tab main holds lands after it, in its group (layout-owner build, L288 follow-up) Since browser and chat tabs went main-first, main's layout holds them, but a windowless create handed main the row id (agent-session:<id>), which is not main's tab id, so main put the new tab at the end of its first group. The anchor is now resolved to main's own tab, as a window's create names it; main's read of a workspace's layout is one method the tab-move path shares. * fix(session-tabs): one move path: main's tab move selects a split tab in its new group and skips the window's no-op split (layout-owner build, L289) A phone's split now goes only through main's tab move (#31812); this branch's own split routing is gone. For a split only, main's tab move now does what the window's drop does: it sends nothing for a drop that changes nothing (the window's pane-column check, reused), and after main applies the split it selects the moved tab and makes its new group active. Refusals keep that path's codes. * fix(session-tabs): resolve a create's anchor to main's tab inside the tab-move module, so only the old-client boundary's listed importers read old-client rows (L288 follow-up) * perf(session-tabs): read main's layout for a create's anchor only when main places it, so switch-off and appending phones skip that load * fix(session-tabs): restore the row-to-tab lookup the split selection and create anchor use, after #31925 dropped its import (layout-owner build, L288, L289) #31925 removed the L280 bridge in main's tab move, and with it the move's last use of resolveSessionTabRow, so it dropped the import; this branch's split selection and create-anchor lookup still resolve a row to main's tab through it. A row main's layout does not hold is now refused by main's move (tab_not_found) as #31925 rules; the phone test asserts that. * test(session-tabs): the L283 phone-order test opens its chat as the host does and uses a store that announces its writes (layout-owner build) Since #31925, main moves every tab of a workspace it owns and refuses a row its layout does not hold, and since D3b a chat the host opens is saved in main's layout. The test now opens the chat through the host's publish path and gives the runtime a profile-like store (partitions listed, writes announced), so the reorder reaches main's layout and its commit reaches the rows. * test(session-tabs): type the L283 test's profile-like store as the Store contract declares it * revert(session-tabs): drop the stray-placement change; main's layout holds chats and moves every row now (L283) Since D3b a chat the host opens is saved in main's layout, and since #31925 a phone cannot move a row main does not hold, so the rebuilt-group stray this placed no longer reaches a phone; the remaining strays are brief, and appending them gives the same order. withStrayIn and its callers return to main's behaviour, with its unit test. The phone-order spec stays as a guard that a windowless chat moved first stays first after a rebuild.
ELI5
Orca has a dark build switch that moves ownership of the terminal layout from the window into the app's background process ("main"). This PR moves two more things into main:
It also makes every tab move say which tab it should follow, so a move based on an out-of-date view can't put a tab in the wrong place. Normal builds (switch off) behave exactly as today.
What Changed
Everything below applies to switch-on builds (
ORCA_LAYOUT_OWNER=main) only. Relative to a switch-off build, nothing a user sees changes.--serveand orcad, with or without a window.src/shared, so both sides use the same code.attachAgentStatusStore), so both entry points get it from one place.main-layout-session-tab-move.ts). Main applies the move as its own layout command and does not ask the window: reorder becomesmoveTabsteps, a move to another group becomesmoveTab, and a split becomessplitGroup. Main reads the client's move against the rows it was shown, through the existing old-client translation.moveTabtakes an optional anchor,afterTabId(ledger L193): the tab to follow, ornullfor first. Main honours it when that tab is in the target group, and otherwise usesindexas before. The window's reorder, drag-to-group and reopen-position moves send it.index.layout.applyto a server. It reaches servers once the server-routing work lands.Why
Main owning the layout is the plan of record. Titles and phone moves were the remaining places where the window had to be present and had to pass the change back to main. With the window able to see a different tab order than main, an index-only move could land a tab in the wrong place; an anchor names the intended neighbour instead.
Alternatives considered:
--serve, orcad and windowless hosts got no titles.Linked Issue
N/A (internal layout-owner track).
Visual Proof
N/A. Switch-off builds are unchanged, and the switch-on build is dark and unshipped.
Testing
ci-static-gate: all steps pass at the final head 9cc295b, after main (8ba1c9b) was merged in.
Switch-on unit suite, head 6906827 vs base 78bc1e5 (per-test diff; main runtime, persistence and ipc, and renderer runtime, store, lib, tab-bar, terminal, terminal-pane, browser-pane, native-chat, right-sidebar and editor, plus shared workspace-layout): no new failures. Four tests failed at head that pass at base. I re-ran each under the same machine load:
pty-runtime-hidden-at-spawn-markpasses at head when run alone.filesystem-watcher-realandremote-snapshot-alt-screen-host-chainfail at base too.TabBar.context-menu's import-heavy wiring test times out at base too (30 s).All four are load flakes (load average was about 66).
Switch-off unit suite, narrowed by agreement to
src/main/runtime,src/main/startup,src/main/orcad,src/renderer/src/store,src/renderer/src/runtimeandsrc/shared/workspace-layout, with base filtered to the same folders: no test that passes at base fails at head. The only head-only failures are 4 inorcad-forked-child-paths, which fail identically at base on macOS (a/private/varpath mismatch).After the main merge: the touched folders were re-run in both builds. Switch-off passes; every switch-on failure also fails at base.
Server specs: run switch-on, after a fresh build at each commit, through the app slot.
Re-run at the final head 9cc295b after the main merge, on a fresh switch-on build: all 4 pass. They also passed at 6906827.
New or converted tests:
agent-generated-tab-titles.test.ts,hook-status-title-subscription.test.ts,agent-status-store-attach-titles.test.ts, and the converted window title tests (the window sends main no titles; a twin's or server's tab is titled by the window).main-layout-session-tab-move.test.ts, covering a reorder, a split and a move to another group, with and without a window, the window not being asked, the fallback when a group shows a tab main lacks, and today's refusal codes.workspace-layout-move-tab-anchor.test.ts, covering after, first, fallback, cross-group, and the L193 clobber case, which fails without the anchor.Fail-first: each fix test was checked to fail with its fix reverted.
I manually tested these changes locally (unit and hidden-window e2e; the switch-on build is dark)
Automated tests added/updated
Review
Reviewed by Opus, plus an Opus delta review of the fix round. Fixed in that round:
Known, unchanged behaviour:
Agent skill upstream boundary
Notes
afterTabIdis optional on the wire, and phones keep usingsession.tabs.moveunchanged.check-compat-boundary-imports.mjs, so deleting the folder still removes the path.