Skip to content

fix(delegation): classify terminal trace status by exit_code#16162

Closed
ChuckChambers wants to merge 1 commit into
NousResearch:mainfrom
ChuckChambers:fix/delegate-terminal-trace-exit-code
Closed

fix(delegation): classify terminal trace status by exit_code#16162
ChuckChambers wants to merge 1 commit into
NousResearch:mainfrom
ChuckChambers:fix/delegate-terminal-trace-exit-code

Conversation

@ChuckChambers

Copy link
Copy Markdown

Summary

Fix delegation observability so terminal tool traces are classified by structured exit_code when present, instead of substring matching on the word error.

Previously a successful terminal result such as:

{"output":"error count: 0", "exit_code": 0, "error": null}

was marked as status: "error" in tool_trace because the serialized result contained the string error near the beginning.

Changes

  • Teach _looks_like_error_output() to treat JSON results with exit_code as terminal-style results.
  • exit_code == 0 => not an error.
  • nonzero exit_code => error.
  • Reuse _looks_like_error_output() for _run_single_child() tool_trace status.
  • Add regression test for terminal output containing the word error with exit_code: 0.

Test plan

source venv/bin/activate
pytest -q tests/tools/test_delegate.py -q

Result: passed.

@alt-glitch alt-glitch added type/bug Something isn't working P3 Low — cosmetic, nice to have tool/delegate Subagent delegation labels Apr 26, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Likely duplicate of #13898 — same root cause: delegate_tool.py naive string heuristic marks exit_code:0 terminal results as errors when output contains 'error'.

@ChuckChambers

Copy link
Copy Markdown
Author

Looks like this duplicates #13898. Same root cause: delegate_tool.py was classifying tool traces with a naive string heuristic, so successful terminal results with exit_code: 0 were marked as errors when the serialized output contained "error". Closing in favor of #13898.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P3 Low — cosmetic, nice to have tool/delegate Subagent delegation type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants