Repository navigation
Keep an editor tab Orca moved to its file's workspace across restart; record editor renames in main (dark) - #29930
Conversation
…ross restart The move saved the tab under the file's owned id and left the tab's workspace pointing at the old one. Restore rebuilt a local file under its bare path, so the tab named no open file and was dropped. Restore now maps a saved owned id to the id it rebuilds, and the move gives the tab its new workspace.
…me redraws editor tabs Switch-on builds only. A frame rebuilds the window's tabs through the restore builders, which drop every diff, conflict and check tab (restore has no record for them), and the store patch dropped every open file the frame did not carry. Frames carry only edit-mode files, so the next frame after opening a diff closed it in the window while main kept it, and a markdown preview kept its tab but lost its record. The rebuild now keeps a transient tab whose record the window holds, and a held record goes only with the last tab showing it; a record no tab shows (a conflict review's selected file) stays.
…ceholders in main Switch-on builds only; switch-off behaviour is unchanged. A rename or move in the explorer rekeys open editor, preview and diff tabs in the window and main learned it only from the window's save. The window now records the rekey as a `renameEditorFiles` command, under the ids it chose (bare path, owner-qualified id, diff id), one per workspace, with each edit-mode file's new record. It records rather than asks first: the rekey is atomic with drafts and the autosave echo gate, and its answer gates the move coordinator. Main's path-keyed `editorFilesRenamed` transition, which nothing produced and which could not match owner-qualified or diff ids, becomes this command. A git status poll that sees a deleted-side conflict resolved drops its placeholder record but leaves the tab to the tab reconcile; frames then brought main's edit record back. Main now closes that tab.
… a renamed file only for a tab it shows
Restart and frames now agree: neither rekeys the tab, and a frame that redraws one workspace never points its tab at a same-path file in another. A rename that changes nothing leaves no empty file list.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
ELI5
There are two changes here.
A fix that ships now. Orca sometimes moves a restored editor tab to another workspace by itself: the one that owns the file. That tab used to disappear the next time Orca started. It now stays open in the workspace it was moved to.
Dark changes, only in the test build where the background process owns the tab layout (switch
ORCA_LAYOUT_OWNER=main):What Changed
Shipped fix (every build): a moved editor tab survives restart.
editor:<workspace>:local:<path>).worktreeId) and host (executionHostId), where before it kept the old ones.What the moved tab's corrected workspace changes in shipped builds. These are the readers of a moved restored editor tab's
worktreeId/executionHostId, found by reading code:Tab palette and tab search (
unified-tab-host-ownership.ts:67-71, used byworkspace-tab-palette-entry-builder.tsandworkspace-tab-palette-activation.ts). Visible: the moved tab used to be missing from the palette and tab search. It is now listed under the workspace it sits in, can be selected, and can show as the current tab.Close all editors (
recently-closed-editor-tabs.ts:89-94). Visible:Both now act on the right workspace.
Main-process session bookkeeping (
worktree-identity-migration.ts,profile-session-owner-transfer.ts,session-worktree-ownership.ts). Renaming a worktree and pruning workspace metadata now count the row under its real workspace.Moving the session store to the background service (
orcad-source-workspace-session-eligibility.ts,orcad-migration-dormant-session-validation.ts). Very likely fixed, not reproduced: the stale workspace or host could block or fail the move.No change: close, activate and move actions (they use the bucket key); mobile and web views (they publish per workspace bucket); the saved-session format (same fields).
Dark changes (switch-on builds only):
renameEditorFilescommand. It carries the window's own tab and file ids, one command per workspace.runtime:) acts as today.reorderFilesis deleted.Why
This is step E2-2 of the plan to make main the only writer of tab layout. Editor changes that reach main only through window saves would be lost once saves stop carrying layout.
The owner approved fixing the restart bug inside this PR.
Alternative for the restart fix, considered first: map the saved id back to the bare path on restart. Review showed that main still holds the workspace-qualified id, so the window and main would disagree from the first layout update. Keeping the id the tab names keeps restart, layout updates and main consistent.
Linked Issue
Part of the layout single-owner plan (phase E2, step E2-2).
Visual Proof
Shipped restart fix, real app in a hidden window on an isolated profile, macOS. The steps: open a restored editor tab whose file belongs to a sibling worktree, let Orca move it, then restart.
fd1c6a592cc): after the restart the editor tab is gone; the workspace shows only a terminal.Screenshots are kept locally (they show a terminal prompt with the machine's account name) and are available on request.
Testing
Unit tests:
restored-editor-owner-restart.test.ts: move, save, restart. It fails on main.hydrated-editor-session-state.test.ts: the restored id, and a sibling workspace with the same path open, for a restart and for layout updates covering either or both workspaces.pnpm tcpasses, as do the changed-code quality gate, both layout-writer ratchets (renderer count 652 to 651), the static-analysis lint and the parameter-catalog check. Broad vitest over store, editor, app shell, workspace layout, runtime RPC and persistence passes.Switch-off bundle check (unminified, against
fd1c6a592cc). The only behaviour change is the restart fix inhydrated-editor-session-stateandrestored-editor-owner-transition. Every other region that differs is:reorderFilesremoved;rekey-open-files-actionandgit-status-actions(setGitStatusalso became a block body that still returns nothing);tabs-hydrationparameter that defaults to "keep nothing";layout.applyis not registered in off builds.Switch-on, hidden window, macOS: the layout oracle plus the real-app split, resize, close and relaunch spec pass, 22 of 22, at this head. The save-divergence detector logs the same set as main: the oracle has no rename, diff or conflict scenarios, so no baseline report is silenced here.
Latency, open file until its editor tab shows (30 runs):
Flip blocker: open-file p95 is over 50 ms with the switch on. This is recorded for the switch decision, not tuned in dark code.Update (after merge): a 90-sample A/B that times until the change is drawn in both modes shows no switch gap for new tab or open file, so this flip blocker is closed. The 0 ms off baseline for rename and toggle was a harness artifact (off was timed before React drew); the real gap is about 6–10 ms at 22–27 ms p95, under the bar.Review
Agent skill upstream boundary
Notes
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)