Skip to content

The window shows tab, title, move and divider changes only from main's update, never drawing them itself (dark, layout-owner build only) - #31257

Merged
Jinwoo-H merged 37 commits into
mainfrom
e2-6/e2b-frame-bridges-removed
Oct 21, 2026
Merged

Jinwoo-H merged 37 commits into
mainfrom
e2-6/e2b-frame-bridges-removed

Conversation

@Jinwoo-H

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

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 32 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1790 $\color{#cf222e}{\Huge{\mathbf{−}}}$​307 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1483
Prod 29 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​733 $\color{#cf222e}{\Huge{\mathbf{−}}}$​277 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​456

ELI5

In the layout-owner build, the window used to draw some of its own changes twice: once itself, and again when main's update arrived. Tab renames, colors, pins, view mode, pane titles, tab moves and divider drags all worked like that. Now the window asks main and draws only what main sends back, so there is one copy of the truth. Divider drags send just the ratios that moved, and main refuses a drag aimed at a divider that has since changed, instead of moving the wrong one.

What Changed

Users see nothing different in shipped builds (the switch is off). With the switch on:

  • Tab and pane edits come only from main's update (L178, L99). Rename, color, pin and view mode, and pane titles: the window sends the change and draws main's answer. It keeps only side effects that draw nothing (feature interaction, telemetry, ending a pinned preview).
  • Tab moves come only from main's update (L115, L116, L118). The window no longer re-applies the move or adopts main's new group id.
  • Selecting a moved tab (L120). The moved tab is selected by the same store update that shows the move. A newer drag, or any selection the user makes after the drop, cancels it. Before, main's answer selected the tab later and could undo a second drag's selection.
  • Divider ratios (L106, L102, L117). A drag sends ratios: [{path, ratio, split}] instead of the whole tree.
    • Each ratio names the split it means: its direction plus the first pane or group on each side. Main refuses a mismatch, and the window redraws main's ratios.
    • Drag end always sends the dragged split, so dragging back before main answers is not lost.
    • The params still accept the old whole-tree form.
  • No local drawing while main's stream is down. shownByFrames is deleted. The local stream reconnects within 1 to 30 s, and its snapshot redraws every workspace. The older local draws for split, close and create (L173) are untouched.
  • First generated title wins, enforced by main. A generated rename keeps an existing generated title unless it carries the new optional replaceExisting. Before, a second agent prompt made during a stream outage could overwrite the first title.

Owner-visible (switch on only):

  • Row 17: while main's local stream is down, a rename, color, pin, view mode change, pane title, in-tab pane move, tab move or generated title shows when the stream reconnects (1 to 30 s), not at once.
  • Row 20: a divider drag made while a pane move is still being answered is dropped, and main's update redraws the ratios. A drag main refuses (the tree changed under it) visibly snaps back to main's ratio.
  • A moved tab is selected only if you have not selected something else since the drop.

Left for later tracks (not deleted here):

  • withMainTerminalFacts (L184) needs D1's main-first creates.
  • "a reply's frame counts as in" (L112) goes with the drawn-tab hold (L111).

Why

These were the window-side copies of decisions main already makes. Each copy is a second writer that can disagree with main, and that is where the switch-on bugs came from. The alternatives were keeping the local draws behind a "stream is down" check, or keeping the window's whole-tree ratio form. Both keep a second writer; the first also fights main's answer when the stream returns.

Compatibility: layout.apply goes only from a window to its own main, which is the same build, and a paired server's workspaces are answered host_not_owned. The new ratios, split and replaceExisting fields are optional, the old ratio forms are still accepted, and an older host's schema strips unknown fields.

Linked Issue

N/A (layout-owner plan, step E2b; follows #31152).

Visual Proof

N/A: dark change; the switch is off in shipped builds and the switch-off bundle has no behaviour change (below).

Testing

  • Automated tests added/updated. Each new behaviour test fails on the parent and passes here:
    • window writes counted at zero for tab props, pane titles and tab moves;
    • the stream-outage test (changes show only from the reconnect snapshot, the moved tab is selected, and the first generated title survives a second prompt);
    • a second drag keeps its selection when the first drag's answer arrives;
    • a mismatched ratio is refused and snaps back without moving another split;
    • dragging a divider back before main answers ends at the second value;
    • main keeps the first generated title unless replaceExisting is set.
  • Converted, not deleted: the switch-on tests for SortableTabContextMenu, tab-move-to-pane-column and useTabDragSplit now check the same behaviour through main's command and update, with no switch mock. Others converted: tab props, held tabs, recently closed tabs, view mode, title persistence, title batches.
  • The window's test-only apply check now also checks the moved tab's selection.
  • Switch-off bundle: an unminified diff against main shows only code reachable with the switch on, two refactors that behave the same (launchAgentOf extraction, changePaneTitle reordering that keeps the same order of effects), import-alias renames and commit stamps.
  • Gates: ci-static-gate (every static-analysis step in pr.yml) passes. The switch-on main runtime and persistence tests have the same failures at this head and at the merge base.
  • Switch-on failures in the touched test set that also fail on main and belong to other tracks: agent-generated-tab-title ×8 and worktree-agent-activation-seam (D2/D1b), useIpcEvents-terminal-create-surfacing and launch-agent-background-session (D1b), browser-cleanup-close (D3b), tabs-unread-and-focus (D3a-2), old-client-session-tabs-projection (A2), workspace-layout-views (B2), orca-runtime ×3 (two fail with the switch off too, a macOS path; one is D1b's), and pty-connection-restore-and-resume ×5 plus pty-connection-visibility-and-exit ×3 (from D1a; D1b-1).

Review

One independent review, then two reviews of the fixes.

  • The first found five issues, all fixed: ratio intents could land on a different divider after the tree changed; a tab moved during an outage was not selected; generated titles were written twice; dragging a divider back was lost; and some tests were too weak.
  • The second found three more, all fixed: the apply check flagged the new selection; a second generated title could overwrite the first during an outage (now enforced by main); and a switch-on early return skipped label checks.
  • The third was clean.

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

Remote and SSH: paired-server workspaces keep today's path (guard test passes). Folder workspaces use the same commands.

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)

E2E Test and others added 30 commits October 20, 2026 10:17
…reading its session back (dark, layout-owner build only)

A records frame no longer re-serializes the window's whole session and runs the
Loader. Panes' terminal bindings and live titles apply alone, to the tabs the
frame names; any other record builds only its own workspace's slices, with the
view and facts read from the store. Only a workspace the store does not show
from frames yet (startup, a reopened stream, a first visit, one sent whole)
takes the full build.

Tests install an apply check that, after every flush, compares the store with
the full build for the same cache and pre-flush store; the shared layout-apply
transport now sends main's records frames and fails a flush that differs.
…ack or running the Loader (test, layout-owner build only)
…ing generations, so it passes with the switch on (test only)
…ave's own writers, as the full build does (dark, layout-owner build only)
… builds one in full, and the shared transport keeps a test's own check (test only)
…ld, and the shared transport restores only the check it installed (test only)
…lies it or adopts main's group id (dark, layout-owner build only)

On main's answer the window only selects the moved tab in its new group, a view choice the
frame does not carry. While main's stream is down it still moves the tab itself, as the frame
sync's closed-stream rule says, but under its own group id: the reopened stream's snapshot
redraws main's copy.

The three switch-on census files for tab moves now pass without a switch mock: the context
menu's move routes to the tab bar's move, the drag hook's pane-column split goes to main in a
layout-owner build, and the tab bar's own move is pinned on a paired server's workspace. A new
frame test pins each move through main and its frame.
…frame alone; the window no longer applies them again (dark, layout-owner build only)
… and an in-tab pane move shows from main's frame; the ratio hold is gone (dark, layout-owner build only)
…s-removed

# Conflicts:
#	src/renderer/src/runtime/workspace-layout-frame-pending.ts
#	src/renderer/src/runtime/workspace-layout-frame-tab-props.test.ts
…while main's stream is down the reconnect's snapshot shows them (dark, layout-owner build only)
…s the user selected since; main's answer no longer selects it (L120, dark, layout-owner build only)
…ow writes only titles left to it as today, and the rename test checks the phone graph republishes (dark, layout-owner build only)
…hat path holds another, so the window snaps back to main's ratios; a drag back to main's ratio before it answers is sent too (dark, layout-owner build only)
…he tab-move tests exit clean and a wrong selection still fails (dark, layout-owner build only)
…tle replaces it, so a second prompt while main's stream is down no longer renames the tab (dark, layout-owner build only)
…s-removed

# Conflicts:
#	src/renderer/src/store/terminals/terminal-tab-layout-owner-actions.ts
#	src/shared/rpc-contract/workspace-layout-params.ts
@coderabbitai

coderabbitai Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

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: b917c996-6871-46c0-8f41-e6bd8d9ff67b
📥 Commits

Reviewing files that changed from the base of the PR and between 88ed006 and 6a83be9.

📒 Files selected for processing: 1
  • src/renderer/src/hooks/ipc-events/terminal-presentation-pane-title.test.ts

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

📝 Walkthrough

The changes add path-based divider-ratio commands and update pane and group layout handling to use them. Tab moves and selections are synchronized through main-owned layout frames. Tab and pane updates use callbacks that distinguish displayed changes, local fallbacks, and refusals. Generated-title renames can request replacement, and renderer tests now cover main-owned frame behavior alongside window-owned behavior.

Priority: ⬇️ Low

Merge Risk: 🔵 Low · up to 6a83b

Reordering a newly created floating tab may fail briefly; retrying after the session write should work. This is a bounded switch-on risk to address or explicitly accept before merging.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 64.62% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 65 functions across 51 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 describes the primary change: the layout-owner window renders tab, title, move, and divider updates only from main.
Description check Passed The description is detailed and covers the required sections, user impact, rationale, compatibility, testing, review findings, and checklist. It explains why visual proof is N/A. The Linked Issue sect…
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 is detailed and covers the required sections, user impact, rationale, compatibility, testing, review findings, and checklist. It explains why visual proof is N/A. The Linked Issue section references #31152 but does not provide an actual issue link as requested by the template.

✨ 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.

@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.

🧹 Nitpick comments: 1
src/renderer/src/components/floating-terminal/floating-workspace-tab-reorder.test.ts: 1

115-125: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Assert the frame result for the floating workspace.

getFloatingWorkspaceOperationRoute maps FLOATING_TERMINAL_WORKTREE_ID to the local host, and sendLayoutApply sends the command to main. The apply path in dropTabThroughLayoutOwner relies on main’s frame instead of changing local order. This test only checks that moveTab was sent, so it can pass without detecting a missing floating-workspace frame. Add a frame-backed order assertion for this workspace.


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d05e1659-bb57-4923-9a85-122400657b09
📥 Commits

Reviewing files that changed from the base of the PR and between ebc8b06 and 1a072d8.

📒 Files selected for processing: 60
  • config/renderer-layout-writer-baseline.txt
  • src/main/persistence/terminal-topology/terminal-layout-rename-tabs.test.ts
  • src/main/runtime/rpc/methods/workspace-layout-apply.test.ts
  • src/renderer/src/components/floating-terminal/floating-workspace-tab-reorder.test.ts
  • src/renderer/src/components/tab-bar/SortableTabContextMenu.test.tsx
  • src/renderer/src/components/tab-bar/TabBar.context-menu.test.ts
  • src/renderer/src/components/tab-bar/tab-bar-layout-owner-props.test.ts
  • src/renderer/src/components/tab-bar/tab-bar-layout-owner-props.ts
  • src/renderer/src/components/tab-bar/tab-move-to-pane-column.test.ts
  • src/renderer/src/components/tab-group/tab-group-layout-owner-commands.test.ts
  • src/renderer/src/components/tab-group/tab-group-layout-owner-commands.ts
  • src/renderer/src/components/tab-group/tab-moves-drawn-from-frames.test.ts
  • src/renderer/src/components/tab-group/useTabDragSplit.test.ts
  • src/renderer/src/components/terminal-pane/terminal-layout-title-persist.test.tsx
  • src/renderer/src/components/terminal-pane/terminal-pane-layout-owner-gestures.test.ts
  • src/renderer/src/components/terminal-pane/terminal-pane-layout-owner-gestures.ts
  • src/renderer/src/components/terminal-pane/use-host-pane-title-sync.test.ts
  • src/renderer/src/components/terminal-pane/use-host-pane-title-sync.ts
  • src/renderer/src/components/terminal-pane/use-terminal-pane-layout-persistence.ts
  • src/renderer/src/hooks/ipc-events/terminal-pane-title-ipc-bridge.ts
  • src/renderer/src/hooks/useIpcEvents-agent-status-snapshot-hydration.test.ts
  • src/renderer/src/lib/launch-agent-background-session-launch-parity.test.ts
  • src/renderer/src/lib/worktree-creation-background-mount.test.ts
  • src/renderer/src/runtime/divider-ratio-refusal.test.ts
  • src/renderer/src/runtime/generated-tab-titles-send.ts
  • src/renderer/src/runtime/layout-apply-send.test.ts
  • src/renderer/src/runtime/layout-apply-send.ts
  • src/renderer/src/runtime/layout-changes-during-stream-outage.test.ts
  • src/renderer/src/runtime/layout-owner-pane-intents.ts
  • src/renderer/src/runtime/pane-titles-drawn-from-frames.test.ts
  • src/renderer/src/runtime/workspace-layout-frame-apply-check.test-fixture.ts
  • src/renderer/src/runtime/workspace-layout-frame-apply-observer.ts
  • src/renderer/src/runtime/workspace-layout-frame-held-tabs.test.ts
  • src/renderer/src/runtime/workspace-layout-frame-operations.test.ts
  • src/renderer/src/runtime/workspace-layout-frame-sync.ts
  • src/renderer/src/runtime/workspace-layout-frame-tab-props.test.ts
  • src/renderer/src/store/slices/agent-status-batch.test.ts
  • src/renderer/src/store/slices/recently-closed-tabs.test.ts
  • src/renderer/src/store/slices/store-terminal-tab-changes-layout-owner.test.ts
  • src/renderer/src/store/slices/tab-view-mode.test.ts
  • src/renderer/src/store/slices/tabs/moved-tab-selection.ts
  • src/renderer/src/store/slices/tabs/tabs-drop-actions.ts
  • src/renderer/src/store/slices/tabs/tabs-focus-actions.ts
  • src/renderer/src/store/slices/tabs/tabs-label-actions.ts
  • src/renderer/src/store/slices/tabs/tabs-slice-contract.ts
  • src/renderer/src/store/slices/terminal-tab-title-batch.test.ts
  • src/renderer/src/store/terminals/structured-chat-tab-rename.test.ts
  • src/renderer/src/store/terminals/tab-change-through-layout-owner.ts
  • src/renderer/src/store/terminals/terminal-tab-layout-owner-actions.ts
  • src/shared/rpc-contract/workspace-layout-params.ts
  • src/shared/rpc-contract/workspace-layout-ratio-params.ts
  • src/shared/rpc-contract/workspace-layout-rename-tabs-params.ts
  • src/shared/workspace-layout/split-ratio-intents.ts
  • src/shared/workspace-layout/workspace-layout-command-types.ts
  • src/shared/workspace-layout/workspace-layout-commands.test.ts
  • src/shared/workspace-layout/workspace-layout-commands.ts
  • src/shared/workspace-layout/workspace-layout-group-commands.ts
  • src/shared/workspace-layout/workspace-layout-pane-commands.ts
  • src/shared/workspace-layout/workspace-layout-ratio-commands.test.ts
  • src/shared/workspace-layout/workspace-layout-tab-commands.ts
💤 Files with no reviewable changes: 2
  • src/shared/workspace-layout/workspace-layout-commands.test.ts
  • src/renderer/src/store/slices/tabs/tabs-slice-contract.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.

…'s frame, not its reply (dark, layout-owner build only)
@Jinwoo-H
Jinwoo-H merged commit 70b2197 into main Oct 21, 2026
54 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