fix: prevent exhaustion loophole and add lean gate mode#430
Merged
Conversation
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.
… for acceptance criteria
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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)
requireEvidenceCoverage(defaulttrue) andGOAL_GUARD_REQUIRE_EVIDENCE_COVERAGEenv varLean gate mode (fixes issue 2)
leanGatesconfig option (defaultfalse)goal-prompt-auditor,goal-reviewer,goal-final-auditor)GOAL_GUARD_LEAN_GATES=1env varFiles changed (13 files, +260/-15)
plugins/goal-guard/agents.js— addLEAN_BASE_GATESplugins/goal-guard/gates.js— addevidenceCoverageMet(), modifyrequiredGates()andcompletionAllowed()plugins/goal-guard/config.js— addrequireEvidenceCoverageandleanGatesconfig optionsplugins/goal-guard/completion.js— evidence-coverage reason in block messagesplugins/goal-guard/autocontinue.js— evidence guidance in continuation messagesplugins/goal-guard/summary.js— usecompletionAllowedfrom gatesTesting