Repository navigation
feat(layout): send tab rename, color and pin through main behind the layout-owner build switch - #29301
Conversation
… through main behind ORCA_LAYOUT_OWNER A build made with ORCA_LAYOUT_OWNER=main registers layout.apply: main applies the window's layout command to the stored partition through the shared applyLayoutCommand, minting new ids. A user split then waits for main's answer and mounts the pane id main minted. Every other build substitutes 'window', so neither branch is compiled in.
A load-then-save rewrite also normalizes records the command never touched. The command's effect is now the diff between the save before and after it, written onto the stored partition record by record. A split whose main reply says a paired server holds the tab splits as today.
…d partitions reload to the command's result
…CA_LAYOUT_OWNER In a layout-owner build the window's pane close, title change and equalize go through layout.apply and the window shows main's answer. A window pane close keeps the legacy close's rules: the tab's last pane is refused, a pane restarted since main read the close is left alone, every partition holding the tab closes it, and the tab's remote session id follows the remaining pane. The rules sit behind a command field only layout.apply sets.
…ORCA_LAYOUT_OWNER Claude-Session: 10569c9a-a0a1-4fc9-8469-0edfb7aed125
Claude-Session: 10569c9a-a0a1-4fc9-8469-0edfb7aed125
…e drops main cannot take Claude-Session: 10569c9a-a0a1-4fc9-8469-0edfb7aed125
…oday Claude-Session: 10569c9a-a0a1-4fc9-8469-0edfb7aed125
…de-up profile state Claude-Session: 10569c9a-a0a1-4fc9-8469-0edfb7aed125
…row names a paired server The split switch point asked which host to route to with a helper that falls back to the focused server, so a focused server could claim a workspace whose row names no owner. Use the same owner test the tab mirror uses.
…yout/c1b-pane-ops # Conflicts: # src/renderer/src/components/terminal-pane/terminal-pane-split-through-layout-owner.test.ts # src/renderer/src/components/terminal-pane/terminal-pane-split-through-layout-owner.ts
…/c1b2-pane-gestures
…ed or failed splits and moves, ratios during a move, release guard - A pane main saved but the window could not mount (source pane or manager gone during the await) is closed again in main, so it does not come back on restart. - A split main refuses because its copy lacks the workspace, tab or pane, or a failed call, splits as today; a refused or failed move moves as today. - Divider ratios committed while a move is in flight wait for the window's move, then go to main. - The orcad bundle gets the ORCA_LAYOUT_OWNER define when the switch is on. - Packaging and the orcad template refuse ORCA_LAYOUT_OWNER=main and any output a dark build marked. - workspace-layout-record-patch.ts: no non-null assertions; plain comment for the map depth.
…throws, not just for splits - sendPaneCommandToLayoutOwner runs asToday for workspace/tab/pane_not_found and a thrown call, so close, rename and equalize fall back like split and move; a handler that throws no longer runs the fallback too. - A close main refuses as its last pane, while this window still has others, closes as today. - A move whose local step throws still releases held divider ratios. - Drop the orcad output marker: nothing read it; the template build refuses the switch itself.
# Conflicts: # src/main/persistence/loading-store/pty-binding-persistence.ts # src/main/persistence/terminal-topology/terminal-layout-apply.test.ts # src/main/persistence/terminal-topology/terminal-pane-admission.ts # src/main/runtime/orca-runtime.ts # src/main/runtime/rpc/methods/workspace-layout-apply.test.ts # src/renderer/src/components/terminal-pane/terminal-pane-split-with-inherited-cwd.test.ts # src/renderer/src/components/terminal-pane/terminal-pane-split-with-inherited-cwd.ts # src/shared/rpc-contract/workspace-layout-params.ts # src/shared/workspace-layout/workspace-layout-record-patch.test.ts # src/shared/workspace-layout/workspace-layout-record-patch.ts
… layout-owner files
…1b2-pane-gestures
…1c-dark-followups
…e checkout fixture
…layout-owner build switch In an ORCA_LAYOUT_OWNER=main build, the tab bar's rename, color and pin ask main's layout.apply first; the window then runs today's action. When main lacks the tab or the call fails the window acts as today; a paired server's workspace keeps today's path. Pinning a tab now also ends its preview in main's copy, as the tab bar's pin does. Other builds compile the switch out.
…in opens files Changing the shared pin command would change what a paired client's pin does in every build.
📝 Walkthrough
Priority: ➖ Normal Merge Risk: 🔵 Low · up to
|
Main moved the layout.apply sender to runtime/layout-owner-command.ts: the tab-bar rename and props commands join its WindowLayoutCommand, and the params reuse main's OnTab.
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:
f1213d2f-ea21-4e00-8135-cabfca81b357
📒 Files selected for processing: 4
src/main/runtime/rpc/methods/workspace-layout-apply.test.tssrc/renderer/src/components/tab-bar/tab-bar-layout-owner-props.tssrc/renderer/src/runtime/layout-owner-command.tssrc/shared/rpc-contract/workspace-layout-params.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review.
Main split the layout.apply command type into runtime/layout-apply-send.ts: the tab-bar rename and props commands join it there.
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:
ea862d6c-16d5-442a-b11b-56f7ff7851fd
📒 Files selected for processing: 4
src/main/runtime/rpc/methods/workspace-layout-apply.test.tssrc/renderer/src/components/tab-bar/tab-bar-layout-owner-props.tssrc/renderer/src/runtime/layout-apply-send.tssrc/shared/rpc-contract/workspace-layout-params.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
| type: z.literal('renameTab'), | ||
| ...OnTab, | ||
| kind: z.literal('custom'), | ||
| title: z.union([z.string(), z.null()]) |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
rg -n 'renameTab|customTitle|commitRename' src/shared/workspace-layout src/renderer/src/components/tab-bar src/shared/rpc-contract/workspace-layout-params.tsRepository: stablyai/orca
Length of output: 7269
🏁 Script executed:
set -o pipefail
printf '%s\n' '--- schema ---'
nl -ba src/shared/rpc-contract/workspace-layout-params.ts | sed -n '108,138p'
printf '%s\n' '--- layout owner props ---'
nl -ba src/renderer/src/components/tab-bar/tab-bar-layout-owner-props.ts | sed -n '1,90p'
printf '%s\n' '--- rename hook ---'
nl -ba src/renderer/src/components/tab-bar/use-sortable-tab-rename.ts | sed -n '1,115p'
printf '%s\n' '--- command implementation ---'
nl -ba src/shared/workspace-layout/workspace-layout-tab-commands.ts | sed -n '140,182p'
printf '%s\n' '--- command consumer ---'
nl -ba src/shared/workspace-layout/workspace-layout-commands.ts | sed -n '65,100p'
printf '%s\n' '--- relevant tests ---'
nl -ba src/shared/workspace-layout/workspace-layout-commands.test.ts | sed -n '105,155p'
nl -ba src/renderer/src/components/tab-bar/tab-bar-layout-owner-props.test.ts | sed -n '1,100p'
printf '%s\n' '--- all direct rename tests ---'
rg -n -F -- 'type: '\''renameTab'\''' src/shared src/rendererRepository: stablyai/orca
Length of output: 18958
🏁 Script executed:
set -o pipefail
printf '%s\n' '--- layout apply send and command types ---'
nl -ba src/renderer/src/runtime/layout-apply-send.ts | sed -n '1,90p'
printf '%s\n' '--- layout apply registrations and handlers ---'
rg -n -F -- 'layout.apply' src | head -80
printf '%s\n' '--- frame tab props tests ---'
nl -ba src/renderer/src/runtime/workspace-layout-frame-tab-props.test.ts | sed -n '90,175p'
printf '%s\n' '--- layout apply schema/handler contexts ---'
rg -n -F -e 'LayoutApplyParams' -e 'WindowLayoutCommand' -e 'applyLayout' src/shared src/main src/renderer 2>/dev/null | head -120Repository: stablyai/orca
Length of output: 28571
🏁 Script executed:
set -o pipefail
printf '%s\n' '--- RPC method ---'
nl -ba src/main/runtime/rpc/methods/workspace-layout.ts | sed -n '65,112p'
printf '%s\n' '--- runtime layout apply ---'
nl -ba src/main/runtime/runtime-layout-apply.ts | sed -n '1,75p'
printf '%s\n' '--- topology application ---'
nl -ba src/main/persistence/terminal-topology/terminal-topology-commit.ts | sed -n '95,145p'
printf '%s\n' '--- command persistence ---'
nl -ba src/main/persistence/terminal-topology/layout-command-persistence.ts | sed -n '1,75p'
printf '%s\n' '--- renderer display ---'
nl -ba src/renderer/src/components/tab-bar/SortableTab.tsx | sed -n '120,145p'Repository: stablyai/orca
Length of output: 10089
🏁 Script executed:
set -o pipefail
printf '%s\n' '--- tab command helpers and rename owner ---'
nl -ba src/shared/workspace-layout/workspace-layout-tab-commands.ts | sed -n '1,75p'
nl -ba src/shared/workspace-layout/workspace-layout-tab-commands.ts | sed -n '150,176p'
printf '%s\n' '--- command result helpers ---'
nl -ba src/shared/workspace-layout/workspace-layout-command-types.ts | sed -n '1,65p'
printf '%s\n' '--- commit layout command ---'
rg -n -F -- 'function commitLayoutCommand' src/main/persistence/terminal-topology
nl -ba src/main/persistence/terminal-topology/terminal-topology-commit.ts | sed -n '1,95p'Repository: stablyai/orca
Length of output: 11499
Normalize custom titles in the shared renameTab consumer.
layout.apply accepts empty and whitespace-only strings. The shared consumer stores them as customTitle, and the renderer then displays that value instead of the fallback title. The UI rename path already converts blank input to null, but direct layout.apply callers are not protected.
Normalize custom titles in renameTab, where the current tab is available. Keep null as the clear operation and make trimmed-empty titles a no-op. Schema-only handling cannot implement this state-preserving no-op.
Suggested fix
if (command.kind === 'aiVault') {
return updateTab(model, command.workspace, { ...tab, aiVaultTitle: command.title })
}
+ if (command.kind === 'custom') {
+ const title = command.title === null ? null : command.title.trim()
+ if (title === '') {
+ return applied(model)
+ }
+ return updateTab(model, command.workspace, { ...tab, customTitle: title })
+ }
return updateTab(
model,
command.workspace,
- command.kind === 'custom'
- ? { ...tab, customTitle: command.title }
- : { ...tab, generatedTitle: command.title }
+ { ...tab, generatedTitle: command.title }
)Add command tests for '' and whitespace-only titles that assert the existing customTitle remains unchanged.
ELI5
Today the window keeps its own copy of every workspace's tabs and saves it. The plan is for the app's background process to own that layout and for the window to draw it. This PR moves three tab properties onto that path: renaming a tab, coloring it, and pinning it. It only does so in a special internal build. Normal builds are unchanged.
What Changed
ORCA_LAYOUT_OWNER=main: the tab bar's rename, color and pin first ask the background process (the darklayout.applycommand). After it accepts, the window runs its usual action, so the tab looks exactly as it does today.use-tab-bar-item-actions.tswraps the strip's three actions withtab-bar-layout-owner-props.ts. It addresses the background process by the tab's tab-bar id: a terminal is matched by its terminal's id, a chat by its own id.layout.applynow acceptsrenameTab(custom title only) andsetTabProps(color, pin). It is still registered only in this build.Why
pinTab,setTabColor,setTabCustomTitle) themselves. Rejected because they also run right after tab creation, and in requests the background process sends to the window. Those belong to the tab-creation step (C3), where the create command already carries a title and color.Linked Issue
Part of the single-copy terminal layout refactor (dark phase C, step C6). Stacked on #29207 (needs its fallback rule); also merges origin/main for the layout updates (#29221).
Visual Proof
N/A in normal builds (no change). Internal build: after renaming the second tab to "Build", coloring it blue and pinning it, the tab shows pinned first with its blue dot. After a restart it is the same.
Testing
Round trip through layout updates (
workspace-layout-frame-tab-props.test.ts, 10 cases): rename, clear a title, rename a chat, color, clear a color, pin within each group, unpin, pin a browser tab, pin a preview file. For each case:Unit tests:
layout.applyaccepts these two commands, rejects other title kinds and bad values, and drops other properties.Normal-build bundle comparison (unminified, base = this branch's parent):
layout.applyparameter schemas, which are never registered.Hidden real app, internal build (
ORCA_BACKGROUND_LAUNCH=1, Playwright over CDP; scratch spec, not committed). Through the UI: double-click rename, color from the context menu, pin from the context menu.layout.applyand each was accepted.Layout oracle, internal build: 21/21 passed.
Affected suites: 904 files, 8,527 tests. Typecheck passes, and so do the changed-code quality gate, anti-slop, type-aware lint, layout-writer, focus-read and max-lines ratchets, and the parameter catalog check. macOS only.
I manually tested these changes locally
Automated tests added/updated, or explained why not below
Review
Independent review: merge as is.
Agent skill upstream boundary
Notes
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)