Skip to content

fix: prune stale VCS refs and speed listRefs#99

Open
wizzoapp[bot] wants to merge 5 commits into
mainfrom
wizzo/vcs-hygiene
Open

fix: prune stale VCS refs and speed listRefs#99
wizzoapp[bot] wants to merge 5 commits into
mainfrom
wizzo/vcs-hygiene

Conversation

@wizzoapp

@wizzoapp wizzoapp Bot commented Jul 6, 2026

Copy link
Copy Markdown

Summary

  • add a VCS maintenance reactor that periodically prunes stale checkpoint refs and Git worktree metadata
  • keep the retained checkpoint window plus turn-zero and boundary predecessor refs needed for diffs
  • speed up vcs.listRefs with for-each-ref while falling back when local or remote refs are corrupt

Supersedes #94 after that PR's Codex review starved on the same head.

Validation

  • vp test run apps/server/src/vcs/VcsMaintenanceReactor.test.ts apps/server/src/vcs/GitVcsDriverCore.test.ts apps/server/src/orchestration/Layers/ProjectionSnapshotQuery.test.ts apps/server/src/orchestration/Layers/ProviderRuntimeIngestion.test.ts
  • vp check
  • vp run --filter t3 typecheck
  • scripts/factory/precommit-gate.sh --prepare

@wizzoapp wizzoapp Bot marked this pull request as ready for review July 6, 2026 21:22

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 886d413360

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

WHERE thread_id = ${threadId}
AND checkpoint_turn_count IS NOT NULL
) checkpoint_rows
WHERE checkpoint_rows.checkpoint_rank <= ${CHECKPOINT_DIFF_CONTEXT_KEEP_PER_THREAD}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep the extra checkpoint out of thread detail

This helper is also used by getThreadDetailById, so using MAX_THREAD_CHECKPOINTS + 1 leaks the boundary predecessor into the thread detail payload that the web diff panel treats as a selectable turn. In a long thread, e.g. latest checkpoint 505, thread detail now includes checkpoint 5; selecting it makes the client request turn diff 4→5, but CheckpointDiffQuery.getTurnDiff cannot find checkpoint 4 in the retained context and returns CheckpointRefUnavailable. Use a separate boundary query for diff context, or keep the thread-detail list capped at the UI-visible retention limit.

Useful? React with 👍 / 👎.

Comment on lines +2208 to 2211
const remoteRefEntries =
remoteRefListResult.exitCode === 0
? parseForEachRefEntries(remoteRefListResult.stdout)
: [];

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Fall back before dropping all remote refs

When any remote-tracking ref points at a missing object, git for-each-ref refs/remotes exits non-zero, and this branch turns the whole remote list into []. I checked the same corrupt-ref scenario with git branch --remotes, and it still prints the healthy remote branches, so repos with one bad cached ref now lose every remote branch from listRefs; mirror the local fallback instead of discarding them all.

Useful? React with 👍 / 👎.

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.

0 participants