The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix: judge a skill_manage rollback failure by its error text only
Tekniumfcfabaec5ae9
diff --git a/agent/display.py b/agent/display.pyindex 935e8501e47..154ad653171 100644--- a/agent/display.py+++ b/agent/display.py@@ -1029,8 +1029,11 @@ 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 text+ # Only the error text: a refused patch also returns a file_preview of the skill, whose own+ # prose may mention the marker.+ data = result if isinstance(result, dict) else safe_json_loads(result)+ error = data.get("error") if isinstance(data, dict) else result+ return _UNSAFE_FAILURE_MARKER not in str(error or "")def _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 2c2e615f2f6..80b9da0346a 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,7 +107,13 @@ 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'],+ [+ {+ toolName: 'skill_manage',+ result: { success: false, error: 'SKILL.md content is over the limit', file_preview: 'ROLLBACK FAILED notes' }+ },+ '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 a7ac8e353ff..315f681da92 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@@ -116,9 +116,11 @@ export function isNeutralFailure(toolName: string | undefined, result: unknown):return false}- const text = typeof result === 'string' ? result : JSON.stringify(result ?? '')+ // Only the error text: a refused patch also returns a file_preview of the+ // skill, whose own prose may mention the marker.+ const error = parseMaybeObject(result).error ?? (typeof result === 'string' ? result : '')- return !text.includes('ROLLBACK FAILED')+ return !String(error).includes('ROLLBACK FAILED')}/** A call that reported failure, from the part's flag or its result body.diff --git a/tests/hermes_cli/test_cli_modern_layout.py b/tests/hermes_cli/test_cli_modern_layout.pyindex 3bc10f5d796..77d23bc32f1 100644--- a/tests/hermes_cli/test_cli_modern_layout.py+++ b/tests/hermes_cli/test_cli_modern_layout.py@@ -216,7 +216,8 @@ def test_refused_skill_write_reads_neutral_not_failed():from hermes_cli.cli_modern_layout import _RED, tool_rowrefused = ('{"success": false, "error": "operations[0] (patch on \'hermes-agent-dev\') failed: '- 'SKILL.md content is 100,193 characters (limit: 100,000)."}')+ 'SKILL.md content is 100,193 characters (limit: 100,000).", '+ '"file_preview": "Never ignore a ROLLBACK FAILED note."}')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