Skip to content

fix(git): bound inactive workspace history retention - #34993

Closed
OrcaWin wants to merge 1 commit into
mainfrom
OrcaWin/git-history-retention
Closed

OrcaWin wants to merge 1 commit into
mainfrom
OrcaWin/git-history-retention

Conversation

@OrcaWin

@OrcaWin OrcaWin commented Oct 28, 2026 •

Copy link
Copy Markdown
Collaborator
Files Added Deleted Net
Test 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​193 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​193
Prod 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​161 $\color{#cf222e}{\Huge{\mathbf{−}}}$​53 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​108

The Commits panel retained the full 50-commit history result for every visited workspace that still existed, even though returning to a workspace always fetched it again. Across many workspaces, full messages, authors, and ref metadata accumulated in renderer state.

Keep the active result plus a recent inactive cache capped at four entries and 4 MiB of conservatively counted strings (two bytes per code unit, including nested metadata and errors). An active result can exceed the inactive budget; once inactive, an oversized result is removed without flushing other recent pages. Recent cached pages remain visible during authoritative refetch, and errors retain the current result for recovery.

Request identities now live in the evictable entries. Removed, evicted, replaced repository views and unmounted owners cannot restore cache entries through late success/error replies. Functional updates read the latest committed active owner before pruning. No RPC contract changes or claim of subprocess cancellation.

Actual production hook, React/happy-dom, 50 commits with 16 KiB messages per workspace; runtime boundary generates responses without a mock retaining them. Live React state contains:

Visited workspaces Baseline retained results / commits Fixed retained results / commits
5 5 / 250 3 / 150
50 50 / 2,500 3 / 150

After 50 visits, message content falls from 40,986,500 to 2,459,220 UTF-8 bytes; the conservative estimate for all result strings falls from 82,065,000 to 4,924,020 bytes. Git reads remain 50, then 51 on revisit. These are retained payload counts and string estimates, not measured whole-app heap/RSS or latency.

Validation: final focused hook suites pass 16/16 on Node 24.22.0. Substituting the exact pinned baseline hook makes six of eight new cases fail; positive recent-display and oversized-active controls still run. Coverage includes author/nested-ref accounting, recent display/refetch, oversized active/inactive transitions, deferred evicted success/error, collapsed owner replacement, removed IDs, existing errors/recovery, and visibility/folder gates.

Required pnpm check:changed --maxWorkers=2 runs under verified Node 24: 19/21 checks pass, including renderer typecheck and static checks. Localization fails on three pre-existing Turkish keys; English/Turkish catalogs match pinned baseline 2d3e7e4520 byte for byte. Broad affected-test selection was bounded after repeated runs without results; it remains unverified. Independent source review completed. Native Windows/macOS/WSL/SSH and a rendered Electron app were not exercised.

Checked production patches of open #9597, #9598, #14305, #14405, #14472, #25541, #6746, #12814, and #29737, plus #34796. Panel expansion guards, pagination, graph scope, layout persistence, and navigation availability are separate; inspected history maps remain uncapped across workspaces. Their integration may require source conflict resolution and must preserve the appropriate page state. #34965 separately addresses commit-comparison owner caches.

@OrcaWin

OrcaWin commented Oct 30, 2026

Copy link
Copy Markdown
Collaborator Author

Closing. Each cached entry is at most 50 commits, so realistic retention is a few MB at most. The ~82 MB figure comes from synthetic 16 KiB messages. The PR adds byte accounting, reworks the owner key and the layout-effect ref, shows a loading state when revisiting a workspace beyond the 4 most recent, and conflicts with the WSL wake rewrite of use-git-history.ts (#35410/#35854/#35897).

@OrcaWin OrcaWin closed this Oct 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant