Files
codebase-memory-mcp/scripts
Martin Vogel fb334f789f feat(index): skip the crashing file and index the rest (supervisor recovery)
Stage 3b contained a crash to the worker but returned a failure response. Now the
supervisor pins the exact crashing file, quarantines it, and re-indexes the
healthy files: index_repository returns status="indexed" with the crasher listed
in skipped[] (phase="crash") and every other file indexed normally.

On a crash/hang the supervisor re-runs the worker single-threaded with a per-file
marker (CBM_INDEX_MARKER_FILE) so the marker names the EXACT crasher; that file is
appended to a quarantine list (CBM_INDEX_QUARANTINE_FILE) and the worker is
re-spawned until a clean run indexes the good files. Bounded by
CBM_INDEX_MAX_RESTARTS (default 100); each crash quarantines one new file, so the
loop makes monotonic progress.

- internal/cbm/cbm.c/.h: per-file marker + a lazily-loaded crash-quarantine set,
  with a HARD guard at the top of cbm_extract_file (the one choke point every
  extract pass funnels through) that short-circuits a quarantined file to an empty
  result BEFORE the marker/parser — so no re-extracting pass (sequential
  pass_calls/usages/semantic on a cache miss) can crash on it again.
- src/pipeline/pipeline.c: effective_worker_count() honours CBM_INDEX_SINGLE_THREAD
  (=1 worker, sequential path) for exact single-threaded attribution.
- src/pipeline/pass_parallel.c, pass_definitions.c: report a quarantined file as a
  phase="crash" skip via the Stage-2 skip plumbing so it surfaces in skipped[].
- src/mcp/index_supervisor.{h,c}: cbm_index_spawn_worker gains single_thread /
  marker / quarantine knobs, passed to the child as inherited env around the
  sequential spawn.
- src/mcp/mcp.c: index_run_supervised recovery loop (attribute -> quarantine ->
  re-run until clean; else a contained-failure response).
- scripts/smoke-invariants.sh: inv_crasher_skipped_cli upgrades the 3b guard to the
  skip-continue contract (baseline crash escapes; supervised -> status indexed +
  crasher phase=crash + good file indexed + good file NOT skipped).

In-run quarantine only (not persisted across separate index runs); content-hash
persistence + re-admit is a follow-up.

Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
2026-07-03 13:31:04 +02:00
..