Spaces:
Paused
Paused
Claude Code Claude Opus 4.6 commited on
Commit ·
861c45e
1
Parent(s): dbad2c4
god: Clear pending task flag when CC not running (fix infinite loop)
Browse filesAfter auto-termination for handoff, cc_status["result"] is cleared to ""
which caused cc_just_finished to be False. This prevented
_pending_task_just_submitted from being cleared, causing agents to
stay blocked and EMERGENCY LOOP BREAK to keep re-assigning the same task.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
scripts/conversation-loop.py
CHANGED
|
@@ -2311,8 +2311,13 @@ def do_turn(speaker, other, space_url):
|
|
| 2311 |
_pending_task_just_submitted = False
|
| 2312 |
# CRITICAL FIX: Also clear pending task flag when CC finishes, regardless of speaker
|
| 2313 |
# This fixes the race condition where Adam's turn comes before Eve's after CC finishes
|
|
|
|
| 2314 |
elif cc_just_finished and _pending_task_just_submitted:
|
| 2315 |
_pending_task_just_submitted = False
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2316 |
|
| 2317 |
# Add to history with timestamp (text stays CLEAN for agent context)
|
| 2318 |
ts = datetime.datetime.utcnow().strftime("%H:%M")
|
|
|
|
| 2311 |
_pending_task_just_submitted = False
|
| 2312 |
# CRITICAL FIX: Also clear pending task flag when CC finishes, regardless of speaker
|
| 2313 |
# This fixes the race condition where Adam's turn comes before Eve's after CC finishes
|
| 2314 |
+
# ALSO: Clear when CC is not running (handles auto-termination where result is cleared)
|
| 2315 |
elif cc_just_finished and _pending_task_just_submitted:
|
| 2316 |
_pending_task_just_submitted = False
|
| 2317 |
+
elif not cc_status["running"] and _pending_task_just_submitted:
|
| 2318 |
+
# CC finished but result was cleared (e.g., auto-termination for handoff)
|
| 2319 |
+
# Clear the pending flag so agents can submit new tasks
|
| 2320 |
+
_pending_task_just_submitted = False
|
| 2321 |
|
| 2322 |
# Add to history with timestamp (text stays CLEAN for agent context)
|
| 2323 |
ts = datetime.datetime.utcnow().strftime("%H:%M")
|