The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix: a refused skill_manage write reads neutral, not as a red failure
Teknium74cc8a105fe8
diff --git a/agent/display.py b/agent/display.pyindex 590be47d763..7ee2b75b035 100644--- a/agent/display.py+++ b/agent/display.py@@ -1015,6 +1015,13 @@ def _degraded_suffix(data: dict) -> str:return f" [{_tail_trunc(text, _DEGRADED_SUFFIX_MAX_LEN)}]"+# Tools whose refused calls are the agent's own retry loop, not something the user must act on: a+# skill_manage write refused by the size cap, a stale old_string or a guard is re-planned by the+# agent. Renderers show these rows neutrally; the failure still reaches the model and the loop+# guardrail unchanged (display-only).+NEUTRAL_FAILURE_TOOLS = frozenset({"skill_manage"})++def _detect_tool_failure(tool_name: str, result: Any) -> tuple[bool, str]:"""Return ``(is_failure, suffix)`` for a tool result, e.g. ``(True, " [exit 1]")``."""if result is None or file_mutation_result_landed(tool_name, result):diff --git a/apps/desktop/src/components/assistant-ui/tool/fallback-model.test.ts b/apps/desktop/src/components/assistant-ui/tool/fallback-model.test.tsindex bda833c25ff..5ccd512f74a 100644--- a/apps/desktop/src/components/assistant-ui/tool/fallback-model.test.ts+++ b/apps/desktop/src/components/assistant-ui/tool/fallback-model.test.ts@@ -107,6 +107,7 @@ describe('buildToolView error confidence', () => {[{ result: { meta: { error: 'a previous attempt' }, data: { count: 1 } } }, 'success'],[{ toolName: 'read_file', result: { error: 'Permission denied reading /repo/private.ts' } }, 'error'],[{ toolName: 'patch', result: { error: 'File not found: /repo/session-view.ts' } }, 'error'],+ [{ toolName: 'skill_manage', result: { success: false, error: 'SKILL.md content is over the limit' } }, 'notice'],[{ result: { success: false, result: { output: { error: { message: 'Connection refused' } } } } }, 'error']]diff --git a/apps/desktop/src/components/assistant-ui/tool/fallback-model/format.ts b/apps/desktop/src/components/assistant-ui/tool/fallback-model/format.tsindex c75b6800126..d4d152ec123 100644--- a/apps/desktop/src/components/assistant-ui/tool/fallback-model/format.ts+++ b/apps/desktop/src/components/assistant-ui/tool/fallback-model/format.ts@@ -105,12 +105,18 @@ export function parseMaybeObject(value: unknown): Record<string, unknown> {}}+/** Tools whose refused calls are the agent's own retry loop (a skill write+ * refused by the size cap or a stale old_string), not something the user must+ * act on. Mirrors agent/display.py::NEUTRAL_FAILURE_TOOLS. */+export const NEUTRAL_FAILURE_TOOLS: ReadonlySet<string> = new Set(['skill_manage'])+/** A call that reported failure, from the part's flag or its result body.* Explicit success beats stale envelope errors, as in individual rows. */-export function toolCallFailed(part: { isError?: boolean; result?: unknown }): boolean {+export function toolCallFailed(part: { isError?: boolean; result?: unknown; toolName?: string }): boolean {const result = parseMaybeObject(part.result)return (+ !NEUTRAL_FAILURE_TOOLS.has(part.toolName ?? '') &&result.success !== true &&result.ok !== true &&Boolean(part.isError || result.success === false || result.ok === false || extractToolErrorMessage(part.result))diff --git a/apps/desktop/src/components/assistant-ui/tool/fallback-model/index.ts b/apps/desktop/src/components/assistant-ui/tool/fallback-model/index.tsindex 91f86eefb7b..68f57c82f23 100644--- a/apps/desktop/src/components/assistant-ui/tool/fallback-model/index.ts+++ b/apps/desktop/src/components/assistant-ui/tool/fallback-model/index.ts@@ -17,6 +17,7 @@ import {contextValue,formatDurationSeconds,isRecord,+ NEUTRAL_FAILURE_TOOLS,numberValue,parseMaybeObject,unwrapToolPayload@@ -735,6 +736,10 @@ function toolStatus(part: ToolPart, resultRecord: Record<string, unknown>): Toolreturn 'notice'}+ if (NEUTRAL_FAILURE_TOOLS.has(part.toolName)) {+ return 'notice'+ }+// A rejected memory write is a budget negotiation, not a failure: the store// refuses an over-limit batch and the agent retries smaller. Soft warning β// never destructive-red beside routine bookkeeping.diff --git a/hermes_cli/cli_modern_layout.py b/hermes_cli/cli_modern_layout.pyindex 096a911617d..e61cc570426 100644--- a/hermes_cli/cli_modern_layout.py+++ b/hermes_cli/cli_modern_layout.py@@ -166,20 +166,22 @@ def completed_tool_line(cli, function_name: str, args: dict | None, duration: fldef tool_row(function_name: str, args: dict | None, duration: float, result=None, is_error: bool = False) -> str:"""``π Read calc.py 0.2s`` / ``β $ pytest -q 0.4s [exit 1]`` β one row per completed call, led by- the tool's emoji (the classic ``β`` row's), or a red ``β`` when that entry failed."""- from agent.display import get_tool_row_parts+ the tool's emoji (the classic ``β`` row's), or a red ``β`` when that entry failed. A tool in+ ``NEUTRAL_FAILURE_TOOLS`` keeps its emoji and shows the reason dim."""+ from agent.display import NEUTRAL_FAILURE_TOOLS, get_tool_row_partsrows = get_tool_row_parts(function_name, args or {}, result, is_error=bool(is_error))+ neutral = function_name in NEUTRAL_FAILURE_TOOLSout = []for index, (emoji, verb, detail, suffix) in enumerate(rows):verb = (verb or function_name).strip()- mark = f"{_RED}β{_RST}" if suffix is not None else (emoji or "β")+ mark = f"{_RED}β{_RST}" if suffix is not None and not neutral else (emoji or "β")line = f"{mark} {_BOLD}{verb[:1].upper()}{verb[1:]}{_RST}"if detail:line += f" {detail}"if index == len(rows) - 1 and duration >= 0.1:line += f" {_DIM}{duration:.1f}s{_RST}"if suffix:- line += f"{_RED}{suffix}{_RST}"+ line += f"{_DIM if neutral else _RED}{suffix}{_RST}"out.append(line)return "\n".join(out)diff --git a/tests/hermes_cli/test_cli_modern_layout.py b/tests/hermes_cli/test_cli_modern_layout.pyindex 907315b84b0..abcd2fd2e99 100644--- a/tests/hermes_cli/test_cli_modern_layout.py+++ b/tests/hermes_cli/test_cli_modern_layout.py@@ -209,6 +209,19 @@ def test_tool_rows_keep_the_classic_tool_emoji():assert failed.startswith("β ") and "[exit 1]" in failed, failed+def test_refused_skill_write_reads_neutral_not_failed():+ """A skill_manage write the agent will re-plan (size cap, stale old_string) keeps the tool's own+ emoji and a dim reason: no red β for the agent's routine retry loop."""+ from agent.display import get_tool_emoji+ from hermes_cli.cli_modern_layout import _RED, tool_row++ refused = ('{"success": false, "error": "operations[0] (patch on \'hermes-agent-dev\') failed: '+ 'SKILL.md content is 100,193 characters (limit: 100,000)."}')+ row = tool_row("skill_manage", {"operations": [{"action": "patch", "name": "hermes-agent-dev"}]}, 1.1, refused)+ assert _plain(row).startswith(get_tool_emoji("skill_manage") + " "), row+ assert "[operations[0]" in _plain(row) and _RED not in row, row++def test_every_block_is_framed_by_bars_and_blank_lines(monkeypatch):"""User message, reasoning and answer each read as: blank line, bar, content, bar, blank line.The blank line after a closing bar is paid by whatever prints next (a tool row, the footer)diff --git a/tests/tui_gateway/test_show_reasoning_display_gate.py b/tests/tui_gateway/test_show_reasoning_display_gate.pyindex 37720ec5bc9..9cc861c27a9 100644--- a/tests/tui_gateway/test_show_reasoning_display_gate.py+++ b/tests/tui_gateway/test_show_reasoning_display_gate.py@@ -126,6 +126,17 @@ def test_tool_progress_off_keeps_only_essential_tool_rows(monkeypatch):assert failed[0][2]["result"]["error"] == "disk full"+def test_tool_progress_off_does_not_surface_a_refused_skill_write(monkeypatch):+ """Answer-only mode forwards failures the user must see; a skill write the agent re-plans is not one."""+ events = _capture(monkeypatch)+ _session(monkeypatch, "tools-off-skill", show_reasoning=True, tool_progress="off")++ refused = json.dumps({"success": False, "error": "SKILL.md content is 100,193 characters (limit: 100,000)."})+ server._on_tool_complete("tools-off-skill", "tool-skill", "skill_manage", {"operations": []}, refused)++ assert _lifecycle(events, "tool-skill") == []++def test_subagent_tool_mirror_follows_tool_progress_not_reasoning(monkeypatch):for sid, show_reasoning, tool_progress, expected in (("child-reasoning-off", False, "all", ["tool.start", "tool.complete"]),diff --git a/tui_gateway/tool_progress.py b/tui_gateway/tool_progress.pyindex db024b80a4e..8d82c87f5a7 100644--- a/tui_gateway/tool_progress.py+++ b/tui_gateway/tool_progress.py@@ -362,9 +362,10 @@ def _on_tool_complete(sid: str, tool_call_id: str, name: str, args: dict, resultpayload.update(todo_state)if session is not None:_cache_todo_state(session, todo_state)+ from agent.display import NEUTRAL_FAILURE_TOOLSif (_tool_progress_enabled(sid) or payload.get("inline_diff") or _tool_lifecycle_required_for_ui(name)or is_todo_tool_name(name) or _connector_tool_lifecycle(name, args)- or _tool_result_needs_user(result)):+ or (name not in NEUTRAL_FAILURE_TOOLS and _tool_result_needs_user(result))):_emit_tool_lifecycle("tool.complete", sid, name, args, payload)# Task state is application data, not tool-progress chrome: a dedicated full-snapshot event lets# every client reconcile without parsing tool args.diff --git a/website/docs/user-guide/cli.md b/website/docs/user-guide/cli.mdindex cf4abba893f..2adca4b4c50 100644--- a/website/docs/user-guide/cli.md+++ b/website/docs/user-guide/cli.md@@ -207,7 +207,7 @@ Added multiply; pytest isn't installed here, so I ran the tests directly: 2 passgpt-5-mini Β· ctx [ββββββββ] 4% Β· ~/project (main) enter interrupt Β· tab queue Β· ctrl+c stop```-- A 40-column bar opens each user message and answer (accent) and each reasoning block (dim); reasoning streams live as in classic and ends with a `β΄ Thought for 3s Β· <title>` line. `β―` your message, a finished tool call led by its emoji (`π Read`, `π» $`; `β` in red when it failed, with its exit code), `β` an edit's diff under its row, `β€` the answer, and `β` the turn's summary line.+- A 40-column bar opens each user message and answer (accent) and each reasoning block (dim); reasoning streams live as in classic and ends with a `β΄ Thought for 3s Β· <title>` line. `β―` your message, a finished tool call led by its emoji (`π Read`, `π» $`; `β` in red when it failed, with its exit code; a refused `skill_manage` write keeps its emoji and shows the reason dim, since the agent retries it itself), `β` an edit's diff under its row, `β€` the answer, and `β` the turn's summary line.- The composer's top rule carries the live activity (spinner, what's running, elapsed time, streamed tokens) on the left and the session title on the right; no spinner row is printed into the scrollback.- The status line sits under the composer: the same fields as the classic status bar (model, context, cache hit, latency, tokens/s, background work, goal, duration, YOLOβ¦) plus the working directory (with git branch) on the left; the keys that do something right now on the right.- The welcome banner is the same in both layouts.