gabriel / musehub public
BREAKING task/fix-pull-benchmark-bg-job #1 / 1
AI Agent gabriel · 29 days ago · May 17, 2026 · Diff

Fix background job CommitGraph generation corruption and concurrent ObjectRef insert race

Three bugs caused the 'l pull' benchmark to time out waiting for 1001 commits:

1. Background job used _gen_map.get(parent, 0) as fallback when the parent commit was from a prior mpack (not in the current job's batch). This silently produced generation=1 for the delta commit whose parent had generation=1000, then session.merge() overwrote the correct value written by the inline path. Fix: DB lookup for parent generations not in _gen_map.

2. session.merge() on *Ref tables (ObjectRef, CommitRef, SnapshotRef) has a TOCTOU race when inline path and background job run concurrently: both SELECT find nothing, both try INSERT, one gets UniqueViolationError. Fix: reverted all *Ref table writes to _pg_insert().on_conflict_do_nothing(). CommitGraph keeps session.merge() since stale generation values must be overwritten.

3. _wait_indexed probe called muse log without -n, hitting the 1000-commit default page limit. With 1001 commits the probe always returned 1000 even after full indexing. Fix: pass -n str(n_commits + 10) to the log call.

sha256:266ea404ff866b0f227c309d5dea843e291261c9c98f7f96d259e6918789daf4 sha
sha256:0c0671e607aa6e4b17af7a82c5736cbb1036a3bb57376fe212dead4df5c0caa5 snapshot
← Older Oldest on task/fix-pull-benchmark-bg-job
All commits
Newer → Latest on task/fix-pull-benchmark-bg-job

0 comments

No comments yet. Be the first to start the discussion.

To add a comment, use the Muse CLI: muse hub commit comment sha256:266ea404ff866b0f227c309d5dea843e291261c9c98f7f96d259e6918789daf4 --body "your comment"