Skip to content

feat(layout): send tab rename, color and pin through main behind the layout-owner build switch - #29301

Merged
Jinwoo-H merged 34 commits into
mainfrom
layout/c6-tab-props
Oct 16, 2026
Merged

Jinwoo-H merged 34 commits into
mainfrom
layout/c6-tab-props

Conversation

@Jinwoo-H

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

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​393 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​393
Prod 4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​77 $\color{#cf222e}{\Huge{\mathbf{−}}}$​2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​75

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

  • Normal builds: no change. The new branch is compiled out (see Testing for the bundle comparison).
  • Builds made with ORCA_LAYOUT_OWNER=main: the tab bar's rename, color and pin first ask the background process (the dark layout.apply command). After it accepts, the window runs its usual action, so the tab looks exactly as it does today.
    • Same fallback as the pane commands: if the background process doesn't have the workspace or tab yet (for example, a tab created a moment ago), or the call fails, the window acts as it does today.
    • Paired-server workspaces keep today's path.
    • This covers every tab bar: the main strip, split groups, and the floating terminal panel.
  • How:
    • One switch point in use-tab-bar-item-actions.ts wraps the strip's three actions with tab-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.apply now accepts renameTab (custom title only) and setTabProps (color, pin). It is still registered only in this build.

Why

  • Low risk: the background process's shared commands already apply these properties. Pinning moves the tab to the end of the pinned group, the same rule the tab bar uses.
  • Background process first, then the window's own action: this follows the pane commands already on this path. The window still saves its whole layout in this phase, so it must hold the same values; doing the action again is a no-op when a layout update has already shown the change.
  • Preview tabs stay the window's for now: pinning a preview file ends its preview in the window, as today. Changing the shared pin command to do this too would also change what a paired phone's pin does in every build. Main gets the preview change in its copy from the window's save. This moves when file opening goes through the background process (C4).
  • Alternative considered: switching the store actions (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:

    • The window draws the background process's update.
    • The window's own action then runs, leaving the tab as today's action would.
    • A restart from the background process's saved copy shows the same thing, except the preview mark (see Why).
    • Two differences from today are written into the test, and both are fixes:
      • Clearing a custom title on a terminal that has no live title yet shows its default title, where today it shows the old name.
      • Today's unpin misses the terminal record of a tab whose two ids differ.
  • Unit tests:

    • The commands sent, by tab-bar id.
    • Fallback when the tab is missing or the call fails, and no change on any other refusal.
    • Paired-server workspaces and unknown tabs take today's path at once.
    • layout.apply accepts these two commands, rejects other title kinds and bad values, and drops other properties.
  • Normal-build bundle comparison (unminified, base = this branch's parent):

    • main: only the two new layout.apply parameter schemas, which are never registered.
    • renderer: one function that is never called (the existing sender, kept by the bundler).
    • orcad: the same schemas, plus the server hash its launcher embeds.
  • 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.

    • All three reached layout.apply and each was accepted.
    • The tab was pinned first, blue and titled "Build", and stayed that way after a restart.
  • 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.

  • Not fixed: two pin clicks within one round trip (about a millisecond) both send the same value. This is the same as every command on this path. Sequence numbers in phase E close it.
  • Deferred: generalizing the sender's name now that it carries tab commands.

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

  • SSH: the background process applies to the partition that holds the tab.
  • Folder workspaces: no git assumptions.
  • Paired servers: today's path.
  • Mobile: no change.
  • Normal builds: no change.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

… 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.
…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
…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 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.
@Jinwoo-H
Jinwoo-H changed the base branch from layout/c1c-dark-followups to main October 16, 2026 03:28
@coderabbitai

coderabbitai Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

📝 Walkthrough

The layout command contract now accepts custom-tab rename commands and tab-property updates for color and pinned state. When the layout owner is main, tab-bar actions wrap rename, color, and pin operations with layout-owner commands. Tests cover command parsing, tab targeting, fallback behavior, and comparisons between main-applied state and window actions.

Priority: ➖ Normal

Merge Risk: 🔵 Low · up to 31b98

Direct layout commands can replace a tab’s displayed title with a blank value. Fix blank-title handling in the shared command before merging, or accept this bounded issue as a follow-up.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 58.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 12 functions across 10 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 clearly and concisely describes the main change: routing tab rename, color, and pin actions through main behind the layout-owner build switch.
Description check Passed The description is complete and detailed. It covers the user impact, implementation, rationale, linked issues, testing, known limitations, platform considerations, and checklist status.
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.
  • Fix all pre-merge checks with AI
✨ 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.

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: f1213d2f-ea21-4e00-8135-cabfca81b357
📥 Commits

Reviewing files that changed from the base of the PR and between d1d71ce and 6cf2c31.

📒 Files selected for processing: 4
  • src/main/runtime/rpc/methods/workspace-layout-apply.test.ts
  • src/renderer/src/components/tab-bar/tab-bar-layout-owner-props.ts
  • src/renderer/src/runtime/layout-owner-command.ts
  • src/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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: ea862d6c-16d5-442a-b11b-56f7ff7851fd
📥 Commits

Reviewing files that changed from the base of the PR and between 6cf2c31 and 31b982b.

📒 Files selected for processing: 4
  • src/main/runtime/rpc/methods/workspace-layout-apply.test.ts
  • src/renderer/src/components/tab-bar/tab-bar-layout-owner-props.ts
  • src/renderer/src/runtime/layout-apply-send.ts
  • src/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()])

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 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.ts

Repository: 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/renderer

Repository: 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 -120

Repository: 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.

Jinwoo-H added a commit that referenced this pull request Oct 16, 2026
@Jinwoo-H
Jinwoo-H merged commit 4d3e3c8 into main Oct 16, 2026
93 of 97 checks passed
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