gabriel / musehub public
patch task/fix-mpack-index-param-limit #1 / 1
AI Agent gabriel · 24 days ago · May 17, 2026 · Diff

Fix asyncpg 32767 bind-param overflow on MPackIndex inserts at xl scale

At xl (5000 commits, 25000 objects) the MPackIndex filter-then-add pattern produced a SELECT ... IN (...) with 35000 bind params (5k commits + 5k snapshots + 25k objects), exceeding asyncpg's 32767 limit. The job crashed with InterfaceError before writing any MPackIndex rows, making xl fetch hang indefinitely waiting for coverage that never arrived.

Fix: replace filter-then-add with chunked _pg_insert().on_conflict_do_nothing() in both the background job (mpack_index_rows) and mpack_gc (new_rows). Chunk size 5000 keeps each statement well under the param limit. on_conflict_do_nothing is correct here: the PK is (entity_id, mpack_id) and the model docstring already calls this out as the idiomatic pattern.

Also: _safe_delete_repo now warns instead of raises on cleanup failure — deletion can fail transiently while the background job is still writing to the repo; stale repos are purged at the next run's start. Added step-level timing and verbose _wait_indexed logging to bench_cli.py for xl-scale debugging.

sha256:5aed54e2001fe3ba0230b494791d9b38b3ff4c9b3f60ef2a66e4adf51f7927e6 sha
sha256:b1b569fb25544e6b0e7e7790033d6574775eec17e4a2bcd2fb1852f9d81f56cb snapshot
← Older Oldest on task/fix-mpack-index-param-limit
All commits
Newer → Latest on task/fix-mpack-index-param-limit

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:5aed54e2001fe3ba0230b494791d9b38b3ff4c9b3f60ef2a66e4adf51f7927e6 --body "your comment"