Skip to content

The all-in-one local AI studio for your desktop: chat, image and video generation and a coding agent in one free, open source app. Windows and Linux. No Docker, no terminal, no cloud required.

fix(agent): a failed step shows its error once

purple79cb7af702ae
diff --git a/src/components/chat/ToolCallBlock.tsx b/src/components/chat/ToolCallBlock.tsx
index 963d3463..f3aa2c7a 100644
--- a/src/components/chat/ToolCallBlock.tsx
+++ b/src/components/chat/ToolCallBlock.tsx
@@ -475,8 +475,10 @@ function ToolCallBlockImpl({ toolCall, onApprove, onReject }: Props) {
</pre>
)}
- {/* Error */}
- {toolCall.error && (
+ {/* Error. Not when the result above already says it: a refused
+ path showed "Path escapes the allowed workspace" twice
+ (3.0.4 box run). */}
+ {toolCall.error && !(toolCall.result ?? '').includes(toolCall.error.trim()) && (
<pre className="text-[0.55rem] leading-relaxed text-gray-500 dark:text-gray-500 bg-gray-50 dark:bg-white/[0.02] rounded px-2 py-1">
{toolCall.error}
</pre>
diff --git a/src/components/chat/__tests__/a-refused-path-says-it-once.test.tsx b/src/components/chat/__tests__/a-refused-path-says-it-once.test.tsx
new file mode 100644
index 00000000..0d66d0c1
--- /dev/null
+++ b/src/components/chat/__tests__/a-refused-path-says-it-once.test.tsx
@@ -0,0 +1,40 @@
+/**
+ * @vitest-environment jsdom
+ *
+ * 3.0.4 box run: an opened failed step showed "Error: Path escapes the allowed
+ * workspace." twice, once in the result and once more in the error box below.
+ */
+import { describe, it, expect, afterEach } from 'vitest'
+import { createElement } from 'react'
+import { render, cleanup, fireEvent } from '@testing-library/react'
+import { ToolCallBlock } from '../ToolCallBlock'
+import type { AgentToolCall } from '../../../types/agent-mode'
+
+afterEach(() => cleanup())
+
+const open = (toolCall: AgentToolCall) => {
+ const view = render(createElement(ToolCallBlock, { toolCall }))
+ fireEvent.click(view.getByText(toolCall.toolName))
+ return view.container.textContent ?? ''
+}
+const count = (text: string, needle: string) => text.split(needle).length - 1
+
+describe('a failed step says its error once', () => {
+ it('error already in the result: shown once', () => {
+ const text = open({
+ id: 't1', toolName: 'file_read', args: { path: 'C:\\Users\\Public\\secret-notes.txt' }, status: 'failed', timestamp: 1,
+ result: 'Error: Path escapes the allowed workspace.\n workspace root: C:\\ws\n requested path: C:\\Users\\Public\\secret-notes.txt',
+ error: 'Error: Path escapes the allowed workspace.',
+ } as AgentToolCall)
+ expect(count(text, 'Path escapes the allowed workspace')).toBe(1)
+ expect(text).toContain('requested path')
+ })
+
+ it('NEGATIVE CONTROL: an error the result does not carry still shows', () => {
+ const text = open({
+ id: 't2', toolName: 'file_read', args: { path: 'a.txt' }, status: 'failed', timestamp: 1,
+ error: 'File not found: a.txt',
+ } as AgentToolCall)
+ expect(count(text, 'File not found: a.txt')).toBe(1)
+ })
+})