mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-06-04 07:31:58 +00:00
fix(cli): surface tool failures with specific error messages
Improves the failure suffix on tool completion lines. Instead of always showing '[error]' for non-terminal failures, parse the tool's JSON result and surface the actual message: Before: ┊ 📖 read foo.py 0.1s [error] After: ┊ 📖 read foo.py 0.1s [File not found: foo.py] Before: ┊ 💻 $ ls bad 0.1s [exit 127] After: ┊ 💻 $ ls bad 0.1s [ls: cannot access 'bad'...] Adds a _trim_error helper that strips long absolute paths down to the filename and caps the suffix at 48 chars so it stays readable on narrow terminals. Threads the tool result through the tool.completed progress callback so agent/display.get_cute_tool_message can inspect it. The cli.py [error] post-suffix is removed in favor of the richer suffix _detect_tool_failure now produces directly. Originally proposed in PR #17194 by Albert.Zhou; salvaged onto current main with the dead-code preview-length bumps dropped (tool_preview_length config already strictly caps previews, so the per-tool n= defaults are unreachable). Co-authored-by: Albert.Zhou <albert748@gmail.com>
This commit is contained in:
parent
6a1aa420e7
commit
094d732378
3 changed files with 41 additions and 9 deletions
4
cli.py
4
cli.py
|
|
@ -10264,9 +10264,7 @@ class HermesCLI:
|
|||
self._last_scrollback_tool = function_name
|
||||
try:
|
||||
from agent.display import get_cute_tool_message
|
||||
line = get_cute_tool_message(function_name, stored_args, duration)
|
||||
if is_error:
|
||||
line = f"{line} [error]"
|
||||
line = get_cute_tool_message(function_name, stored_args, duration, result=kwargs.get("result"))
|
||||
_cprint(f" {line}")
|
||||
except Exception:
|
||||
pass
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue