fix: report subagent status as completed when summary exists (#3829)
When a subagent hit max_iterations, status was always 'failed' even if it produced a usable summary via _handle_max_iterations(). This happened because the status check required both completed=True AND a summary, but completed is False whenever max_iterations is reached (run_agent.py line 7969). Now gates status on whether a summary was produced — if the subagent returned a final_response, the parent has usable output regardless of iteration budget. The exit_reason field already distinguishes 'completed' vs 'max_iterations' for anything that needs to know how the task ended. Closes #1899.
This commit is contained in:
@@ -289,7 +289,10 @@ def _run_single_child(
|
||||
|
||||
if interrupted:
|
||||
status = "interrupted"
|
||||
elif completed and summary:
|
||||
elif summary:
|
||||
# A summary means the subagent produced usable output.
|
||||
# exit_reason ("completed" vs "max_iterations") already
|
||||
# tells the parent *how* the task ended.
|
||||
status = "completed"
|
||||
else:
|
||||
status = "failed"
|
||||
|
||||
Reference in New Issue
Block a user