Repository navigation
Conversation
|
Important Review skippedWe couldn't safely recover the incremental review. No full review was started, and the last reviewed checkpoint was preserved. Retry later, or explicitly request a full review by commenting You can disable this status message by setting the Use the checkbox below for a quick retry:
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
| Check name | Status | Explanation | Resolution |
|---|---|---|---|
| Docstring Coverage | Docstring coverage is 16.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 6 functions across 4 files. | Write docstrings for the functions missing them to satisfy the coverage threshold. |
✅ Passed checks (4 passed)
-
Check name Status Explanation Title check ✅ Passed The title clearly and concisely identifies the main change: folding duplicate open-file owner tuples during session persistence. Description check ✅ Passed The description is mostly complete. It explains the problem, implementation, scope, rationale, testing, AI use, and checklist status. It does not follow every template heading and does not explicitly … 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.
- Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Autopilot is currently an internal CodeRabbit preview.
ℹ️ Recent review info
-
⚙️ Run configuration
-
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: aa16c469-383e-4875-8791-d46c82b3866b
📥 Commits
-
Reviewing files that changed from the base of the PR and between 86b1beaed84b72c2f0fd53b9c01cab3438eb1156 and 937d551cb5e97c734c4cfa155edb1bcefd208465.
📒 Files selected for processing (4)
-
src/renderer/src/lib/workspace-session-openfile-tuple-dedupe.test.ts
src/renderer/src/lib/workspace-session-openfile-tuple-dedupe.ts
src/renderer/src/lib/workspace-session.test.ts
src/renderer/src/lib/workspace-session.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.
ℹ️ Recent review info
-
⚙️ Run configuration
-
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID:
aa16c469-383e-4875-8791-d46c82b3866b
📥 Commits
-
Reviewing files that changed from the base of the PR and between 86b1beaed84b72c2f0fd53b9c01cab3438eb1156 and 937d551cb5e97c734c4cfa155edb1bcefd208465.
📒 Files selected for processing (4)
-
src/renderer/src/lib/workspace-session-openfile-tuple-dedupe.test.tssrc/renderer/src/lib/workspace-session-openfile-tuple-dedupe.tssrc/renderer/src/lib/workspace-session.test.tssrc/renderer/src/lib/workspace-session.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.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: 2e12407a-c17e-431b-bfb6-f5f5d7a95769
📥 Commits
Reviewing files that changed from the base of the PR and between 46d6b76 and 306f77c92a6c73bd6800087e9b6fb074f219bcff.
📒 Files selected for processing (4)
src/renderer/src/lib/workspace-session-openfile-tuple-dedupe.test.tssrc/renderer/src/lib/workspace-session-openfile-tuple-dedupe.tssrc/renderer/src/lib/workspace-session.test.tssrc/renderer/src/lib/workspace-session.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.
✅ No new issues found.
Reviewed changes
- Persist-side owner-tuple fold —
buildEditorSessionDatanow routes edit-mode open files throughdedupeOpenFilesByOwnerTuple, keeping the first row per(filePath, worktreeId, runtimeOwnerKey(runtimeEnvironmentId))(src/renderer/src/lib/workspace-session.ts:131). - New helper module —
workspace-session-openfile-tuple-dedupe.tsdocuments why the fold is lossless against hydration's first-wins owner dedupe (issue #17370) and normalizes empty/whitespace env ids via the sharedruntimeOwnerKey. - Regression coverage — a payload-level test folds 5 store rows (owned id, raw path, other env, other file) to 3 persisted rows with order and
activeFileIdByWorktreepreserved; a 4-case unit suite covers cross-env/worktree/path retention and empty-env collapse.
I verified the fold tuple matches hydration's identity model (LegacyHydratedEditorFileIndex.hasOwner) exactly, so the surviving row is the same one restore would keep — drafts, readOnly, and liveTail are unaffected. I also traced the runtime mirror's active-file reconciliation (apply-preparation-unified.ts): currentActiveEditorStillExists keeps the retained owned row as the active id, so the first-occurrence survivor is the referenced one and the persisted active selection is not dropped. The two touched suites plus five adjacent persist/hydration suites pass locally (89 tests).
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
Important
The removed→retained map is keyed by file.id alone, which is not unique per owner tuple, so in the local + paired-remote state #23967 measured it can silently re-point the restored active file to the other environment's row. Details inline.
Reviewed changes
This run re-reviewed commit 86b1beaed8 (the delta since the prior pullfrog review at 306f77c92a).
- Removed→retained mapping returned from the fold —
foldOpenFilesByOwnerTuplenow returns{ files, retainedIdByRemovedId }, recording each folded row's id against the id of the row that survived. - Active-file pointer remapped before the whitelist check —
buildEditorSessionDataresolves each worktree's active id through that mapping so a selected duplicate is preserved on the retained row, and the'editor'tab-type marker gated on it survives. - Coverage added — a payload regression for the selected-duplicate case plus a unit case asserting the removed→retained mapping contract.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
|
Want your agent to iterate on Greptile's feedback? Try greploops. |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
This run re-reviewed commit 937d551cb5 (the delta since the prior pullfrog review at 86b1beaed8).
- Owner-tuple fold mapping scoped per worktree —
foldOpenFilesByOwnerTuplenow returnsretainedIdByRemovedIdasMap<worktreeId, Map<removedId, retainedId>>, so a removed row's raw-path id can no longer leak across a worktree boundary (src/renderer/src/lib/workspace-session-openfile-tuple-dedupe.ts:28). - Live retained id wins over the mapping —
buildEditorSessionDataremaps an active pointer only when the id is no longer a retained row in its own worktree (src/renderer/src/lib/workspace-session.ts:171), so a pointer naming a surviving local raw-path row is never slid onto the remote owned row. - Coverage added — two payload regressions: a live raw-path id in a second worktree is not remapped, and a live local row is preferred over the fold mapping when both claim the active id; the fold's unit contract case now asserts the mapping per worktree.
I traced both prior failure modes against the new branch. For the cross-worktree case, editFileIdsByWorktree['wt-2'].has(fileId) is now checked before the mapping, so the pointer stays on its own live row instead of being re-pointed to wt-1's retained id and then dropped by the whitelist. For the same-worktree local + paired-remote case, the local raw-path row is a retained id, so the pointer stays on it rather than following the removed duplicate to the remote owned row. Both tests fail on 86b1beaed8 and pass on the fix. The prior pullfrog thread on workspace-session.ts:169 is resolved.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
937d551 to
42027e1
Compare
|
Rebased onto @nwparker gentle ping — happy to adjust anything. |
orca-data.json grew without bound (79 persisted rows for 5 real files) because an open file's identity is the raw path string x runtime env id: hydration recasts every persisted row to an owned id (editor:<wt>:<env>:<encoded path>), so the session mirror's lookup by raw path always misses and re-appends a (path, worktree, runtime) row on each launch, while rows from older environments are never re-keyed or culled. Stop the bleeding on the persist side: buildEditorSessionData now keeps only the first row per (filePath, worktreeId, runtimeOwnerKey) tuple. This is lossless for restore - hydrateEditorSession already treats repeated records for the same owner as corruption and keeps the first (stablyai#17370) - so restore output is unchanged, new duplicate rows stop being written, and existing ones are cleaned up on the next save. Rows owned by a different runtime environment stay distinct; converging identity across environment changes plus path-separator normalization is a separate follow-up that needs a maintainer decision. Refs stablyai#23967 Generated-by: GLM-5.3-Flash (ZCode)
Review follow-up to 306f77c92a: first-occurrence-wins tuple folding could fold away the very row a worktree's active-file pointer names - when the session mirror's raw-path duplicate is the selected one (owned-id row first), the whitelist for activeFileIdByWorktree no longer contained its id, so persistence dropped the active pointer and, gated on it, the 'editor' tab-type marker; the next launch then reopened the worktree on a terminal tab instead of the editor. foldOpenFilesByOwnerTuple now also returns the fold's removed-to-retained id mapping, and buildEditorSessionData re-points each worktree's active id through it before the whitelist check, so the selection and its tab-type marker survive. Rows themselves are unchanged, so no duplicate ids can be introduced; hydrate and the mirror are untouched. Refs stablyai#23967 Generated-by: GLM-5.3-Flash (ZCode)
The duplicate-tuple fold keyed its removed->retained id map by the bare row id, but a raw-path id is just the absolute file path, which is not unique across owners or worktrees. Two problems followed: the active-file remap in buildEditorSessionData consulted the map before the whitelist check, and the lookup ignored which worktree the pointer belonged to. A raw-path id that was still a live row elsewhere (another worktree, or the local row beside the mirror's remote-tuple duplicate) got re-pointed at a foreign retained row - the cross-worktree case then failed the whitelist and dropped the pointer (and the 'editor' tab-type marker with it). Fix both: the fold returns its mapping scoped per worktree (a tuple never spans worktrees), and the pointer is only remapped when it no longer names a retained row in its own worktree. Generated-by: GLM-5.3-Flash (ZCode)
…dule Upstream growth pushed workspace-session.ts over the 300-line ratchet; the persist-side active-pointer projection moves next to the fold it pairs with. Generated-by: GLM-5.3-Flash (ZCode)
42027e1 to
d3e1c35
Compare
|
Rebased onto current Verified after the rebase: workspace-session suites 50/50, @nwparker gentle ping — happy to adjust anything. |

Summary
Editor tabs multiply on every session save (#23967: 79 persisted rows for 5 real files). The claim comment on the issue pins the write path: an open file's identity is the raw path string x
runtimeEnvironmentId, hydration recasts every persisted row to an owned id (editor:<wt>:<env>:<encoded path>), so the session mirror's lookup by raw path always misses and re-appends a(raw path, current env)row on each launch, while rows from older environments are never re-keyed or culled.This PR is the stop-the-bleeding half of the plan, not the full fix:
buildEditorSessionData(persist side) now folds repeated(filePath, worktreeId, runtimeOwnerKey)tuples, first occurrence wins. Empty/whitespace environment ids collapse to the same local owner viaruntimeOwnerKey, matching how hydration resolves the owner.hydrateEditorSessionalready treats repeated records for the same owner as corruption and keeps the first row (#17370), so the folded rows are exactly the ones restore discarded anyway. Split-tab sharing is unaffected — it lives inunifiedTabs(multiple tabs sharing one OpenFile's entityId), not in repeated open-file rows.orca-data.jsonare cleaned up on the next save.Out of scope (needs a maintainer decision, follow-up to come): converging identity across runtime-environment changes — re-keying old-owner rows to the current owner at env transitions or mirror apply — plus path-separator normalization (
%5Cvs%2F, defect 2 in the issue). One caution on the issue's "dedupe by normalized path regardless of runtimeEnvironmentId" proposal: the same absolute path on a different machine's runtime is a genuinely different file, so cross-environment folding must be limited to a same-worktree ownership migration, not applied globally by path.Verification
workspace-session.test.ts > folds repeated open-file rows for the same (path, worktree, runtime) tuple, dedupe wiring revertedworkspace-session-openfile-tuple-dedupe.test.ts(fold, cross-env kept, worktree/path kept, empty-env owners collapse)buildEditorSessionData/buildWorkspaceSessionPayload(incl.editor-session-duplicate-restore,restored-editor-owner-reparent,workspace-session-patch, terminals hydration)tsc --noEmit -p config/tsconfig.tc.web.jsonoxlinton the 4 touched filesoxfmt --checkon the 4 touched filescheck:max-lines-ratchetWindows 11, Node 24. No
orca-runtime-testsspec touchesbuildWorkspaceSessionPayload/openFilesByWorktree(verified by grep), so no scratch-config spec run needed.AI use
Implemented with GLM-5.3-Flash (ZCode): store-probe investigation, patch and tests; human reviewed and ran the verification matrix.
Checklist
oxlintandtypecheck:webcleanmax-linesratchet bypass