-
Notifications
You must be signed in to change notification settings - Fork 5.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: allow to continue when the agent is stuck in interactive mode #5597
Conversation
- Remove almost_stuck field from State class - Remove almost_stuck counter from StuckDetector - Simplify stuck detection logic to focus on actual loop detection - Update tests to remove almost_stuck assertions
- Add UI mode awareness to stuck detection - Only consider history after last user message in UI mode - Keep existing behavior in headless mode - Add comprehensive tests for both modes Fix: #5480
- Use headless_mode flag to determine stuck detection behavior - In interactive mode (not headless), only consider history after last user message - Keep existing behavior in headless mode - Add comprehensive tests for both modes Fix: #5480
- Use not_headless parameter to match AgentController's headless_mode - Remove unnecessary interactive_mode concept - Update tests to use consistent terminology - Keep behavior the same, just clearer naming
56167cc
to
8589b0a
Compare
- Use headless_mode parameter to match AgentController - Remove confusing double negative (not_headless) - Keep behavior the same, just clearer naming
- Use reversed() to find last user message - Stop searching once found (break) - Same behavior, just more efficient
The same filter works perfectly in both modes: - In headless: actively filters user messages - In non-headless: no-op (already sliced after last user message)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thanks for the fix!
Hi! I started running the integration tests on your PR. You will receive a comment with the results shortly. |
Trigger by: Pull Request (integration-test label on PR #5597) Total cost: USD 0.00
Integration Tests Report (DeepSeek) Total cost: USD 0.00
Download testing outputs (includes both Haiku and DeepSeek results): Download |
End-user friendly description of the problem this fixes or functionality that this introduces
Let user continue when the agent gets stuck in a loop (UI-only).
Changes:
Clean up:
almost_stuck
field and related codeImprove stuck detection:
headless_mode
to determine behaviorOptimizations:
reversed()
to find last user messageTests:
Fix: #5480
To run this PR locally, use the following command: