The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix: a skill_manage batch whose rollback failed stays a visible failure
Tekniumbb6d5464c634
diff --git a/agent/display.py b/agent/display.pyindex 7ee2b75b035..935e8501e47 100644--- a/agent/display.py+++ b/agent/display.py@@ -1020,6 +1020,17 @@ def _degraded_suffix(data: dict) -> str:# 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"})+# Except a batch whose rollback failed (tools/skill_manager_batch.py::_rollback): partial changes+# are left on disk, which the user does have to see.+_UNSAFE_FAILURE_MARKER = "ROLLBACK FAILED"+++def is_neutral_failure(tool_name: str, result: Any) -> bool:+ """True when a failed call of ``tool_name`` should render neutrally (see NEUTRAL_FAILURE_TOOLS)."""+ if tool_name not in NEUTRAL_FAILURE_TOOLS:+ return False+ text = result if isinstance(result, str) else repr(result)+ return _UNSAFE_FAILURE_MARKER not in textdef _detect_tool_failure(tool_name: str, result: Any) -> tuple[bool, str]: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 5ccd512f74a..2c2e615f2f6 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@@ -108,6 +108,7 @@ describe('buildToolView error confidence', () => {[{ 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'],+ [{ toolName: 'skill_manage', result: { success: false, error: "batch aborted, ROLLBACK FAILED for 'demo'" } }, 'error'],[{ 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 d4d152ec123..a7ac8e353ff 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@@ -107,8 +107,19 @@ 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'])+ * act on β except a batch whose rollback failed, which left partial changes.+ * Mirrors agent/display.py::is_neutral_failure. */+const NEUTRAL_FAILURE_TOOLS: ReadonlySet<string> = new Set(['skill_manage'])++export function isNeutralFailure(toolName: string | undefined, result: unknown): boolean {+ if (!NEUTRAL_FAILURE_TOOLS.has(toolName ?? '')) {+ return false+ }++ const text = typeof result === 'string' ? result : JSON.stringify(result ?? '')++ return !text.includes('ROLLBACK FAILED')+}/** A call that reported failure, from the part's flag or its result body.* Explicit success beats stale envelope errors, as in individual rows. */@@ -116,7 +127,7 @@ export function toolCallFailed(part: { isError?: boolean; result?: unknown; toolconst result = parseMaybeObject(part.result)return (- !NEUTRAL_FAILURE_TOOLS.has(part.toolName ?? '') &&+ !isNeutralFailure(part.toolName, part.result) &&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 68f57c82f23..40356da8b83 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@@ -16,8 +16,8 @@ import {compactPreview,contextValue,formatDurationSeconds,+ isNeutralFailure,isRecord,- NEUTRAL_FAILURE_TOOLS,numberValue,parseMaybeObject,unwrapToolPayload@@ -736,7 +736,7 @@ function toolStatus(part: ToolPart, resultRecord: Record<string, unknown>): Toolreturn 'notice'}- if (NEUTRAL_FAILURE_TOOLS.has(part.toolName)) {+ if (isNeutralFailure(part.toolName, part.result)) {return 'notice'}diff --git a/hermes_cli/cli_modern_layout.py b/hermes_cli/cli_modern_layout.pyindex e61cc570426..c94746d86fb 100644--- a/hermes_cli/cli_modern_layout.py+++ b/hermes_cli/cli_modern_layout.py@@ -168,9 +168,9 @@ def tool_row(function_name: str, args: dict | None, duration: float, result=None"""``π Read calc.py 0.2s`` / ``β $ pytest -q 0.4s [exit 1]`` β one row per completed call, led bythe 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_parts+ from agent.display import get_tool_row_parts, is_neutral_failurerows = get_tool_row_parts(function_name, args or {}, result, is_error=bool(is_error))- neutral = function_name in NEUTRAL_FAILURE_TOOLS+ neutral = is_neutral_failure(function_name, result)out = []for index, (emoji, verb, detail, suffix) in enumerate(rows):verb = (verb or function_name).strip()diff --git a/tests/hermes_cli/test_cli_modern_layout.py b/tests/hermes_cli/test_cli_modern_layout.pyindex abcd2fd2e99..3bc10f5d796 100644--- a/tests/hermes_cli/test_cli_modern_layout.py+++ b/tests/hermes_cli/test_cli_modern_layout.py@@ -220,6 +220,9 @@ def test_refused_skill_write_reads_neutral_not_failed():row = tool_row("skill_manage", {"operations": [{"action": "patch", "name": "hermes-agent-dev"}]}, 1.1, refused)assert _plain(row).startswith(get_tool_emoji("skill_manage") + " "), rowassert "[operations[0]" in _plain(row) and _RED not in row, row+ # A failed rollback left partial changes on disk: that one stays a red failure.+ broken = refused.replace('(limit: 100,000)."', '(limit: 100,000). β batch aborted, ROLLBACK FAILED for demo."')+ assert _plain(tool_row("skill_manage", {"operations": []}, 1.1, broken)).startswith("β ")def test_every_block_is_framed_by_bars_and_blank_lines(monkeypatch):diff --git a/tests/tui_gateway/test_show_reasoning_display_gate.py b/tests/tui_gateway/test_show_reasoning_display_gate.pyindex 9cc861c27a9..a152fa0a4fd 100644--- a/tests/tui_gateway/test_show_reasoning_display_gate.py+++ b/tests/tui_gateway/test_show_reasoning_display_gate.py@@ -135,6 +135,9 @@ def test_tool_progress_off_does_not_surface_a_refused_skill_write(monkeypatch):server._on_tool_complete("tools-off-skill", "tool-skill", "skill_manage", {"operations": []}, refused)assert _lifecycle(events, "tool-skill") == []+ broken = json.dumps({"success": False, "error": "batch aborted, ROLLBACK FAILED for 'demo' (EACCES)"})+ server._on_tool_complete("tools-off-skill", "tool-broken", "skill_manage", {"operations": []}, broken)+ assert _lifecycle(events, "tool-broken") == ["tool.complete"]def test_subagent_tool_mirror_follows_tool_progress_not_reasoning(monkeypatch):diff --git a/tui_gateway/tool_progress.py b/tui_gateway/tool_progress.pyindex 8d82c87f5a7..59abe514b9a 100644--- a/tui_gateway/tool_progress.py+++ b/tui_gateway/tool_progress.py@@ -362,10 +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_TOOLS+ from agent.display import is_neutral_failureif (_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 (name not in NEUTRAL_FAILURE_TOOLS and _tool_result_needs_user(result))):+ or (_tool_result_needs_user(result) and not is_neutral_failure(name, 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.