Skip to content

fix: prevent exhaustion loophole and add lean gate mode#430

Merged
devinoldenburg merged 2 commits into
mainfrom
fix/exhaustion-loophole-and-lean-gates
Jun 21, 2026
Merged

fix: prevent exhaustion loophole and add lean gate mode#430
devinoldenburg merged 2 commits into
mainfrom
fix/exhaustion-loophole-and-lean-gates

Conversation

@devinoldenburg

Copy link
Copy Markdown
Owner

Problem

Two critical issues found during trials:

1. Exhaustion loophole (verdict all PASS but goal not reached)

A strong LLM can exhaust every possible approach, convince all gate reviewers it "tried everything and no approach works", and get PASS verdicts — completing the goal even though the main goal was never achieved. This violates the Ralph loop's core meaning: unfinished is not success.

2. High token consumption from the checker set

The full base set (5 reviewers) plus contextual gates pulled in from goal text make token consumption extremely high per review cycle.

Solution

Evidence-coverage gate (fixes issue 1)

  • now requires fresh recorded evidence for every acceptance criterion
  • This is a programmatic check — no LLM reviewer can be persuaded past it
  • If the goal wasn't achieved, there's no verified evidence for the criteria → completion stays blocked
  • Configurable via requireEvidenceCoverage (default true) and GOAL_GUARD_REQUIRE_EVIDENCE_COVERAGE env var
  • Continuation messages now explicitly detect and report uncovered criteria

Lean gate mode (fixes issue 2)

  • New leanGates config option (default false)
  • When enabled: reduces base gates from 5 to 3 (goal-prompt-auditor, goal-reviewer, goal-final-auditor)
  • Disables contextual gates entirely
  • Dramatically cuts token consumption per review cycle
  • Evidence-coverage check stays active even in lean mode → exhaustion loophole stays closed
  • Configurable via GOAL_GUARD_LEAN_GATES=1 env var

Files changed (13 files, +260/-15)

  • plugins/goal-guard/agents.js — add LEAN_BASE_GATES
  • plugins/goal-guard/gates.js — add evidenceCoverageMet(), modify requiredGates() and completionAllowed()
  • plugins/goal-guard/config.js — add requireEvidenceCoverage and leanGates config options
  • plugins/goal-guard/completion.js — evidence-coverage reason in block messages
  • plugins/goal-guard/autocontinue.js — evidence guidance in continuation messages
  • plugins/goal-guard/summary.js — use completionAllowed from gates
  • Tests: updated 7 existing tests + added 13 new tests (207→232 total)

Testing

  • All 232 tests pass (207 existing + 13 new)
  • New tests cover: evidence coverage met/missing/stale, lean gate reduction, config defaults

Two critical fixes:

1. Exhaustion loophole — a strong LLM could exhaust every approach,
   convince all reviewers it 'tried everything', and get PASS verdicts
   even though the main goal was never achieved (violates Ralph loop).

   Fix:  now requires evidence coverage — every
   acceptance criterion must have at least one piece of fresh (post-last-edit)
   recorded verification evidence. This is a programmatic gate no LLM can
   persuade past. Configurable via  (default true).

2. Lean gate mode — the full 5+contextual reviewer set consumes significant
   tokens per review cycle. Add  config option (default false)
   that reduces base gates to 3 (prompt-auditor, reviewer, final-auditor)
   and disables contextual gates, dramatically cutting token consumption.
   The evidence-coverage check keeps the exhaustion loophole closed even
   in lean mode.

Also: continuation messages now detect and report uncovered acceptance
criteria, so an agent stuck in an exhaustion loop gets explicit guidance.
@devinoldenburg devinoldenburg merged commit c93422b into main Jun 21, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant