mirror of
https://github.com/garrytan/gbrain.git
synced 2026-07-30 19:49:14 +00:00
On stateless deploys (Docker on EB/K8s/Fly — what the cloud recipes produce), a container restart wipes federated clones; each is only re-materialized when that source's next sync job runs. Until then the v0.41.27.0 git short-circuit cannot probe HEAD at all, and the check fell through to raw wall-clock age — which no-op syncs never advance — so every QUIET source read as stale/FAIL right after a restart. Observed live: 16-source brain, 12 clones gone after a config-update restart, doctor 70 -> 25-35, monitor alert storm (score < threshold) while every clone that DID exist was byte-identical to origin HEAD. Fix: classify the probe three ways (probeSourceGitState: unchanged / changed / unavailable). 'unavailable' + chunker match borrows the REMOTE path's newest_content_at lag (v0.41.32.0) — DB-only, no subprocess — so a quiet source reads healthy while real missed work (content newer than last sync) still reports stale. 'changed' (readable clone, HEAD moved / dirty) keeps wall-clock exactly as before, and a chunker mismatch disables the fallback (D7: a pending re-chunk is never masked). isSourceUnchangedSinceSync stays as a boolean facade so source-health.ts is untouched. Tests: 6 new doctor cases (F1-F6, incl. three-bucket invariant) + 7 probeSourceGitState unit cases; existing suites green (doctor 90, git-head 21, source-health 28), tsc --noEmit clean.