59a0ad3c2b
Existing read-loop/rejection-loop breakers key on CONSECUTIVE rounds, so a single interleaved success resets them — the hole that let the 2026-07-16 audition run-3 thrash npm install against a hallucinated package across 57 inferences. Add repeatedToolFailureLoop: cumulative count per normalized tool-failure signature within a stage; once a signature hits stageFailureLoopLimit (default 6) the stage fails with STAGE_LOOP_BREAK_GATE and the step handler routes straight to recovery (never retried in place). Pure fold over recorded events (replay-safe, invariants #8/#9); ToolExecutionFailedEvent lacks stageId so failures correlate via invocationId -> ToolInvocationRequestedEvent. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>