fix: Stop agent when all features are complete#46
fix: Stop agent when all features are complete#46connor-tyndall wants to merge 1 commit intoAutoForgeAI:masterfrom
Conversation
Fixes issue where the agent continues indefinitely with regression tests after all features are implemented, wasting tokens on unnecessary sessions. Changes: - Add is_project_complete() function to progress.py that checks if all features are passing and none are in-progress - Add completion check in agent.py main loop that breaks out when project is complete, displaying a clear success message - Update coding_prompt.template.md with instructions for graceful shutdown when feature_get_next returns the completion signal This prevents the endless regression loop that was consuming ~10,000 tokens per unnecessary session after project completion. Closes AutoForgeAI#13 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
📝 WalkthroughWalkthroughThis PR implements automatic project completion detection to prevent the agent from running indefinitely after all features are passing. A new completion check function is added to evaluate project state, integrated into the agent loop with an early exit condition, and supplemented with prompt guidance explaining the completion workflow. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
📜 Recent review detailsConfiguration used: defaults Review profile: CHILL Plan: Pro 📒 Files selected for processing (3)
🧰 Additional context used📓 Path-based instructions (4).claude/templates/**/*.template.md📄 CodeRabbit inference engine (CLAUDE.md)
Files:
*.py📄 CodeRabbit inference engine (CLAUDE.md)
Files:
**/*.py📄 CodeRabbit inference engine (CLAUDE.md)
Files:
agent.py📄 CodeRabbit inference engine (CLAUDE.md)
Files:
🧠 Learnings (1)📚 Learning: 2026-01-10T08:23:04.012ZApplied to files:
🧬 Code graph analysis (1)agent.py (1)
🔇 Additional comments (4)
Comment |
Analysis: This PR is now obsoleteAfter a detailed code review comparing this PR against current master, this functionality has already been implemented via different commits. What's already on master:
Relevant commits on master:
Conclusion:The bug this PR aimed to fix (endless regression tests after completion) has been resolved through commits merged via PR #50 and #77. While this PR proposes a cleaner Recommendation: Close as obsolete. Thank you for the contribution - the issue was important and has been addressed! |
- Added BrokenSymlinkError exception class for broken symlink handling - Added is_broken_symlink() function to detect broken symlinks - Added get_symlink_target() function to read symlink targets - Enhanced resolve_target_path() to return 3-tuple (path, was_symlink, is_broken) - Updated validate_directory_access() to block broken symlinks by default - Added comprehensive debug logging for symlink resolution - Handle symlink loops gracefully (circular references) - Added allow_broken_symlinks parameter for configurable behavior All 5 feature steps verified: 1. Check if path is symlink using Path.is_symlink() 2. Resolve symlink to final target using Path.resolve() 3. Validate resolved target against allowed_directories 4. Handle broken symlinks gracefully 5. Log symlink resolution in debug output Tests: 39 new tests + 66 existing tests updated = 136 tests passing Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Summary
Fixes #13 - Agent continues indefinitely with regression tests after all features complete
is_project_complete()function to detect when all features are passingProblem
When all features are complete (
passing = totalandpending = 0), the agent:feature_get_nextand receives "All features are passing!"feature_get_for_regressionSolution
After each session with
status == "continue", the loop now checksis_project_complete():Test plan
is_project_complete()returns correct values for various states🤖 Generated with Claude Code
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.