Repository navigation
Conversation
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.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ➖ Normal Merge Risk: 🟡 Moderate · up to
|
There was a problem hiding this comment.
Actionable comments posted: 2
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
18f1e6e6-9d1a-487a-91ba-41348f47bedc
📒 Files selected for processing: 129
.github/workflows/e2e.yml.github/workflows/pr.ymlconfig/dark-build-switches.cjsconfig/electron-builder.config.cjsconfig/scripts/dark-build-switches.test.mjsconfig/scripts/electron-builder-config.test.mjsconfig/scripts/pr-auxiliary-preflight-admission.test.mjsconfig/scripts/pr-layout-owner-window-route.mjsconfig/scripts/pr-layout-owner-window-route.test.mjsconfig/scripts/verify-packaged-mobile-web-bundle.cjsconfig/vitest.config.tselectron.vite.config.tssrc/main/ipc/renderer-shutdown-checkpoint.test.tssrc/main/ipc/session.test.tssrc/main/ipc/worktrees-authoritative-local-metadata-pruning.test.tssrc/main/ipc/worktrees-canonical-ssh-listing.test.tssrc/main/ipc/worktrees-detected-scan-cache.test.tssrc/main/ipc/worktrees-lineage-hydration.test.tssrc/main/ipc/worktrees-ssh-repo-owner-resolution.test.tssrc/main/ipc/worktrees-wsl-runtime-routing.test.tssrc/main/persistence-pane-identity-migration.test.tssrc/main/persistence-pty-binding-reconciliation.test.tssrc/main/persistence-split-pane-incarnation.test.tssrc/main/persistence-workspace-session-scrollback.test.tssrc/main/persistence-worktree-deletion-fencing.test.tssrc/main/persistence/loading-store/pty-binding-placement-inertness.test.tssrc/main/persistence/loading-store/terminal-close-async-durability.test.tssrc/main/persistence/terminal-topology/terminal-late-bind-layout-rules.test.tssrc/main/runtime/agent-session-tab-layout.test.tssrc/main/runtime/orca-runtime-serve-browser-restore.test.tssrc/main/runtime/orca-runtime-terminal-split-authority.test.tssrc/main/runtime/orca-runtime.test.tssrc/main/runtime/rpc/methods/structured-agent-session-admission.test.tssrc/main/runtime/rpc/methods/structured-agent-session-pi-dialog-capability.test.tssrc/main/runtime/rpc/methods/structured-agent-session.test.tssrc/main/runtime/runtime-headless-publication-contracts.test.tssrc/renderer/src/app-shell/headless-phone-window-parity.test.tssrc/renderer/src/app-shell/startup-window-frame-parity.test.tssrc/renderer/src/app-shell/startup-window-parity.test.tssrc/renderer/src/components/editor/csv/csv-pending-save.test.tssrc/renderer/src/components/editor/csv/csv-preview-save-safety.test.tssrc/renderer/src/components/editor/editor-autosave-conflict-flow.test.tssrc/renderer/src/components/editor/editor-autosave-controller.test.tssrc/renderer/src/components/editor/editor-restored-tab-conflict-scan.test.tssrc/renderer/src/components/editor/editor-save-user-named-tab.test.tssrc/renderer/src/components/floating-terminal/floating-workspace-tab-reorder.test.tssrc/renderer/src/components/tab-bar/SortableTabContextMenu.test.tsxsrc/renderer/src/components/tab-bar/TabBar.context-menu.test.tssrc/renderer/src/components/tab-bar/tab-move-to-pane-column.test.tssrc/renderer/src/components/tab-group/TabGroupSplitLayout.drag.test.tsxsrc/renderer/src/components/tab-group/useTabDragSplit.test.tssrc/renderer/src/components/terminal-pane/launch-parity-window-tab.test.tssrc/renderer/src/components/terminal-pane/pending-pane-close-confirmation.test.tssrc/renderer/src/components/terminal-pane/pending-split-close.test.tssrc/renderer/src/components/terminal-pane/pty-connection-restore-and-resume.test.tssrc/renderer/src/components/terminal-pane/pty-connection-visibility-and-exit.test.tssrc/renderer/src/components/terminal-pane/terminal-pane-tab-detach-commit.test.tssrc/renderer/src/components/terminal-pane/terminal-pane-tab-detach.test.tssrc/renderer/src/hooks/useIpcEvents-agent-status-snapshot-hydration.test.tssrc/renderer/src/hooks/useIpcEvents-terminal-create-surfacing.test.tssrc/renderer/src/lib/agent-launch-pane-verdict-application.test.tssrc/renderer/src/lib/launch-agent-background-session-launch-parity.test.tssrc/renderer/src/lib/launch-agent-background-session.test.tssrc/renderer/src/lib/launch-agent-in-new-tab-main-surface.test.tssrc/renderer/src/lib/launch-agent-structured-chat-guard.test.tssrc/renderer/src/lib/launch-cancel-tombstones-compat/structured-agent-session-launch-cancellation.test.tssrc/renderer/src/lib/setup-split-activation-single-owner.test.tssrc/renderer/src/lib/structured-agent-session-launch-close-race.test.tssrc/renderer/src/lib/structured-agent-session-launch-create-message.test.tssrc/renderer/src/lib/structured-agent-session-new-chat-own-launch.test.tssrc/renderer/src/lib/wake-sleeping-agents-live-unmounted-pane.test.tssrc/renderer/src/lib/worktree-activation-default-agent-chat.test.tssrc/renderer/src/lib/worktree-activation-emptied-workspace-reseed.test.tssrc/renderer/src/lib/worktree-agent-activation-gate.test.tssrc/renderer/src/lib/worktree-agent-activation-seam.test.tssrc/renderer/src/lib/worktree-creation-background-mount.test.tssrc/renderer/src/lib/worktree-creation-chat-setup.test.tssrc/renderer/src/lib/worktree-creation-structured-session-host-decline.test.tssrc/renderer/src/lib/worktree-reactivation-preserved-pane-replacement.test.tssrc/renderer/src/lib/worktree-reactivation-runtime-owned-resume-deferral.test.tssrc/renderer/src/lib/worktree-reactivation-tab-forkbomb.test.tssrc/renderer/src/runtime/web-session-tabs-sync-remote-status-title-flap.test.tssrc/renderer/src/runtime/workspace-layout-frame-tab-props.test.tssrc/renderer/src/store/slices/agent-generated-tab-title.test.tssrc/renderer/src/store/slices/agent-status-batch.test.tssrc/renderer/src/store/slices/browser-cleanup-close.test.tssrc/renderer/src/store/slices/browser-page-close-intent-recording.test.tssrc/renderer/src/store/slices/cmd-j-create-actions.test.tssrc/renderer/src/store/slices/editor-close-file-cleanup.test.tssrc/renderer/src/store/slices/editor-git-status-reconciliation.test.tssrc/renderer/src/store/slices/editor-markdown-link-activation.test.tssrc/renderer/src/store/slices/editor-markdown-view-state.test.tssrc/renderer/src/store/slices/editor-open-diff.test.tssrc/renderer/src/store/slices/editor-read-only-tabs.test.tssrc/renderer/src/store/slices/editor-recently-closed-tabs.test.tssrc/renderer/src/store/slices/editor-rich-markdown-size-override.test.tssrc/renderer/src/store/slices/editor-right-sidebar-state.test.tssrc/renderer/src/store/slices/editor-tab-placement.test.tssrc/renderer/src/store/slices/new-markdown.test.tssrc/renderer/src/store/slices/recently-closed-tabs.test.tssrc/renderer/src/store/slices/store-session-terminal-reconnect.test.tssrc/renderer/src/store/slices/tab-view-mode.test.tssrc/renderer/src/store/slices/tabs-label-and-pin-state.test.tssrc/renderer/src/store/slices/tabs-model-reconciliation.test.tssrc/renderer/src/store/slices/tabs-unread-and-focus.test.tssrc/renderer/src/store/slices/tabs/hydrated-workspace-reconciliation-batch.test.tssrc/renderer/src/store/slices/tabs/tabs-reconciliation-empty-groups.test.tssrc/renderer/src/store/slices/terminal-tab-title-batch.test.tssrc/renderer/src/store/slices/terminals-hydration-canonical-rows.test.tssrc/renderer/src/store/slices/terminals-hydration.test.tssrc/renderer/src/store/slices/worktree-sleep-intent-lifecycle.test.tssrc/renderer/src/store/slices/worktrees/listing/stale-listing-purges-created-worktree.test.tssrc/renderer/src/store/terminals/restored-relay-session-identity.test.tssrc/renderer/src/store/terminals/structured-chat-tab-rename.test.tssrc/renderer/src/store/terminals/terminal-tab-close-intent.test.tssrc/shared/layout-owner-switch.tssrc/shared/workspace-layout/old-client/old-client-session-tabs-projection.test.tssrc/shared/workspace-layout/workspace-layout-fact-locations.test.tssrc/shared/workspace-layout/workspace-layout-first-group-off.test.tssrc/shared/workspace-layout/workspace-layout-round-trip.test.tssrc/shared/workspace-layout/workspace-layout-views.test.tstests/e2e/cli-first-worktree-single-terminal.spec.tstests/e2e/completed-worker-retirement-resume.unit.test.tstests/e2e/cross-version-wire/cross-version-agent-session-wire.unit.test.tstests/e2e/default-tabs-mark-crash-relaunch.spec.tstests/e2e/helpers/layout-owner-build.tstests/e2e/layout-stream-loss-reopen.spec.tstests/e2e/terminal-binding-crash-hydration.unit.test.tstests/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.
| const on = turnedOn(env) | ||
| return DARK_BUILD_SWITCHES.filter((buildSwitch) => on.includes(buildSwitch)).map(marker) |
There was a problem hiding this comment.
🗄️ 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', |
There was a problem hiding this comment.
🎯 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.
… 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
…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.
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:
Mechanism:
config/dark-build-switches.cjs:ORCA_LAYOUT_OWNERis now "shipped on" for the desktop app. With no variable, main and its window both compile the new path;ORCA_LAYOUT_OWNER=windowbuilds the rollback variant, which leavesout/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.pnpm build:webdev client.ORCA_SIDEBAR_INPUTSstays 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.if (ORCA_LAYOUT_OWNER_IS_MAIN)branch stays. The later cleanup deletes the old path and the switch.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.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 andverifyare unchanged.layout_owner: mainine2e.ymlremains available to record save-divergence reports on the shipped build.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:
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 refusesORCA_LAYOUT_OWNER=windowon 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:
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=mainbuild of the base commit except the build commit stamp and the oldORCA_LAYOUT_OWNER_MAINmarker file, which is gone. The rollback build equals a default build of the base commit (today's release) except the stamp and the newORCA_LAYOUT_OWNER_WINDOWmarker. orcad's build defines are identical at base and head for no variable,windowandmain.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:
split_pane_closed:orca terminal spliterror and--jsonoutput when the new pane was closed before it started (old path: "Timed out waiting for split pane handle").split_not_written: <reason>: same place, when main refused to write the split.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".The chat was closed before it was created.: the reply to a chat create that a close overtook; possibly shown on a phone.Couldn't move the pane to a new tab.: text unchanged, with a new cause (main refuses a drag-out).Known and accepted
Review
One fresh independent review of the whole PR and one review of the fix round. Applied: unknown
ORCA_LAYOUT_OWNERvalues 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
Notes
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)