Skip to content

fix: report subagent status as completed when summary exists#3829

Merged
teknium1 merged 1 commit intomainfrom
hermes/hermes-76df6a95
Mar 30, 2026
Merged

fix: report subagent status as completed when summary exists#3829
teknium1 merged 1 commit intomainfrom
hermes/hermes-76df6a95

Conversation

@teknium1
Copy link
Copy Markdown
Contributor

Summary

When a subagent hit max_iterations, its status was always reported as "failed" even when it produced a usable summary. This is because run_agent.py sets completed = final_response is not None and api_call_count < self.max_iterations — so hitting the iteration limit always means completed=False, regardless of output.

Fix

Gate status on whether a summary was produced, not on the completed flag:

if interrupted:
    status = "interrupted"
elif summary:
    status = "completed"
else:
    status = "failed"

The exit_reason field already distinguishes "completed" vs "max_iterations" for anything that needs to know how the task ended. The status field now answers "did the subagent produce usable output?"

Tests

54 existing delegation tests pass. No test changes needed — existing tests already assert status: "completed" for tasks with summaries.

Closes #1899 (took the intent, simplified the approach — original PR used fragile error-substring scanning of tool messages).

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.
@teknium1 teknium1 merged commit e4d575e into main Mar 30, 2026
2 of 3 checks passed
itsXactlY pushed a commit to itsXactlY/hermes-agent that referenced this pull request Mar 30, 2026
…earch#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 NousResearch#1899.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant