Skip to content

Main titles agent tabs and applies phone tab moves itself, and tab moves name the tab they follow (dark, layout-owner build only) - #31812

Merged
Jinwoo-H merged 11 commits into
mainfrom
fd/d2b-generated-titles
Oct 22, 2026
Merged

Jinwoo-H merged 11 commits into
mainfrom
fd/d2b-generated-titles

Conversation

@Jinwoo-H

@Jinwoo-H Jinwoo-H commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 18 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​819 $\color{#cf222e}{\Huge{\mathbf{−}}}$​218 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​601
Prod 31 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​443 $\color{#cf222e}{\Huge{\mathbf{−}}}$​233 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​210

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:

  • giving agent tabs their auto-generated titles;
  • moving tabs when a phone or another paired device asks.

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.

  • Generated agent tab titles are given by main, from the agent status its own hook server receives. This works on the desktop, --serve and orcad, with or without a window.
    • It follows the window's rules: the title setting, custom and quick-command titles, the first title winning, and dispatch labels. Those rules move to src/shared, so both sides use the same code.
    • The window stops sending titles for tabs main holds. Tabs on a paired server, tabs main has no tab-bar entry for, and tabs in a workspace whose owner the window can't resolve are still titled by the window, as today.
    • Main subscribes to the titles when it attaches the hook server's status store (attachAgentStatusStore), so both entry points get it from one place.
  • Phone and paired-client tab moves are applied by main (main-layout-session-tab-move.ts). Main applies the move as its own layout command and does not ask the window: reorder becomes moveTab steps, a move to another group becomes moveTab, and a split becomes splitGroup. Main reads the client's move against the rows it was shown, through the existing old-client translation.
    • Bridge code (ledger L280): a move in a group that shows a tab main's layout doesn't hold (a diff or preview tab), or a move main can't read, goes through today's path (the window, or the headless move). It is removed once main's layout holds every tab a group shows.
  • moveTab takes an optional anchor, afterTabId (ledger L193): the tab to follow, or null for first. Main honours it when that tab is in the target group, and otherwise uses index as before. The window's reorder, drag-to-group and reopen-position moves send it.
    • On the wire it is an optional field. An older main ignores it and places by index.
    • Today no paired server receives it, because the window never sends layout.apply to 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:

  • Keep the window deriving titles and sending them to main. Rejected: it needs a window, so --serve, orcad and windowless hosts got no titles.
  • Refuse a move involving a tab main lacks. Rejected: it would break moves that work today (diff and preview tabs), so they keep today's path until main holds those tabs.

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-mark passes at head when run alone.
    • filesystem-watcher-real and remote-snapshot-alt-screen-host-chain fail 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/runtime and src/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 in orcad-forked-child-paths, which fail identically at base on macOS (a /private/var path 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.

    Spec Head 9cc295b Base 78bc1e5
    headless-serve-focused-terminal-create pass pass
    paired-mobile-desktop-tab-composition pass pass
    paired-desktop-server-layout-frames pass pass
    live-background-terminal-mount-authority pass pass

    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:

    • Titles: 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).
    • Moves: 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.
    • Anchor: 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:

  • moves in groups that show a tab main lacks;
  • titles for a twin workspace's tabs;
  • orcad's entry point going over its line limit.

Known, unchanged behaviour:

  • L281: a same-group move to a later shown index with no usable anchor lands one slot late, in both builds. After this PR, a phone's "move to group" within the same group can still hit it, because the anchor it computes is the moved tab itself, so main falls back to the index. Window moves send a correct anchor.
  • A reorder that needs several steps and is refused partway keeps the steps already applied. The window's own reorder replay behaves the same way.
  • On a switch-on headless host, a move that takes the L280 fallback updates the phone's rows and saved groups, not main's layout. This is the same as switch-on before this PR.

Agent skill upstream boundary

  • Not applicable.

Notes

  • Older peers: afterTabId is optional on the wire, and phones keep using session.tabs.move unchanged.
  • SSH: main reads a workspace's layout from the host the workspace is routed to, as its other session-tab writes do.
  • Compat boundary: the old-client move translation is now a listed compat entry, and main's move file is a listed importer in check-compat-boundary-imports.mjs, so deleting the folder still removes the path.

…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)
@coderabbitai

coderabbitai Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: ecabd295-9d00-4353-b12f-62448ece322c
📥 Commits

Reviewing files that changed from the base of the PR and between b8fdbb6 and 09241cf.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 82ca80cb-ce0a-4922-87c7-f9752059e00b
📥 Commits

Reviewing files that changed from the base of the PR and between 9cc295b and b8fdbb6.

📒 Files selected for processing: 1
  • config/scripts/check-import-boundaries.test.mjs

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.

📝 Walkthrough

The change adds main-process generated-title handling from enriched agent status. Renderer title routing uses shared title rules and does not send generated-title rename commands for main-owned workspaces. The change also adds optional afterTabId anchors to tab-move commands, applies anchors when calculating move positions, and updates renderer and old-client command producers. The main runtime can handle mobile session-tab moves through its workspace layout when ownership and tab coverage permit.

Priority: ➖ Normal

Merge Risk: ⚪ Minimal · up to b8fdb

The compatibility-boundary test now follows the configured old-client entries. This test-only change presents no actionable merge risk.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 26 functions across 48 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title describes the main changes: main-generated agent-tab titles, phone tab moves, and move anchors. It is long, but it is specific and relevant.
Description check Passed The description includes the required sections and explains the changes, rationale, testing, visual-proof exception, and compatibility considerations. Some checklist boxes remain unchecked, but the de…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description includes the required sections and explains the changes, rationale, testing, visual-proof exception, and compatibility considerations. Some checklist boxes remain unchecked, but the description is otherwise complete.

✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Jinwoo-H
Jinwoo-H merged commit 01db1b8 into main Oct 22, 2026
47 checks passed
Jinwoo-H added a commit that referenced this pull request Oct 22, 2026
… 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.
Jinwoo-H added a commit that referenced this pull request Oct 22, 2026
…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant