fix(#39): fetch/mpack cache MISS self-heals instead of retrying forever
Root-caused the 'muse clone hangs forever / never completes' half of #39 by reproducing it locally against gabriel/muse: the primary fetch path (POST /fetch/mpack -> wire_fetch_mpack) depends entirely on a pre-built musehub_fetch_mpack_cache row for the requested branch tip. That row is only ever written by the fetch.mpack.prebuild background job, which is only ever enqueued at push time. Once a repo's cache row expires (7-day TTL) and nobody pushes to it again, the cache MISS path had nothing to re-trigger a rebuild -- it just raised MPackNotReadyError() every time, and the client's retry loop (30s x 4, 120s budget) waited for a job that would never exist.
Confirmed via direct RDS query against staging: gabriel/muse's cache rows for both branch heads (main, dev) were correct but had expired 5 days earlier (2026-09-04), with the last successful prebuild dated 2026-08-28. Every clone attempt against gabriel/muse on both staging and production hit this exact dead end.
Fix: on a real (non-force_build) cache MISS, enqueue a fetch.mpack.prebuild job for the repo's current branch tips before raising MPackNotReadyError. Reuses the existing _enqueue_repair_prebuild helper, which is already idempotent (enqueue_job skips the insert when a job of this type is already pending), so it's safe to call on every MISS including the client's own retry attempts.
Verified against the real, previously-broken gabriel/muse repo locally: clone succeeded after exactly one 30s retry (prebuild job ran in ~10s), 1492 commits and 1155 blobs, full working tree restored and verified (733 files, muse log/status both correct). gabriel/musehub also re-verified clean.
Three new regression tests (FMC_21/21b/21c) in test_fetch_mpack_prebuild.py: a real MISS enqueues a job; repeated MISSes (matching the client's own retry loop) don't create duplicate jobs; and the full self-heal sequence (expired cache -> MISS enqueues job -> running the job -> next fetch is a real HIT on freshly-built content) works end-to-end. 138 tests across the full fetch/wire/prebuild/cache-invalidation suite pass with zero regressions.
Semantic Changes
7 symbols
0 comments
muse hub commit comment sha256:efcebc1682a099c4e426c776ad4f4d0c29f2e8e68fd8b17e170f55d16c6f866f --body "your comment"
No comments yet. Be the first to start the discussion.