fix: prune stale VCS refs and speed listRefs#99
Conversation
There was a problem hiding this comment.
💡 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} |
There was a problem hiding this comment.
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 👍 / 👎.
| const remoteRefEntries = | ||
| remoteRefListResult.exitCode === 0 | ||
| ? parseForEachRefEntries(remoteRefListResult.stdout) | ||
| : []; |
There was a problem hiding this comment.
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 👍 / 👎.
Summary
Supersedes #94 after that PR's Codex review starved on the same head.
Validation