Skip to content

fix(delegate): tool_trace false-positive error detection for short outputs#26374

Closed
flooryyyy wants to merge 1 commit into
NousResearch:mainfrom
flooryyyy:fix-delegate-trace-error
Closed

fix(delegate): tool_trace false-positive error detection for short outputs#26374
flooryyyy wants to merge 1 commit into
NousResearch:mainfrom
flooryyyy:fix-delegate-trace-error

Conversation

@flooryyyy

Copy link
Copy Markdown
Contributor

Problem

The delegate_tool tool_trace marked successful tool calls as "status": "error" when the output was short.

Root cause: the error detection heuristic checked if the substring "error" appeared in the first 80 chars of the tool result:

is_error = bool(content and "error" in content[:80].lower())

For short JSON outputs like:

{"output":"test1\n","exit_code":0,"error":null}

The "error" key (from "error":null) lands within the first 80 chars → false positive flagged as error.

This only affected the TUI overlay display and tool_trace diagnostics — the tool itself executed successfully. Long outputs avoided the bug because the "error" key was pushed past the 80-char window.

Fix

Replace the substring heuristic with a call to _looks_like_error_output() (already defined at line 272 in the same file), which:

  • Parses JSON and checks the error key is truthy (null / false / "" do not trigger)
  • Checks status field for error/failed/timeout
  • Checks first line for classic error markers (error:, traceback, exception:, failed:)

Testing

Verified with the existing _looks_like_error_output function:

  • {"output":"test1","exit_code":0,"error":null}False (correct)
  • {"output":"","exit_code":127,"error":"command not found"}True (correct)
  • Empty string → False (correct)

Old heuristic: flagged the first case as True (wrong).

@flooryyyy

Copy link
Copy Markdown
Contributor Author

opened this due to #26369 containing a commit from #26308, hope that is fine

@daimon-nous daimon-nous Bot added type/bug Something isn't working P3 Low — cosmetic, nice to have tool/delegate Subagent delegation labels May 15, 2026
teknium1 added a commit that referenced this pull request May 17, 2026
…tors

Adds release-note attribution mappings for 10 contributors from the
low-hanging-fruit salvage group 2 batch:
- @shellybotmoyer (PR #26661, #25576)
- @ether-btc (PR #26632)
- @LifeJiggy (PR #26516)
- @nekwo (PR #26481)
- @flooryyyy (PR #26374)
- @dgians (PR #26034, incl. zealy-tzco bot-committer alias)
- @flanny7 (PR #27030)
- @hermesagent26 (PR #26438)
- @kriscolab (PR #26926, co-author on salvage commit)
@teknium1

Copy link
Copy Markdown
Contributor

Merged via PR #27292 — your commit was cherry-picked onto current main as part of a batch salvage of low-risk new-contributor PRs. Authorship preserved (fix(delegate): tool_trace false-positive error detection for short outputs). Thanks for the contribution.

@teknium1 teknium1 closed this May 17, 2026
gweeteve pushed a commit to gweeteve/hermes-agent that referenced this pull request Jun 2, 2026
…tors

Adds release-note attribution mappings for 10 contributors from the
low-hanging-fruit salvage group 2 batch:
- @shellybotmoyer (PR NousResearch#26661, NousResearch#25576)
- @ether-btc (PR NousResearch#26632)
- @LifeJiggy (PR NousResearch#26516)
- @nekwo (PR NousResearch#26481)
- @flooryyyy (PR NousResearch#26374)
- @dgians (PR NousResearch#26034, incl. zealy-tzco bot-committer alias)
- @flanny7 (PR NousResearch#27030)
- @hermesagent26 (PR NousResearch#26438)
- @kriscolab (PR NousResearch#26926, co-author on salvage commit)
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.

2 participants