clever-window-69122
10/10/2025, 9:14 PMcalm-artist-7206
10/10/2025, 9:31 PMtimeout parameter for bash commands, so the agent could set a higher timeout - maybe you could prompt with exactly that?clever-window-69122
10/10/2025, 9:44 PMlimited-student-10747
10/13/2025, 1:48 PMlimited-student-10747
10/13/2025, 1:49 PMclever-window-69122
10/13/2025, 5:25 PMlimited-student-10747
10/13/2025, 5:35 PMclever-window-69122
10/13/2025, 6:17 PMclever-window-69122
10/15/2025, 11:43 PMsleep 300 to enforce a fixed wait period.
Despite these attempts, the agent still ends up looping after the timeout, rather than maintaining its idle state as expected.
This is one of the prompts I have tried :
POLLING PROTOCOL:
1. Make ONE POST request to start the tool
2. Send empty command (just press Enter, no text) to check status
3. If still processing: Wait 5 minutes before sending the next empty command
4. After 5 minutes: Send another empty command
5. Repeat every 5 minutes for up to 15 minutes (4 polls total) or until you get results
CRITICAL TIMING RULE
- Poll every 5 minutes - wait exactly 5 minutes between polls
- You do NOT need to run sleep commands
- You do NOT need to send multiple commands in a row
- Wait 5 minutes, then send ONE empty command
- Repeat this pattern: wait 5 minutes → send empty command
CRYSTAL CLEAR POLLING INSTRUCTIONS
- You are the session manager - you control the timing
- You do NOT need to run sleep commands
- You do NOT need to send multiple commands in a row
- Wait 5 minutes between polls, then send ONE empty command
- Pattern: wait 5 minutes → send empty command → wait 5 minutes → send empty command
WHAT "WAIT 5 MINUTES" MEANS
- When you send an empty command and get "still processing"
- You must WAIT 5 minutes before sending the next command
- During these 5 minutes, you CANNOT send any commands
- You CANNOT send empty commands
- You CANNOT check status
- You CANNOT do anything except wait
- Only AFTER 5 minutes, send your next command
EXAMPLE OF WHAT YOU SHOULD DO
1. Send empty command → Get "still processing"
2. WAIT 5 minutes (do nothing during this time)
3. After 5 minutes: Send empty command
4. If still processing: WAIT 5 minutes (do nothing during this time)
5. After 5 minutes: Send empty command
6. Repeat until results received
EXAMPLE OF WHAT YOU'RE DOING WRONG
1. Send empty command → Get "still processing"
2. IMMEDIATELY send another empty command
3. Send another empty command
4. Send another empty command
5. This causes loop errors!
CRITICAL: ONE COMMAND AT A TIME
- Send ONE command, wait for it to complete, then send the NEXT command
- DO NOT send multiple commands in sequence
- DO NOT send empty commands while sleep 180 is running
- DO NOT check if sleep is still running - just let it complete
Please let me know if anyone has any suggestions or methods to resolve this issue.limited-student-10747
10/16/2025, 8:40 AMclever-window-69122
10/16/2025, 5:00 PMlimited-student-10747
10/16/2025, 5:04 PMlimited-student-10747
10/16/2025, 5:04 PMlimited-student-10747
10/16/2025, 5:05 PMnutritious-balloon-65098
10/16/2025, 5:06 PMnutritious-balloon-65098
10/16/2025, 5:10 PMopenhands/sdk/conversation/stuck_detector.py
◦ Detects multiple patterns: repeating action-observation cycles (4 repetitions), action-error cycles (3 repetitions), agent monologues (3 messages), and alternating patterns (6 actions/observations)
◦ Can be enabled/disabled via stuck_detection=True parameter in LocalConversation.__init__()
2. Is it configurable? ❌ NO
◦ The detection thresholds are hardcoded in the StuckDetector class
◦ No way to adjust sensitivity for different use cases
◦ Only binary on/off control is available
Action Taken
Since the answer is (yes, no), I've opened an issue on the agent-sdk repository as requested:
Issue Created: #762 - Make Stuck Detection Thresholds Configurable
The issue includes:
• Problem statement: Explains how hardcoded thresholds cause false positives for legitimate use cases (like polling long-running APIs)
• Real-world use case: Documents the exact scenario from the conversation context where agents need to poll every 5 minutes for up to 15 minutes but get stuck after 4 repetitions
• Proposed solution: Detailed design with code examples showing how to make thresholds configurable while maintaining backward compatibility
• Benefits: Highlights flexibility while keeping safe defaults
• Implementation checklist: Clear action items for implementation
The issue proposes adding configurable threshold parameters to StuckDetector and exposing them through LocalConversation.__init__(), allowing users to adjust thresholds like:
conversation = Conversation(
agent=agent,
workspace=os.getcwd(),
stuck_detection=True,
stuck_detection_thresholds={
'action_observation': 10, # Allow 10 repetitions for polling
'action_error': 5,
}
)
This would solve the problem described in your conversation context where agents legitimately need to perform repetitive polling operations without triggering false "stuck in loop" errors.
<sub>View full conversation</sub>nutritious-balloon-65098
10/16/2025, 5:49 PMopenhands/sdk/conversation/stuck_detector.py
2. It is NOT configurable - thresholds were hardcoded (4, 3, 3, 6)
Actions Taken
Since the answer was (yes, no) as you specified, I:
1. Created GitHub Issue #762 proposing configurable stuck detection thresholds with detailed design
◦ Issue URL: https://github.com/All-Hands-AI/agent-sdk/issues/762
2. Implemented the Fix with minimal code changes:
◦ Added threshold parameters to StuckDetector class: action_observation_threshold, action_error_threshold, monologue_threshold, alternating_pattern_threshold
◦ Updated LocalConversation to accept stuck_detection_thresholds mapping
◦ All thresholds maintain 100% backward compatibility with existing defaults
3. Comprehensive Testing:
◦ ✅ All 7 existing tests pass
◦ ✅ Added 6 new tests covering various threshold scenarios
◦ Total: 13/13 tests passing
4. Created Draft PR #763:
◦ https://github.com/All-Hands-AI/agent-sdk/pull/763
◦ Includes detailed description linking to the issue and Slack discussion
◦ Ready for review when you are
Usage Example
Users can now configure thresholds for long-running tasks:
conv = LocalConversation(
agent=agent,
workspace="/tmp",
stuck_detection_thresholds={
"action_observation": 10, # Higher for polling scenarios
"action_error": 5,
"monologue": 8,
"alternating_pattern": 12
}
)
This directly addresses the issue where agents were getting stuck in loops when polling long-running API endpoints!
<sub>View full conversation</sub>nutritious-balloon-65098
10/16/2025, 6:35 PMStuckDetector class), but it was NOT configurable (thresholds were hardcoded).
Since the answer was (yes, no), I've completed the following:
✅ Work Completed
1. Created GitHub Issue #762: "Make stuck detection thresholds configurable"
◦ https://github.com/All-Hands-AI/agent-sdk/issues/762
2. Implemented the fix:
◦ Modified StuckDetector.__init__() to accept 4 threshold parameters with defaults:
▪︎ action_observation_threshold=4
▪︎ action_error_threshold=3
▪︎ monologue_threshold=3
▪︎ alternating_pattern_threshold=6
◦ Updated LocalConversation.__init__() to accept optional stuck_detection_thresholds dict parameter
◦ Maintains full backward compatibility (all defaults match original hardcoded values)
3. Added tests: Created 2 essential tests in `tests/cross/test_stuck_detector_config.py`:
◦ Test custom action_observation_threshold
◦ Test mixed custom thresholds
4. Created Draft PR #763: https://github.com/All-Hands-AI/agent-sdk/pull/763
◦ All GitHub Actions checks passing ✅:
▪︎ Pre-commit checks: success
▪︎ Run tests (9/9 tests passing): success
▪︎ Agent Server: success
The stuck detection thresholds are now fully configurable, enabling users to adjust loop detection sensitivity based on their specific use cases (like your long-running API polling scenario).
<sub>View full conversation</sub>curved-angle-80449
10/16/2025, 7:03 PMclever-window-69122
10/16/2025, 9:01 PM