Skip to content

Main owns the terminal and tab layout in shipped builds - #30861

Open
Jinwoo-H wants to merge 6 commits into
mainfrom
e2-6/layout-owner-flip
Open

Jinwoo-H wants to merge 6 commits into
mainfrom
e2-6/layout-owner-flip

Conversation

@Jinwoo-H

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

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 128 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​628 $\color{#cf222e}{\Huge{\mathbf{−}}}$​113 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​515
Prod 8 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​132 $\color{#cf222e}{\Huge{\mathbf{−}}}$​62 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​70

ELI5

Until now, every tab, split and pane you saw was decided by the app window, and the background part of the app (main) only copied it. For months we built a second way where main decides the layout and the window just draws it, hidden behind a build switch that was off in every release. This PR turns that switch on for shipped desktop builds. Nothing is deleted: the old path stays compiled into a separate rollback build until a later cleanup.

What Changed

Before: released desktop builds used the old path (the window owns the layout). The new path was only in special test builds made with ORCA_LAYOUT_OWNER=main.

After: released desktop builds use the new path. To users this looks the same as today, with these differences, all already reviewed and approved by the owner:

  • After a forced quit, an agent that resumes in place shows 1 tab instead of 2.
  • A preview tab you clicked to keep stays kept after a relaunch (today it turns back into a preview).
  • New command line and reply messages (listed below).

Mechanism:

  • config/dark-build-switches.cjs: ORCA_LAYOUT_OWNER is now "shipped on" for the desktop app. With no variable, main and its window both compile the new path; ORCA_LAYOUT_OWNER=window builds the rollback variant, which leaves out/main/ORCA_LAYOUT_OWNER_WINDOW. Packaging refuses both the variable and the marker, so the rollback variant cannot ship by accident. Any other value is now an error, so a typo cannot silently build something else. There is no marker and no refusal for the default.
  • What stays off, unchanged: the orcad server and its template (paired servers and managed SSH workspaces stay mirrored, as A paired server's workspace never gets main's layout commands: a pinning test (dark, layout-owner build only) #30430 pins), the phone page bundle (it reads no layout switch), the command line tool, and the pnpm build:web dev client. ORCA_SIDEBAR_INPUTS stays dark and byte-identical. The shipped web client is a copy of the desktop renderer, so it gets the new path as before in switch-on builds.
  • Every if (ORCA_LAYOUT_OWNER_IS_MAIN) branch stays. The later cleanup deletes the old path and the switch.
  • Unit tests compile the shipped value. Every unit test file that failed with the new default was classified (table in the review notes): 104 keep an explicit switch-off mock, each with a comment naming the switch-on test that covers the same behaviour; 16 now run on the new path after test-setup fixes or a per-test reset; 10 show a real difference on the new path and are left failing on purpose until their fixes land (listed under Testing).
  • End-to-end tests that need main to own the layout used to skip unless a marker file existed; after this change that marker never exists, so they would have skipped silently. They now run unless the build left the rollback marker (tests/e2e/helpers/layout-owner-build.ts), and a unit test checks that no spec still reads a marker and that the general lane runs them.
  • CI: the manual layout-owner workflow (layout-owner-e2e.yml, dispatch only since Stop running the experimental layout suite on every matching PR #30907) now builds the rollback variant (ORCA_LAYOUT_OWNER=window), checks its marker and runs the layout spec set, so the build a rollback would ship can still be proven. Required checks and verify are unchanged. layout_owner: main in e2e.yml remains available to record save-divergence reports on the shipped build.
  • After the flip, the window rollback build leg should run only nightly, or only on PRs that change the switch or packaging files, never broadly.

Why

The new path has been running in switch-on test builds, in CI on every layout PR, and in a full local comparison, with no switch-caused regressions left open. Flipping the default with every branch kept is the smallest step: one line decides which path ships, and the old path is still built and tested.

Alternatives considered:

  • Deleting the old path in the same PR: it would make a rollback a large revert. That is the later cleanup.
  • A runtime setting or remote kill switch: it would mean shipping and testing both paths in one build. The owner approved release-only rollback.

Rollback: release only. Revert the default line in config/dark-build-switches.cjs (the rollback build in CI is exactly that code) and ship a patch release through auto-update. Packaging refuses ORCA_LAYOUT_OWNER=window on purpose, so the rollback is a code change, not a build flag.

Downgrade safety: the saved session format does not change. Main writes only the records a change touched, in the existing shape, and resume records have the same shape whichever side writes them. Fields only main knows are dropped by the old window's first full save, which loses bookkeeping, not tabs. A probe (below) opened a profile written by this build with the rollback build.

Linked Issue

Layout-owner refactor, phase E2 flip (internal plan).

Visual Proof

N/A for new UI: no screen changes beyond the two approved differences above. Hidden-window screenshots from the downgrade probe are listed under Testing.

Testing

Downgrade probe (flip-plan step 10), hidden windows, fresh isolated profile: on this build I did new tab, open file, rename, split, divider resize, equalize, pane title, close pane, close a tab's last pane, drag a pane out to a new tab, move a tab to another group, pin (through the tab menu), and quit with two split tabs, a pinned tab, an editor tab, a chat tab and two agent resume records. Then I relaunched once on this build and opened the same profile with the rollback build. Verdict: PASS. Tabs (ids, order, titles, pin), both groups, every pane tree (directions, the 0.657 ratio, the pane title), both editor tabs, the chat tab and the resume records loaded in the rollback build as this build wrote them; each resume record resumed when its tab was shown; no duplicate terminals and no duplicate "Terminal 1". No field the plan expected to lose was lost.

Latency, this commit, flip build vs rollback build, one hidden app each, interleaved, 90 measured samples per action per build (5 warm-ups dropped), after load stayed under 6 for 120 s; one-minute load during samples 4.0 to 4.7:

Action Flip p50 Rollback p50 Flip p95 Rollback p95 Limit
New terminal tab, drawn 27.9 ms 27.9 ms 32.1 ms 31.9 ms p95 under 50 ms: pass
Open file, drawn 57.6 ms 56.3 ms 61.8 ms 62.6 ms p95 under 50 ms: fails on both (existing baseline)
Rename tab, store updated 4.9 ms 5.6 ms 5.5 ms 6.3 ms p50 (was 20 vs 8): pass
Rename tab, label drawn 9.2 ms 7.6 ms 10.6 ms 8.9 ms

Full local end-to-end run of the rollback build (every spec except 20 visible-window files that only run in CI), two workers: 869 passed, 47 failed, 158 skipped, 5 did not run. 41 of the 47 also fail on both builds in the earlier full comparison (existing failures). The other 6 passed on one rerun (flaky). No failure is caused by the switch and none is a visible change. The 4 specs that need main to own the layout skipped in the rollback build and all 7 of their tests ran and passed on this build.

Bundle check (unminified): this build's main, preload and renderer output equals a ORCA_LAYOUT_OWNER=main build of the base commit except the build commit stamp and the old ORCA_LAYOUT_OWNER_MAIN marker file, which is gone. The rollback build equals a default build of the base commit (today's release) except the stamp and the new ORCA_LAYOUT_OWNER_WINDOW marker. orcad's build defines are identical at base and head for no variable, window and main.

Gates: pnpm tc, check:code-quality:changed, layout-writer, focus-read and max-lines ratchets, the anti-slop lint: pass. Full unit suite: the only failures are ones that also fail on the base commit on this machine (shell, browser and packaging environment), one test that fails on main without this PR (codex-structured-dispatch-boundary, from #30403), and the item below.

Not yet green, on purpose: these unit test files show a real difference on the new path and keep failing until their fixes land (the pane-close widening found earlier is fixed by #30920, merged here):

  • generated tab titles sent to main one by one (agent-status-batch, terminal-tab-title-batch, useIpcEvents-agent-status-snapshot-hydration);

  • a floating-tab poll that reads the whole repo list (runtime-headless-publication-contracts, orca-runtime);

  • a dragged-out pane with no running terminal loses its folder (terminal-pane-tab-detach);

  • an empty extra tab for a saved terminal row with no tab entry (startup-window-parity, possibly intended);

  • an older session whose terminal id is stored only on the tab does not reattach (store-session-terminal-reconnect);

  • an SSH relay terminal not visited in one run cannot reattach after the next restart (restored-relay-session-identity);

  • a chat closed while its create is in flight keeps a stale reader (structured-agent-session-launch-create-message).

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

New user-visible strings

No new UI copy (no toasts, dialogs, labels or translation keys). Command line and reply text that reaches users, approved by the owner:

  1. split_pane_closed: orca terminal split error and --json output when the new pane was closed before it started (old path: "Timed out waiting for split pane handle").
  2. split_not_written: <reason>: same place, when main refused to write the split.
  3. split_pane_not_started: the new pane's terminal did not start within 10 s, so the pane was closed and its command was not run (without a startup command it ends at "so the pane was closed"). Replaces the timeout text only when nothing had started; a start in progress keeps today's "Timed out waiting for split pane handle".
  4. The chat was closed before it was created.: the reply to a chat create that a close overtook; possibly shown on a phone.
  5. Toast Couldn't move the pane to a new tab.: text unchanged, with a new cause (main refuses a drag-out).

Known and accepted

  • A phone waking an agent while the desktop quits (accepted for the flip).
  • The two visible differences above (forced-quit resume shows 1 tab; a kept preview stays kept).
  • Opening the same file path from two different hosts in one workspace with real hosts is not yet confirmed outside tests.
  • Opening a file takes about 62 ms at p95 on both builds, over the 50 ms target. It is an existing baseline, not caused by this change, tracked separately.
  • 104 unit test files keep a switch-off mock for the old path; each names the switch-on test covering the same behaviour. Moving them to the new path belongs to the cleanup that deletes the old path.

Review

One fresh independent review of the whole PR and one review of the fix round. Applied: unknown ORCA_LAYOUT_OWNER values are refused, names say what they carry, the switch comment states the web client correctly. Reported, not changed here: the many-titles batching above, and moving the off mocks to the shipped path.

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 and paired servers: unchanged, the server side stays off.
  • Mobile: the phone page bundle is unchanged.
  • Backwards compatibility: no wire format change in this PR. One cross-version wire unit test file now runs against the old path because its tests share one chat id and the new path remembers a chat closed before create for the life of the process; giving each test its own id is a follow-up.

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)

ORCA_LAYOUT_OWNER is now on by default for the desktop app (main and its
window). ORCA_LAYOUT_OWNER=window builds the rollback variant, which leaves
out/main/ORCA_LAYOUT_OWNER_WINDOW and which packaging refuses. The orcad
server, its template, the phone page and the CLI stay off; ORCA_SIDEBAR_INPUTS
stays dark. Every switch gate stays in place until phase F.

Tests: vitest compiles the shipped value; unit tests of the pre-flip path mock
the switch off. Layout-owner e2e specs run unless the build left the rollback
marker. The advisory CI job now proves the rollback build.
@coderabbitai

coderabbitai Bot commented Oct 19, 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: 30d3c757-f776-42bf-b44b-063d7be9bff5
📥 Commits

Reviewing files that changed from the base of the PR and between f88f9ba and be2644f.

📒 Files selected for processing: 123
  • .github/workflows/e2e.yml
  • .github/workflows/layout-owner-e2e.yml
  • config/scripts/layout-owner-e2e-workflow.test.mjs
  • src/main/ipc/renderer-shutdown-checkpoint.test.ts
  • src/main/ipc/session.test.ts
  • src/main/ipc/worktrees-authoritative-local-metadata-pruning.test.ts
  • src/main/ipc/worktrees-canonical-ssh-listing.test.ts
  • src/main/ipc/worktrees-detected-scan-cache.test.ts
  • src/main/ipc/worktrees-lineage-hydration.test.ts
  • src/main/ipc/worktrees-ssh-repo-owner-resolution.test.ts
  • src/main/ipc/worktrees-wsl-runtime-routing.test.ts
  • src/main/persistence-pane-identity-migration.test.ts
  • src/main/persistence-pty-binding-reconciliation.test.ts
  • src/main/persistence-split-pane-incarnation.test.ts
  • src/main/persistence-workspace-session-scrollback.test.ts
  • src/main/persistence-worktree-deletion-fencing.test.ts
  • src/main/persistence/loading-store/pty-binding-placement-inertness.test.ts
  • src/main/persistence/loading-store/terminal-close-async-durability.test.ts
  • src/main/persistence/terminal-topology/terminal-late-bind-layout-rules.test.ts
  • src/main/runtime/agent-session-tab-layout.test.ts
  • src/main/runtime/orca-runtime-serve-browser-restore.test.ts
  • src/main/runtime/orca-runtime-terminal-split-authority.test.ts
  • src/main/runtime/rpc/methods/structured-agent-session-admission.test.ts
  • src/main/runtime/rpc/methods/structured-agent-session-pi-dialog-capability.test.ts
  • src/main/runtime/rpc/methods/structured-agent-session.test.ts
  • src/renderer/src/app-shell/headless-phone-window-parity.test.ts
  • src/renderer/src/app-shell/startup-window-frame-parity.test.ts
  • src/renderer/src/components/editor/csv/csv-pending-save.test.ts
  • src/renderer/src/components/editor/csv/csv-preview-save-safety.test.ts
  • src/renderer/src/components/editor/editor-autosave-conflict-flow.test.ts
  • src/renderer/src/components/editor/editor-autosave-controller.test.ts
  • src/renderer/src/components/editor/editor-restored-tab-conflict-scan.test.ts
  • src/renderer/src/components/editor/editor-save-user-named-tab.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-move-to-pane-column.test.ts
  • src/renderer/src/components/tab-group/TabGroupSplitLayout.drag.test.tsx
  • src/renderer/src/components/tab-group/useTabDragSplit.test.ts
  • src/renderer/src/components/terminal-pane/launch-parity-window-tab.test.ts
  • src/renderer/src/components/terminal-pane/pending-pane-close-confirmation.test.ts
  • src/renderer/src/components/terminal-pane/pending-split-close.test.ts
  • src/renderer/src/components/terminal-pane/pty-connection-restore-and-resume.test.ts
  • src/renderer/src/components/terminal-pane/pty-connection-visibility-and-exit.test.ts
  • src/renderer/src/components/terminal-pane/terminal-pane-tab-detach-commit.test.ts
  • src/renderer/src/hooks/useIpcEvents-terminal-create-surfacing.test.ts
  • src/renderer/src/lib/agent-launch-pane-verdict-application.test.ts
  • src/renderer/src/lib/finished-agent-resume-resurrection.test.ts
  • src/renderer/src/lib/launch-agent-background-session-launch-parity.test.ts
  • src/renderer/src/lib/launch-agent-background-session.test.ts
  • src/renderer/src/lib/launch-agent-in-new-tab-main-surface.test.ts
  • src/renderer/src/lib/launch-agent-structured-chat-guard.test.ts
  • src/renderer/src/lib/launch-cancel-tombstones-compat/structured-agent-session-launch-cancellation.test.ts
  • src/renderer/src/lib/launch-parity-plus-planner.test.ts
  • src/renderer/src/lib/paired-runtime-closed-tab-resume.test.ts
  • src/renderer/src/lib/pi-session-resume-wake.test.ts
  • src/renderer/src/lib/resume-sleeping-agent-session-direct-ssh-hydration-gap.test.ts
  • src/renderer/src/lib/resume-sleeping-agent-session-execution-host-scope.test.ts
  • src/renderer/src/lib/resume-sleeping-agent-session-live-ssh-dedupe.test.ts
  • src/renderer/src/lib/resume-sleeping-agent-session-provider-claim.test.ts
  • src/renderer/src/lib/resume-sleeping-agent-session-suppress-navigation.test.ts
  • src/renderer/src/lib/resume-sleeping-agent-session.test.ts
  • src/renderer/src/lib/retracted-host-pane-resume.test.ts
  • src/renderer/src/lib/settled-worker-wake-policy.test.ts
  • src/renderer/src/lib/setup-split-activation-single-owner.test.ts
  • src/renderer/src/lib/structured-agent-session-launch-close-race.test.ts
  • src/renderer/src/lib/structured-agent-session-new-chat-own-launch.test.ts
  • src/renderer/src/lib/wake-sleeping-agents-live-unmounted-pane.test.ts
  • src/renderer/src/lib/workspace-terminal-host-authority.test.ts
  • src/renderer/src/lib/worktree-activation-automation-filter.test.ts
  • src/renderer/src/lib/worktree-activation-created-agent.test.ts
  • src/renderer/src/lib/worktree-activation-default-agent-chat.test.ts
  • src/renderer/src/lib/worktree-activation-emptied-workspace-reseed.test.ts
  • src/renderer/src/lib/worktree-activation-leave-visit.test.ts
  • src/renderer/src/lib/worktree-activation-structured-chat-surface.test.ts
  • src/renderer/src/lib/worktree-agent-activation-gate.test.ts
  • src/renderer/src/lib/worktree-agent-activation-seam.test.ts
  • src/renderer/src/lib/worktree-creation-background-mount.test.ts
  • src/renderer/src/lib/worktree-creation-chat-setup.test.ts
  • src/renderer/src/lib/worktree-creation-structured-session-host-decline.test.ts
  • src/renderer/src/lib/worktree-reactivation-preserved-pane-replacement.test.ts
  • src/renderer/src/lib/worktree-reactivation-runtime-owned-resume-deferral.test.ts
  • src/renderer/src/lib/worktree-reactivation-tab-forkbomb.test.ts
  • src/renderer/src/runtime/web-session-tabs-sync-remote-status-title-flap.test.ts
  • src/renderer/src/runtime/workspace-layout-frame-tab-props.test.ts
  • src/renderer/src/store/host-twin-owner-refusals.test.ts
  • src/renderer/src/store/slices/agent-generated-tab-title.test.ts
  • src/renderer/src/store/slices/browser-cleanup-close.test.ts
  • src/renderer/src/store/slices/browser-page-close-intent-recording.test.ts
  • src/renderer/src/store/slices/cmd-j-create-actions.test.ts
  • src/renderer/src/store/slices/editor-close-file-cleanup.test.ts
  • src/renderer/src/store/slices/editor-git-status-reconciliation.test.ts
  • src/renderer/src/store/slices/editor-markdown-link-activation.test.ts
  • src/renderer/src/store/slices/editor-markdown-view-state.test.ts
  • src/renderer/src/store/slices/editor-open-diff.test.ts
  • src/renderer/src/store/slices/editor-read-only-tabs.test.ts
  • src/renderer/src/store/slices/editor-recently-closed-tabs.test.ts
  • src/renderer/src/store/slices/editor-rich-markdown-size-override.test.ts
  • src/renderer/src/store/slices/editor-right-sidebar-state.test.ts
  • src/renderer/src/store/slices/editor-tab-placement.test.ts
  • src/renderer/src/store/slices/new-markdown.test.ts
  • src/renderer/src/store/slices/recently-closed-tabs.test.ts
  • src/renderer/src/store/slices/tab-view-mode.test.ts
  • src/renderer/src/store/slices/tabs-label-and-pin-state.test.ts
  • src/renderer/src/store/slices/tabs-model-reconciliation.test.ts
  • src/renderer/src/store/slices/tabs-unread-and-focus.test.ts
  • src/renderer/src/store/slices/tabs/hydrated-workspace-reconciliation-batch.test.ts
  • src/renderer/src/store/slices/tabs/tabs-reconciliation-empty-groups.test.ts
  • src/renderer/src/store/slices/terminals-hydration-canonical-rows.test.ts
  • src/renderer/src/store/slices/terminals-hydration.test.ts
  • src/renderer/src/store/slices/worktree-sleep-intent-lifecycle.test.ts
  • src/renderer/src/store/slices/worktrees/listing/stale-listing-purges-created-worktree.test.ts
  • src/renderer/src/store/terminals/structured-chat-tab-rename.test.ts
  • src/renderer/src/store/terminals/terminal-startup-queue-restart.test.ts
  • src/renderer/src/store/terminals/terminal-tab-close-intent.test.ts
  • src/shared/workspace-layout/old-client/old-client-session-tabs-projection.test.ts
  • src/shared/workspace-layout/workspace-layout-fact-locations.test.ts
  • src/shared/workspace-layout/workspace-layout-first-group-off.test.ts
  • src/shared/workspace-layout/workspace-layout-round-trip.test.ts
  • src/shared/workspace-layout/workspace-layout-views.test.ts
  • tests/e2e/completed-worker-retirement-resume.unit.test.ts
  • tests/e2e/cross-version-wire/cross-version-agent-session-wire.unit.test.ts
  • tests/e2e/terminal-binding-crash-hydration.unit.test.ts
🚧 Files skipped from review as they are similar to previous changes: 12
  • src/renderer/src/lib/worktree-reactivation-runtime-owned-resume-deferral.test.ts
  • src/renderer/src/lib/launch-agent-in-new-tab-main-surface.test.ts
  • src/renderer/src/components/editor/editor-autosave-conflict-flow.test.ts
  • src/renderer/src/components/tab-bar/tab-move-to-pane-column.test.ts
  • src/renderer/src/store/slices/terminals-hydration.test.ts
  • src/shared/workspace-layout/old-client/old-client-session-tabs-projection.test.ts
  • src/renderer/src/lib/structured-agent-session-launch-close-race.test.ts
  • src/renderer/src/store/slices/editor-git-status-reconciliation.test.ts
  • src/renderer/src/lib/launch-cancel-tombstones-compat/structured-agent-session-launch-cancellation.test.ts
  • src/main/ipc/session.test.ts
  • src/renderer/src/lib/agent-launch-pane-verdict-application.test.ts
  • src/renderer/src/store/slices/tabs-label-and-pin-state.test.ts

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

📝 Walkthrough

Desktop builds now ship with ORCA_LAYOUT_OWNER=main and support window as a rollback value. Build defines, marker generation, release packaging checks, and Vitest configuration reflect these values. The E2E workflows validate the window marker and limit divergence reporting to main-layout-owner builds. Test changes configure many suites for non-main ownership and adjust selected editor, persistence, and RPC test setups.

Priority: ➖ Normal

Merge Risk: 🟡 Moderate · up to be264

A mismatched phone-page layout build can pass packaging, and desktop build-configuration changes do not automatically run the rollback E2E job. Address or explicitly accept these risks before merging.

Pre-merge checks: Passed 4 · Inconclusive 1

Failed Failed checks: 1 inconclusive

Check name Status Explanation Resolution
Docstring Coverage Inconclusive Docstring coverage is 59.09% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 22 functions across 63 files. (73 skipped… 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 states the primary change: shipped desktop builds now use Main as the owner of terminal and tab layout.
Description check Passed The description follows the repository template and provides a clear ELI5 summary, detailed changes, rationale, linked planning context, visual-proof explanation, testing results, known limitations, r…
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 follows the repository template and provides a clear ELI5 summary, detailed changes, rationale, linked planning context, visual-proof explanation, testing results, known limitations, review notes, compatibility considerations, and completed checklist items.

Full details: Docstring Coverage

Explanation

Docstring coverage is 59.09% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 22 functions across 63 files. (73 skipped: 2 unsupported, 71 over the file limit.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

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

Actionable comments posted: 2


ℹ️ Review info
⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 18f1e6e6-9d1a-487a-91ba-41348f47bedc
📥 Commits

Reviewing files that changed from the base of the PR and between bd7633f and efb99ae.

📒 Files selected for processing: 129
  • .github/workflows/e2e.yml
  • .github/workflows/pr.yml
  • config/dark-build-switches.cjs
  • config/electron-builder.config.cjs
  • config/scripts/dark-build-switches.test.mjs
  • config/scripts/electron-builder-config.test.mjs
  • config/scripts/pr-auxiliary-preflight-admission.test.mjs
  • config/scripts/pr-layout-owner-window-route.mjs
  • config/scripts/pr-layout-owner-window-route.test.mjs
  • config/scripts/verify-packaged-mobile-web-bundle.cjs
  • config/vitest.config.ts
  • electron.vite.config.ts
  • src/main/ipc/renderer-shutdown-checkpoint.test.ts
  • src/main/ipc/session.test.ts
  • src/main/ipc/worktrees-authoritative-local-metadata-pruning.test.ts
  • src/main/ipc/worktrees-canonical-ssh-listing.test.ts
  • src/main/ipc/worktrees-detected-scan-cache.test.ts
  • src/main/ipc/worktrees-lineage-hydration.test.ts
  • src/main/ipc/worktrees-ssh-repo-owner-resolution.test.ts
  • src/main/ipc/worktrees-wsl-runtime-routing.test.ts
  • src/main/persistence-pane-identity-migration.test.ts
  • src/main/persistence-pty-binding-reconciliation.test.ts
  • src/main/persistence-split-pane-incarnation.test.ts
  • src/main/persistence-workspace-session-scrollback.test.ts
  • src/main/persistence-worktree-deletion-fencing.test.ts
  • src/main/persistence/loading-store/pty-binding-placement-inertness.test.ts
  • src/main/persistence/loading-store/terminal-close-async-durability.test.ts
  • src/main/persistence/terminal-topology/terminal-late-bind-layout-rules.test.ts
  • src/main/runtime/agent-session-tab-layout.test.ts
  • src/main/runtime/orca-runtime-serve-browser-restore.test.ts
  • src/main/runtime/orca-runtime-terminal-split-authority.test.ts
  • src/main/runtime/orca-runtime.test.ts
  • src/main/runtime/rpc/methods/structured-agent-session-admission.test.ts
  • src/main/runtime/rpc/methods/structured-agent-session-pi-dialog-capability.test.ts
  • src/main/runtime/rpc/methods/structured-agent-session.test.ts
  • src/main/runtime/runtime-headless-publication-contracts.test.ts
  • src/renderer/src/app-shell/headless-phone-window-parity.test.ts
  • src/renderer/src/app-shell/startup-window-frame-parity.test.ts
  • src/renderer/src/app-shell/startup-window-parity.test.ts
  • src/renderer/src/components/editor/csv/csv-pending-save.test.ts
  • src/renderer/src/components/editor/csv/csv-preview-save-safety.test.ts
  • src/renderer/src/components/editor/editor-autosave-conflict-flow.test.ts
  • src/renderer/src/components/editor/editor-autosave-controller.test.ts
  • src/renderer/src/components/editor/editor-restored-tab-conflict-scan.test.ts
  • src/renderer/src/components/editor/editor-save-user-named-tab.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-move-to-pane-column.test.ts
  • src/renderer/src/components/tab-group/TabGroupSplitLayout.drag.test.tsx
  • src/renderer/src/components/tab-group/useTabDragSplit.test.ts
  • src/renderer/src/components/terminal-pane/launch-parity-window-tab.test.ts
  • src/renderer/src/components/terminal-pane/pending-pane-close-confirmation.test.ts
  • src/renderer/src/components/terminal-pane/pending-split-close.test.ts
  • src/renderer/src/components/terminal-pane/pty-connection-restore-and-resume.test.ts
  • src/renderer/src/components/terminal-pane/pty-connection-visibility-and-exit.test.ts
  • src/renderer/src/components/terminal-pane/terminal-pane-tab-detach-commit.test.ts
  • src/renderer/src/components/terminal-pane/terminal-pane-tab-detach.test.ts
  • src/renderer/src/hooks/useIpcEvents-agent-status-snapshot-hydration.test.ts
  • src/renderer/src/hooks/useIpcEvents-terminal-create-surfacing.test.ts
  • src/renderer/src/lib/agent-launch-pane-verdict-application.test.ts
  • src/renderer/src/lib/launch-agent-background-session-launch-parity.test.ts
  • src/renderer/src/lib/launch-agent-background-session.test.ts
  • src/renderer/src/lib/launch-agent-in-new-tab-main-surface.test.ts
  • src/renderer/src/lib/launch-agent-structured-chat-guard.test.ts
  • src/renderer/src/lib/launch-cancel-tombstones-compat/structured-agent-session-launch-cancellation.test.ts
  • src/renderer/src/lib/setup-split-activation-single-owner.test.ts
  • src/renderer/src/lib/structured-agent-session-launch-close-race.test.ts
  • src/renderer/src/lib/structured-agent-session-launch-create-message.test.ts
  • src/renderer/src/lib/structured-agent-session-new-chat-own-launch.test.ts
  • src/renderer/src/lib/wake-sleeping-agents-live-unmounted-pane.test.ts
  • src/renderer/src/lib/worktree-activation-default-agent-chat.test.ts
  • src/renderer/src/lib/worktree-activation-emptied-workspace-reseed.test.ts
  • src/renderer/src/lib/worktree-agent-activation-gate.test.ts
  • src/renderer/src/lib/worktree-agent-activation-seam.test.ts
  • src/renderer/src/lib/worktree-creation-background-mount.test.ts
  • src/renderer/src/lib/worktree-creation-chat-setup.test.ts
  • src/renderer/src/lib/worktree-creation-structured-session-host-decline.test.ts
  • src/renderer/src/lib/worktree-reactivation-preserved-pane-replacement.test.ts
  • src/renderer/src/lib/worktree-reactivation-runtime-owned-resume-deferral.test.ts
  • src/renderer/src/lib/worktree-reactivation-tab-forkbomb.test.ts
  • src/renderer/src/runtime/web-session-tabs-sync-remote-status-title-flap.test.ts
  • src/renderer/src/runtime/workspace-layout-frame-tab-props.test.ts
  • src/renderer/src/store/slices/agent-generated-tab-title.test.ts
  • src/renderer/src/store/slices/agent-status-batch.test.ts
  • src/renderer/src/store/slices/browser-cleanup-close.test.ts
  • src/renderer/src/store/slices/browser-page-close-intent-recording.test.ts
  • src/renderer/src/store/slices/cmd-j-create-actions.test.ts
  • src/renderer/src/store/slices/editor-close-file-cleanup.test.ts
  • src/renderer/src/store/slices/editor-git-status-reconciliation.test.ts
  • src/renderer/src/store/slices/editor-markdown-link-activation.test.ts
  • src/renderer/src/store/slices/editor-markdown-view-state.test.ts
  • src/renderer/src/store/slices/editor-open-diff.test.ts
  • src/renderer/src/store/slices/editor-read-only-tabs.test.ts
  • src/renderer/src/store/slices/editor-recently-closed-tabs.test.ts
  • src/renderer/src/store/slices/editor-rich-markdown-size-override.test.ts
  • src/renderer/src/store/slices/editor-right-sidebar-state.test.ts
  • src/renderer/src/store/slices/editor-tab-placement.test.ts
  • src/renderer/src/store/slices/new-markdown.test.ts
  • src/renderer/src/store/slices/recently-closed-tabs.test.ts
  • src/renderer/src/store/slices/store-session-terminal-reconnect.test.ts
  • src/renderer/src/store/slices/tab-view-mode.test.ts
  • src/renderer/src/store/slices/tabs-label-and-pin-state.test.ts
  • src/renderer/src/store/slices/tabs-model-reconciliation.test.ts
  • src/renderer/src/store/slices/tabs-unread-and-focus.test.ts
  • src/renderer/src/store/slices/tabs/hydrated-workspace-reconciliation-batch.test.ts
  • src/renderer/src/store/slices/tabs/tabs-reconciliation-empty-groups.test.ts
  • src/renderer/src/store/slices/terminal-tab-title-batch.test.ts
  • src/renderer/src/store/slices/terminals-hydration-canonical-rows.test.ts
  • src/renderer/src/store/slices/terminals-hydration.test.ts
  • src/renderer/src/store/slices/worktree-sleep-intent-lifecycle.test.ts
  • src/renderer/src/store/slices/worktrees/listing/stale-listing-purges-created-worktree.test.ts
  • src/renderer/src/store/terminals/restored-relay-session-identity.test.ts
  • src/renderer/src/store/terminals/structured-chat-tab-rename.test.ts
  • src/renderer/src/store/terminals/terminal-tab-close-intent.test.ts
  • src/shared/layout-owner-switch.ts
  • src/shared/workspace-layout/old-client/old-client-session-tabs-projection.test.ts
  • src/shared/workspace-layout/workspace-layout-fact-locations.test.ts
  • src/shared/workspace-layout/workspace-layout-first-group-off.test.ts
  • src/shared/workspace-layout/workspace-layout-round-trip.test.ts
  • src/shared/workspace-layout/workspace-layout-views.test.ts
  • tests/e2e/cli-first-worktree-single-terminal.spec.ts
  • tests/e2e/completed-worker-retirement-resume.unit.test.ts
  • tests/e2e/cross-version-wire/cross-version-agent-session-wire.unit.test.ts
  • tests/e2e/default-tabs-mark-crash-relaunch.spec.ts
  • tests/e2e/helpers/layout-owner-build.ts
  • tests/e2e/layout-stream-loss-reopen.spec.ts
  • tests/e2e/terminal-binding-crash-hydration.unit.test.ts
  • tests/e2e/terminal-cli-split-closed-before-mount.spec.ts

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

Comment on lines +89 to +90
const on = turnedOn(env)
return DARK_BUILD_SWITCHES.filter((buildSwitch) => on.includes(buildSwitch)).map(marker)

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.

🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift

Keep a marker for dark phone-page layout builds.

If ORCA_LAYOUT_OWNER=main builds the phone-page bundle, turnedOnDarkBuildDefines enables that path, but darkBuildMarkers now emits no layout-owner marker. If packaging later runs with the variable unset, assertReleaseDesktopBuild accepts the unmarked bundle. Keep separate marker semantics for the phone page’s dark main value and the desktop’s rollback window value, and reject both markers during release packaging.

const LAYOUT_OWNER_WINDOW_PREFIXES = [
'src/shared/workspace-layout',
'src/shared/layout-owner-switch.ts',
'config/dark-build-switches.cjs',

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

Route desktop build-config changes to the rollback job.

If a PR changes only electron.vite.config.ts, isLayoutOwnerWindowSource returns false. That file controls both the layout-owner define and rollback marker, so the advisory rollback job would not check the changed build behavior. Add the file to LAYOUT_OWNER_WINDOW_PREFIXES and cover it in the route test.

E2E Test added 3 commits October 19, 2026 21:59
… each naming its test

Tests whose only gap was setup now run switch-on; files that show a real
switch-on difference lose their mock and stay red until their fixes land.
The rollback leg's trigger is back to #30582's list.
# Conflicts:
#	.github/workflows/pr.yml
#	config/scripts/pr-auxiliary-preflight-admission.test.mjs
#	config/scripts/pr-layout-owner-window-route.mjs
#	config/scripts/pr-layout-owner-window-route.test.mjs
Jinwoo-H added a commit that referenced this pull request Nov 28, 2026
…restored first size (#51816)

* test(layout-owner): downgrade with every tab kind, #30861 detectors, restored first size

- downgrade alternation covers chat, browser, editor and a pinned split terminal; the release launch gets the isolated keychain args so it no longer blocks on a keychain prompt
- switch-on unit checks: floating-tab poll reads no repo list (fixes the eager repo lookup in buildResolvedWorktreeFromId), a dragged-out unbound pane starts in its folder, a chat closed during create leaves no reader
- e2e: a restored terminal keeps its size while main starts alone, and a cold restore without history starts at main's saved grid

* ci(layout-owner): drop a merge marker from the switch-on unit list

* test(layout-owner): drop new type assertions from the safety checks

* test(layout-owner): first-size warm check reads only what the program saw before a window

* test(layout-owner): first-size warm check counts only lines written after the quit

* test(layout-owner): first-size shell hook goes in the Bash login file

* test(layout-owner): restored first size runs with no window; release launches drop the layout setting

- the restore phases run main as a windowless serve on the same profile: warm samples only after main lists both adopted terminals, cold reads each listed terminal so main starts it, then compares first sizes
- the downgrade spec's release launch no longer inherits ORCA_LAYOUT_OWNER / ORCA_SERVER_LAYOUT_OWNER

* fix(layout-owner): a terminal that never resizes still saves its pane's grid

Main saved a pane's grid only when its terminal was resized, so a split pane that started at its size had none, and a cold restore without history started it at its group's size. The first layout of each terminal now saves the grid too.

* test(layout-owner): first-size resizes once so both panes save a grid; drop the first-layout grid save

The first-layout save did not cover a pane that started at its size (window resizes reach main through pty:resize, not applyLayout). Main saving a terminal's starting size is left as a follow-up; the test now gives both panes a real resize first.

This branch has not been deployed

No deployments
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