fix: prevent loop from getting stuck when research is complete#1
Closed
fix: prevent loop from getting stuck when research is complete#1
Conversation
The main research loop would exit with "circuit_breaker_open" errors even when research was effectively complete. Root cause: circuit breaker check ran before graceful exit check, so 3 "no progress" loops after completion would halt the loop before detecting the RESEARCH_COMPLETE marker. Changes: - Swap exit check order: graceful_exit now runs BEFORE circuit_breaker - Read exit_signal directly from .response_analysis in should_exit_gracefully() - Case-insensitive RESEARCH_COMPLETE grep (handles Research_Complete, etc.) - Multi-location SYNTHESIS.md search (evidence dir, parent dir, project root) - Circuit breaker recognizes SYNTHESIS.md creation as research progress - Circuit breaker won't open when is_research_complete() returns true - Fix --continue to use --resume with session ID - Validate CLAUDE_PERMISSION_MODE against allowlist - Update CLAUDE.md with exit priority order and completion detection docs 14 new tests added across 3 test files (test_circuit_breaker.bats is new). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
fatal: could not read Username for 'https://github.com': No such device or address |
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.
Summary
should_exit_gracefully()(which callsis_research_complete()) runs beforeshould_halt_execution()(circuit breaker)Changes
smithers_loop.sh--continue→--resume, validate permission modelib/phase_state_machine.shlib/circuit_breaker.shsmithers_status.shCLAUDE.mdtests/unit/test_circuit_breaker.batstests/unit/test_exit_detection.batstests/unit/test_phase_state_machine.batsCode review findings (addressed)
--continue "$session_id"was incorrect (--continue takes no args) → fixed to--resume "$session_id"CLAUDE_PERMISSION_MODEagainst allowlist (acceptEdits, default, plan)Test plan
.smithers/evidence/SYNTHESIS.mdwithRESEARCH_COMPLETE, run smithers → should exit cleanly🤖 Generated with Claude Code