Repository navigation
Conversation
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: b8660273-9f10-4be2-aab3-0719f4641282
📥 Commits
Reviewing files that changed from the base of the PR and between 172083f and e345bc8611d1006e5032ebc72495e03c2afba298.
📒 Files selected for processing (5)
src/renderer/src/app-shell/reconcile-hydrated-workspace-tab-models.test.tssrc/renderer/src/app-shell/reconcile-hydrated-workspace-tab-models.tssrc/renderer/src/lib/workspace-session-unified-tabs.test.tssrc/renderer/src/lib/workspace-session-unified-tabs.tssrc/renderer/src/store/slices/orphan-editor-tab-boot-prune.test.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.
There was a problem hiding this comment.
ℹ️ Minor suggestions only — one rough edge inline.
Reviewed changes — reviewed the full diff at e345bc8 (2 commits, 5 files) and verified the new tests fail against the pre-change source.
- Widen startup tab reconciliation:
reconcileHydratedWorkspaceTabModelsnow unionstabsByWorktreekeys withunifiedTabskeys, so editor-only workspaces are reconciled at boot using the existingprojectWorktreeTabModelReconciliationprojection. Verified equivalent to the activation-time path: both fold the same projection, andhydrateEditorSession(which re-keys editor-family tabs to the owned OpenFile id) runs before the reconcile, soliveEditorIdsis populated. No editor-family, markdown-preview, runtime, SSH, or folder-worktree divergence found. - Dedupe persisted unified tabs: the writer sorts by
sortOrder/createdAt, filters to surviving groups, then reusesdedupeTabsById. See the inline note on the surviving-copy assumption. - Tests: confirmed the new orphan and cross-group assertions fail without the source change (4 failing assertions after reverting the two source files), so the coverage is real. The affected suites pass with the change (25 tests).
ℹ️ Nitpicks
reconcile-hydrated-workspace-tab-models.test.ts:19passesunifiedTabs: { 'wt-a': [], 'wt-editor-only': [] }— both empty arrays — so the new assertion proves the key reaches the callback but never exercises a workspace that actually holds a tab. The end-to-end case is covered byorphan-editor-tab-boot-prune.test.ts, so this is purely a note on the unit test's scope.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
e345bc8 to
eaef9c7
Compare
|
Continued this PR with both @BearMett authored commits preserved, rebased onto c2c7649, and added an adversarial correction: restore admission now runs before persistence deduplication so an invalid row cannot hide a valid editor or its unsaved draft. Related tests: 176 across 18 suites pass. Real hidden cold starts confirm one inactive orphan on the base and none after the fix; the actual editor still renders after selection. Full typecheck/build/changed quality pass; full lint has only the two unchanged findings repaired by #25494. Updated the description with proof, source references, and limits. #21121 and #23967 remain open for their broader peer/ownership reports. |
…terminal rows Boot-time tab reconciliation only visited worktrees with persisted terminal rows, so an editor-only worktree kept tabs whose OpenFile record no longer existed; they rendered and were re-persisted on every restart. Reconcile every worktree with persisted unified tabs too, and dedupe tab records by id when writing the session. Refs stablyai#21121
eaef9c7 to
9691aad
Compare
There was a problem hiding this comment.
ℹ️ No critical issues — one persistence-hygiene note inline.
Reviewed changes — re-reviewed the commits since the prior pullfrog review at e345bc8. The branch was rebased; the reconciliation widening is unchanged in substance and was already reviewed. The prior inline concern — the writer's dedupe could persist a hydration-droppable copy that hides a live editor — is now addressed.
- Sort and filter before dedupe:
buildPersistedUnifiedTabSessionDatanow sorts bysortOrder/createdAtand filters to surviving groups beforededupeTabsById, so the surviving duplicate is the copy hydration prefers. - Shared validity predicate: extracted
canRestorePersistedTabfrom the hydration filter and applies it writer-side before dedupe;tabs-hydration.tsnow calls the same function, so an unrestorable copy (invalid terminal id,html-preview::, transient diff/conflict/check-details) can no longer hide a live editor or its unsaved draft. - Tests: added the cross-group dedupe case and an
it.eachover diff /html-preview::/ terminal duplicates. Ablation (removing the writer filter) fails all threeit.eachcases, so the coverage is real. 95 tests across the related persistence/hydration suites pass, plustc:webandoxlint.
deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏
| [...tabs] | ||
| .sort((a, b) => a.sortOrder - b.sortOrder || a.createdAt - b.createdAt) | ||
| .filter((tab) => groupIds.has(tab.groupId)) | ||
| .filter((tab) => !snapshot.openFiles || canRestorePersistedTab(tab, persistedEditFileIds)) |
There was a problem hiding this comment.
Because groups is built from the unfiltered tabs (line 95) and persisted as tabGroups[worktreeId] (line 114), a tab this new filter drops can still remain in the group's tabOrder. Verified with a scratch probe: a diff tab sharing a group with a live editor persists unifiedTabs = ['tab-editor'] but tabGroups.wt[0].tabOrder = ['tab-editor', 'tab-diff']. Hydration filters dangling ids out (tabs-hydration.ts:146-147), so there is no runtime effect today, but the persisted record is left inconsistent; building the groups from the filtered tabs would keep it clean.
There was a problem hiding this comment.
Fixed in 22edc79. Group tab lists are now built from the tabs that pass the restorability filter, so a dropped diff tab no longer stays in its group's tabOrder. The shared loader also consumes these groups, so the writer must keep them consistent.
Covered by workspace-session-unified-tabs.test.ts ("drops an unrestorable diff tab from the tab order of the group that still shows an editor", your probe's shape) and workspace-layout-renderer-parity-tabs.test.ts.
Run the writer through the same validity, per-group dedupe and group-ownership steps hydration uses, so a saved session holds exactly what restore keeps. The ownership rule moves to shared/workspace-layout and the shared loader uses it too. A valid declared group wins; a missing group is not evidence of closure, so its live content is adopted. Same-group duplicate editor views collapse to the pinned copy while other split groups stay apart. A change to openFiles alone now re-filters tab chrome.
|
@nwparker thanks for continuing this. I've added a merge of main and one commit on top of your head, so your commits stay as they are. The new commit addresses pullfrog's remaining Since this is a fork PR, could you approve the waiting workflow runs when you have a moment? |
|
This PR now uses the shared @Jinwoo-H, since your layout-owner work touches the same files, how would you prefer to handle #27983? In addition to the changes in #31925, this PR does two things:
If you would prefer to address these in your refactor, I'm happy to close this PR or narrow its scope accordingly. If this PR still fits, could you review it and approve the pending workflow runs when you have time? |
|
Closing: main's layout-owner work (#31925, #31438) now owns editor tab restore and reconciliation, so this renderer-side hydration fix no longer fits the current design and has drifted ~1.8k commits behind with conflicts in the same files. The restorability rule this PR adopted already landed via #31925. Leaving #27983 open for the assignee to continue on the new architecture. Thanks @nwparker for carrying this earlier. |

ELI5
When Orca quits, it saves your tabs and tab groups. On the next launch, it rebuilds them from that save. Some saves held tabs that the restore step always threw away, and some listed the same tab in two groups. Now the save step uses the same filter and the same tab-to-group rule as restore, so a saved group only lists tabs that restore keeps. Workspaces that only have editor tabs, with no terminals, are also cleaned at startup.
What Changed
This PR builds on @nwparker's continuation from 2026-10-05. The existing commits, including his, are unchanged. On top of them I added a merge of current main and one new commit.
Before
html-preview::rows, and diff or conflict tabs whose file was not saved). It still built each group's tab list from the unfiltered tabs, though. pullfrog showed the result:unifiedTabs = ['tab-editor']buttabOrder = ['tab-editor', 'tab-diff'].openFiles. That change did not re-run the tab filtering, so the stale diff tab stayed on disk until some other tab change.After
The save step shares the restorability filter and group-ownership rules with restore. It calls restore's own functions for:
canRestorePersistedTab);Group tab lists are now built from the filtered tabs.
The tab-to-group rule (
resolveTabGroupOwners) moved tosrc/shared/workspace-layout/tab-group-ownership.ts. Renderer restore, the renderer save step, and the shared layout loader (resolveGroupOrder) all use it now. A valid declared group wins.A tab whose group is missing is re-homed, not dropped. A missing group does not mean the user closed what was in it.
Duplicate editor views of the same document in the same group collapse to the pinned copy. Views of that document in other split groups are kept.
A change to
openFilesalone now re-runs the tab save, so the diff tab above is dropped from disk when its file closes.Main files:
lib/workspace-session-unified-tabs.ts(save step),lib/workspace-session-patch.ts(re-run trigger),store/slices/tab-group-state.tsandtab-group-reference-repair.ts(shared steps pulled out oftabs-hydration.ts, which now calls them),shared/workspace-layout/tab-group-ownership.tsandworkspace-layout-load-order.ts.Why
Restore already repairs inconsistent groups, but the shared loader also consumes these groups, so the writer must keep them consistent.
Alternatives considered:
Transient tabs (diff, conflict review, html preview) are still kept in the live model. They are filtered only at the point where the renderer writes to disk. Parity case 5 pins that boundary.
Linked Issue
Fixes #27983
Related to #21121 and #23967. Both stay open: owner recovery, peer re-injection, and the many-tab reports are outside this PR.
Visual Proof
Startup cleanup (earlier commits). @nwparker's screenshots: an inactive orphan goes 1 → 0, and the real document still renders.
Saved groups (new commit). Nothing new is drawn on screen; the change is in what is written to disk. From
workspace-session-unified-tabs.test.ts("drops an unrestorable diff tab from the tab order of the group that still shows an editor"): one group holds an editor tab for an open file and a diff tab whose file is not open.Before, as pullfrog's probe of the previous writer reported it:
After, in the test's fixture (
/x/a.tsis the editor tab,diff-tabthe diff tab):Restart check on both heads (hidden Electron, temp profile, automated): open
src/index.ts, pin its tab, quit, relaunch. On9691aadf49and on22edc79e20the document comes back in its pinned tab and the saved group lists only that tab. I could not build the orphan-in-group state through the live store (a tab for a file that is not open is refused at creation), so the writer change is shown by the unit test above, not by a screenshot.Testing
Unit and integration tests, macOS. Earlier validation ran on
83ddb0da76. The appended head22edc79e20also includes main's subsequent changes; its own 64-file / 610-test run passed.On
83ddb0da76:src/shared/workspace-layout, andsrc/renderer/src/store/slices/editor.store/slices,lib,app-shell,components/editor): 1,401 files pass and 2 files (3 tests) fail.rich-markdown-escape-fidelityfails the same way on untouched main.palette-match-performancefailed in the broad run; its cause has not been confirmed. -pnpm tc,pnpm run check:code-quality:changed, the layout-writer, focus-read and max-lines ratchets (no baseline raised),check:reliability-gatesandcheck:compat-boundary-importspass.ORCA_BACKGROUND_LAUNCH=1):workspace-layout-oracle-headless9 passed / 9 skipped,workspace-layout-oracle21 passed, andpersisted-session-production-upgrade3 passed / 2 skipped. The oracle reports findings that are already on main's known list; it reported none outside that list.On
22edc79e20(@nwparker's head9691aadf49, a merge of main41fc9542b3, and one commit):src/shared/workspace-layout,store/slices/editor): 64 test files and 610 tests pass.pnpm tc,pnpm run check:code-quality:changed, the layout-writer, focus-read and max-lines ratchets,check:reliability-gatesandcheck:compat-boundary-importspass.New tests:
workspace-session-unified-tabs.test.ts:groupIdnames.workspace-layout-renderer-parity-tabs.test.ts. On the same stored data:workspace-session-patch.test.ts: anopenFiles-only change re-runs the tab save. A diff tab is dropped from disk when only its backing file closes.tab-group-state.test.ts: the pinned view and separate split groups are kept.orphan-editor-tab-boot-prune.test.ts: editor-only workspaces are cleaned at boot.Not run: Linux, Windows, a live SSH host.
AI Disclosure
Written with Claude Code (Claude Opus 5.5) and Codex (gpt-6-astra).
Review
Please look hardest at
buildPersistedTabsAndGroupsinworkspace-session-unified-tabs.ts. It shares the filter and group-ownership rules withhydrateUnifiedFormat, and the parity test checks that both readers agree on what it writes.Agent skill upstream boundary
Notes
openFiles-only change now also re-runs the tab save for that session write. Not measured.confirmHooklint fix, so after the merge the PR diff no longer includes it.Ensure no issues in: Security, Cross-platoform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance
Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred). Typecheck, changed-code quality and the related suites pass locally. Full lint, the full test suite and the build are left to CI.