Repository navigation
Conversation
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — two commits replacing the per-worktree Markdown document map with a single keyed snapshot in useMarkdownDocuments, plus regression tests.
- Single keyed snapshot —
src/renderer/src/components/editor/useMarkdownDocuments.tsholds one{ requestKey, documents }snapshot instead of aRecord<worktreeId, MarkdownDocument[]>;markdownDocumentsreturns it only when its key equals the current route'sdocumentRequestKey. - Committed-route guard —
currentRequestKeyRef(updated in auseLayoutEffect, cleared only by the passive unmount cleanup) gates both the pre-scan early return and the post-awaitcommit, so a scan or save belonging to a superseded workspace cannot refresh the current view. - Regression tests —
useMarkdownDocuments.navigation.test.tsadds owner/SSH key isolation, prior-workspace discard, StrictMode replay, permanent-unmount save, Suspense reveal, and a forced-GC retention bound.
Verified locally: the three related suites pass (22 + 2 + 12 tests), pnpm tc:web is clean, and the changed-code quality gate reports 0 new findings. A lifecycle review against React/react-dom 19.2.8 found no mounted-hook path that permanently blocks a legitimate refresh or drops a valid scan result; the layout-effect key update runs before the passive refresh effect on every commit, and a Suspense hide preserves passive effects while re-running layout effects on reveal.
deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

ELI5
A mounted Markdown editor now keeps the document list for its current workspace and host. Previously it retained lists from every workspace it had visited. This also prevents another host's old list from appearing while the current list loads.
What Changed
One current snapshot replaces the per-workspace map. Its identity reuses the existing document-request key, including the runtime owner and SSH connection. Delayed saves and scan results must still belong to the current committed route before they can refresh or replace that snapshot.
This changes one production file (+46/−19, net 27 lines), plus regression tests. No listing algorithm, completion-provider cache, protocol, dependency, or library file changes.
Why
The hook already refreshes when a workspace returns, so retaining its old lists indefinitely is unnecessary. This avoids introducing another cache, eviction policy, or refill mechanism. Same-owner refreshes retain the current list until the new scan finishes.
Cleanup uses the actual installed React/ReactDOM 19.2.8 lifecycle: a temporary Suspense hide removes layout effects while retaining passive effects. The committed key updates in a layout effect; passive unmount cleanup clears it. React's public Suspense contract describes that distinction. The public createRoot/Suspense regression reproduced a dropped response before this correction.
Linked Issue
Addresses only the renderer-history portion of Neil (@nwparker) and Orca's #10990, whose source and cache/refill proposal were reviewed. Its producer-budget problem remains open. The existing Monaco model-swap/unmount cleanup and VS Code's suggestion lifetime were checked before choosing this smaller change.
Visual Proof
N/A — this changes background retention and routing, without a layout or styling change. The real React hook GC check and compiled navigation checks provide behavior evidence.
Testing
ORCA_BACKGROUND_LAUNCH=1and exited afterward.Review
Two independent source reviews caught and verified fixes for the delayed-save and Suspense regressions before publication. Tests exercise the hook and public React behavior rather than checking source text.
Agent skill upstream boundary
Notes
Risk is low for this renderer-history scope, pending combined-branch checks. Returning to an earlier workspace waits for its existing fresh scan instead of immediately showing its old index. A single large current listing is still unbounded; this PR does not solve producer memory limits. Native Windows/Linux, actual SSH UI and physical mobile devices were not exercised for this change. Folder-path discovery is unchanged.
Checklist