Claude Code Claude Opus 4.6 commited on
Commit
274b48d
·
1 Parent(s): 6842c99

god: Fix task blocking - agents write [TASK] when CC is busy

Browse files

When CC finishes with EARLY FAILURE (very short result, failed during init),
agents must immediately re-assign the task, not discuss. The turn message
now detects early failure and forces immediate [TASK] re-assignment.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Files changed (1) hide show
  1. scripts/conversation-loop.py +9 -1
scripts/conversation-loop.py CHANGED
@@ -1985,11 +1985,19 @@ def build_turn_message(speaker, other, ctx):
1985
  parts.append(f"\nREMEMBER: {last_by} just completed '{last_completed}' ({int(time.time() - last_at)}s ago).")
1986
  parts.append(f"When cooldown ends, FIRST review whether that fix worked before writing a new [TASK].")
1987
  elif child_state["alive"] and cc_status.get("result"):
 
 
 
1988
  if recent_task_reminder:
1989
  last_completed, last_by, last_at = recent_task_reminder
1990
  parts.append(f"\n{CHILD_NAME} is alive. REMEMBER: {last_by} just completed '{last_completed}' ({int(time.time() - last_at)}s ago).")
 
 
 
 
 
1991
  # ZERO-PUSH EMERGENCY: No "brief review" - agents abuse this to keep discussing
1992
- if _push_count_this_task == 0:
1993
  parts.append(f"\n🛑 CC FINISHED but ZERO pushes THIS TASK! Do NOT discuss. Do NOT review.")
1994
  parts.append(f"Write ONLY [TASK]...[/TASK] this turn. NO other text.")
1995
  parts.append(f"Agents keep saying 'monitoring' and 'planning' instead of pushing. STOP IT.")
 
1985
  parts.append(f"\nREMEMBER: {last_by} just completed '{last_completed}' ({int(time.time() - last_at)}s ago).")
1986
  parts.append(f"When cooldown ends, FIRST review whether that fix worked before writing a new [TASK].")
1987
  elif child_state["alive"] and cc_status.get("result"):
1988
+ result = cc_status.get("result", "")
1989
+ # Detect early failure: very short result likely means CC failed before doing actual work
1990
+ is_early_failure = len(result) < 500 and "===" not in result and "[tool" not in result
1991
  if recent_task_reminder:
1992
  last_completed, last_by, last_at = recent_task_reminder
1993
  parts.append(f"\n{CHILD_NAME} is alive. REMEMBER: {last_by} just completed '{last_completed}' ({int(time.time() - last_at)}s ago).")
1994
+ # EARLY FAILURE: CC failed during init - agents MUST re-assign immediately, no discussion
1995
+ if is_early_failure:
1996
+ parts.append(f"\n🛑 CRITICAL: CC FAILED during initialization! Result is too short ({len(result)} chars).")
1997
+ parts.append(f"Write ONLY [TASK]...[/TASK] this turn. NO discussion. NO review.")
1998
+ parts.append(f"CC is now IDLE. Re-assign the task immediately with SAME instructions.")
1999
  # ZERO-PUSH EMERGENCY: No "brief review" - agents abuse this to keep discussing
2000
+ elif _push_count_this_task == 0:
2001
  parts.append(f"\n🛑 CC FINISHED but ZERO pushes THIS TASK! Do NOT discuss. Do NOT review.")
2002
  parts.append(f"Write ONLY [TASK]...[/TASK] this turn. NO other text.")
2003
  parts.append(f"Agents keep saying 'monitoring' and 'planning' instead of pushing. STOP IT.")