Skip to content

fix(worktrees): retain evidence evicted before the first Git catalog - #829

Merged
Juliusolsson05 merged 2 commits into
mainfrom
fix/worktree-evidence-before-catalog
Sep 7, 2026
Merged

fix(worktrees): retain evidence evicted before the first Git catalog#829
Juliusolsson05 merged 2 commits into
mainfrom
fix/worktree-evidence-before-catalog

Conversation

@Juliusolsson05

Copy link
Copy Markdown
Owner

Problem

LiveWorktreeReconciler.observe folds records evicted from the 500-record live window into the baseline through foldRaw, and foldRaw skips every non-worktree-state record while the cwd has no Git catalog. A session that buffers more than 500 relevant records before the first catalog reply loses attribution for all but the newest 500. Surfaced by the independent review of #808 and filed as #822; pre-existing on main.

Change

  • Records evicted before a catalog exists go to a second list, deferredRaw, bounded by the same recentRawLimit.
  • The first rebuild() that has a catalog folds the deferred list into the baseline in arrival order.
  • Hydration and history adoption release tracker keys for deferred records too, so they cannot double-count.
  • summarize() reports deferredEvidenceCount and droppedBeforeCatalog so the debug panel can say when attribution is still incomplete.

Tests

  • Recorded Claude fixture, window of one, catalog pending: the first write is evicted, deferred, and present in the timeline after the catalog arrives (fails on main with one write).
  • Window of one, catalog never arrives, three records: one live, one deferred, one counted as dropped.

Verification

npm run typecheck, the work-context unit suite, npm run check:worktree-live-fixtures.

Fixes #822

🤖 Generated with Claude Code

https://claude.ai/code/session_013SULm3ApxebET2a8eLxKHd

Juliusolsson05 and others added 2 commits September 7, 2026 12:32
… catalog

Refs #822

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013SULm3ApxebET2a8eLxKHd
Records evicted from the live window while Git IPC was still pending were
folded through foldRaw, which skips every non-worktree-state record without
a catalog. They were dropped silently, so a fast-starting session lost
attribution for everything before its newest 500 relevant records. Hold
those records in a second bounded list and fold them on the first rebuild
that has a catalog; count, do not hide, what the bound drops.

Fixes #822

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013SULm3ApxebET2a8eLxKHd
@Juliusolsson05
Juliusolsson05 merged commit 28c2ad3 into main Sep 7, 2026
2 checks passed
@Juliusolsson05
Juliusolsson05 deleted the fix/worktree-evidence-before-catalog branch September 7, 2026 22:02
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.

bug(worktrees): evidence buffered before first Git catalog arrival can be folded away

1 participant