Claude Code commited on
Commit
05f6d06
·
1 Parent(s): d079764

god: Fix cooldown check for alive state - prevent stuck task submission cycles

Browse files
Files changed (1) hide show
  1. scripts/conversation-loop.py +14 -1
scripts/conversation-loop.py CHANGED
@@ -2032,7 +2032,20 @@ def build_turn_message(speaker, other, ctx):
2032
  parts.append(f"\nClaude Code JUST FINISHED with a result. Review it briefly, then write your [TASK]...[/TASK] IMMEDIATELY.")
2033
  parts.append(f"Do NOT discuss at length. 1 turn max to review, then [TASK]. Your priority is SPEED of iteration.")
2034
  elif child_state["alive"]:
2035
- if recent_task_reminder:
 
 
 
 
 
 
 
 
 
 
 
 
 
2036
  last_completed, last_by, last_at = recent_task_reminder
2037
  parts.append(f"\n{CHILD_NAME} is alive, Claude Code is IDLE.")
2038
  parts.append(f"\nREMEMBER: {last_by} just completed '{last_completed}' ({int(time.time() - last_at)}s ago).")
 
2032
  parts.append(f"\nClaude Code JUST FINISHED with a result. Review it briefly, then write your [TASK]...[/TASK] IMMEDIATELY.")
2033
  parts.append(f"Do NOT discuss at length. 1 turn max to review, then [TASK]. Your priority is SPEED of iteration.")
2034
  elif child_state["alive"]:
2035
+ # Check cooldown even when alive - a recent push may have triggered cooldown
2036
+ check_and_clear_cooldown()
2037
+ cooldown_remaining = 0
2038
+ if last_rebuild_trigger_at > 0:
2039
+ elapsed = time.time() - last_rebuild_trigger_at
2040
+ cooldown_remaining = max(0, REBUILD_COOLDOWN_SECS - elapsed)
2041
+ if cooldown_remaining > 0:
2042
+ # Cooldown active - agents should discuss, not submit tasks
2043
+ parts.append(f"\n{CHILD_NAME} is {child_state['stage']}. Cooldown active: {int(cooldown_remaining)}s remaining. Discuss plans but DO NOT assign [TASK] until cooldown ends.")
2044
+ if recent_task_reminder:
2045
+ last_completed, last_by, last_at = recent_task_reminder
2046
+ parts.append(f"\nREMEMBER: {last_by} just completed '{last_completed}' ({int(time.time() - last_at)}s ago).")
2047
+ parts.append(f"When cooldown ends, FIRST review whether that fix worked before writing a new [TASK].")
2048
+ elif recent_task_reminder:
2049
  last_completed, last_by, last_at = recent_task_reminder
2050
  parts.append(f"\n{CHILD_NAME} is alive, Claude Code is IDLE.")
2051
  parts.append(f"\nREMEMBER: {last_by} just completed '{last_completed}' ({int(time.time() - last_at)}s ago).")