Repository navigation
Tags
Tags
fix(checkpoints): bound what the shadow repo can stage and keep The shadow repo had no upper bound of any kind. `save()` ran `git add -A` over the whole --work-tree with only an extension-based exclude list, and nothing ever gc'd or pruned the per-session repo. Incident 2026-08-17, reconstructed from the artifacts: two sessions whose cwd was $HOME (235 GB, mode code, two records long — they never took a turn) staged 14 GB, and an interrupted `git repack` stranded a 14.5 GB and a 12.4 GB `tmp_pack_*` under checkpoints/. 26 GB, zero refs, zero commits, nothing reachable and nothing that would ever collect it. The blobs were not corruption; the bound was simply missing in two independent places. Three guards: - A 5000-entry cap on the staging path. Counted with `git status --porcelain -uall`, which is load-bearing rather than tidy: the default --porcelain collapses an untracked directory into one line, so $HOME measures 206 entries that way and 1,146,894 with -uall. A cap on the default count would never have fired on the incident it exists to prevent. Calibration: this repo presents 404 entries. Over the cap, save() returns null and warns once per session (edit.ts saves after every write, so a per-call notice would repeat on every tool call). - `gc.auto=0` on every shadow-repo git invocation, so a checkpoint can never trigger a repack — the step that produced the temp packs. - A sweep of stranded `tmp_pack_*` at initialize(), so a session resumed later heals its own residue. Explicitly scoped: this does not reclaim the two dead $HOME sessions, whose ids are never constructed again. Verified: each guard mutation-tested individually — reverting -uall, the cap, or the sweep each turns the new suite red, and the module restores byte-identical. npx tsc --noEmit clean; 137 files / 2004 passed.
PreviousNext