fix: retry cleared object database pack slots#2726
Merged
Conversation
The fix is very lean and updates `load_one()` to do the same as its sibling function, which triggers a refresh of its internal index and it can recover just fine. --- agent Store::load_pack() assumed a non-stable handle could not retain a pack id after its slot was cleared. Disk consolidation can move a replacement index into a free slot without advancing the generation, leaving the old marker valid enough to reach the cleared slot and panic. Add a regression that loads an index without its pack, renames the index/pack pair to model an external repack, refreshes through a second handle, and then reads through the stale handle. This deterministically reproduced the single-index panic without invoking fetch or needing threads. Treat cleared slots as stale lookup misses in both single-index and multi-pack-index paths, including the recheck under the slot lock. Existing find logic then reloads indices and retries the object lookup. Co-authored-by: GPT 5.6 <codex@openai.com>
Sebastian Thiel (Byron)
force-pushed
the
odb-fix-unreachable
branch
from
July 19, 2026 14:41
6ae9eb1 to
dac9fd5
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Tasks
This section is for Byron only. Models continuing this PR must not add, remove, check, uncheck, rename, or reorder checkboxes here.
Everything below this line was generated by Codex GPT-5.
Created by Codex on behalf of Byron. Byron will review before this is ready to merge.
Fixes #2723
Summary
Reproduction
The test loads an index while leaving its pack unopened, renames the index/pack pair to model an external repack, refreshes the shared store through a second handle, and reads the same object through the stale first handle. Before the fix this panicked at the single-index cleared-slot assertion; afterward it reloads the moved index and finds the object.
Git baseline
Current git.git at a23bace963d508bd96983cc637131392d3face18 uses packfile_store_reprepare() in packfile.c to clear initialization and rescan the pack directory.
Validation