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.

feat(chat): a running tool row counts its seconds after 3 s (CA U1)

purpled9c9e65a99da
diff --git a/src/components/chat/ToolCallBlock.tsx b/src/components/chat/ToolCallBlock.tsx
index fc752fc7..616b0d6d 100644
--- a/src/components/chat/ToolCallBlock.tsx
+++ b/src/components/chat/ToolCallBlock.tsx
@@ -443,6 +443,9 @@ function ToolCallBlockImpl({ toolCall, onApprove, onReject }: Props) {
isPending ? HINWEIS_TEXT.ruhig :
'text-gray-500'
} ${isRunning ? 'animate-spin' : ''}`} />
+ {isRunning && !waitsOnCard && toolCall.duration == null && (
+ <RunningFor since={toolCall.startedAt ?? toolCall.timestamp} />
+ )}
{toolCall.duration != null && (
<span className="t-micro text-gray-500 dark:text-gray-500">
{toolCall.duration < 1000 ? `${toolCall.duration}ms` : `${(toolCall.duration / 1000).toFixed(1)}s`}
@@ -710,3 +713,22 @@ A user 2026-06-07 fix this lived inside the collapsed details, so a
</div>
)
}
+
+/**
+ * CA U1: seconds on a call that is still going, so a long `npm install` reads
+ * as working, not stuck. Quiet for the first 3 s: most reads end before that.
+ */
+function RunningFor({ since }: { since: number }) {
+ const [now, setNow] = useState(() => Date.now())
+ useEffect(() => {
+ const t = setInterval(() => setNow(Date.now()), 1000)
+ return () => clearInterval(t)
+ }, [])
+ const s = Math.floor((now - since) / 1000)
+ if (!Number.isFinite(s) || s < 3) return null
+ return (
+ <span className="t-micro tabular-nums text-gray-500 dark:text-gray-500" data-testid="tool-running-for">
+ {s < 60 ? `${s}s` : `${Math.floor(s / 60)}m ${s % 60}s`}
+ </span>
+ )
+}
diff --git a/src/components/chat/__tests__/tool-row-counts-seconds.test.tsx b/src/components/chat/__tests__/tool-row-counts-seconds.test.tsx
new file mode 100644
index 00000000..c5e18f96
--- /dev/null
+++ b/src/components/chat/__tests__/tool-row-counts-seconds.test.tsx
@@ -0,0 +1,22 @@
+/**
+ * @vitest-environment jsdom
+ *
+ * CA U1: a call that is still going shows its seconds after 3 s.
+ */
+import { afterEach, describe, expect, it, vi } from 'vitest'
+import { act, cleanup, render } from '@testing-library/react'
+import { ToolCallBlock } from '../ToolCallBlock'
+
+afterEach(() => { cleanup(); vi.useRealTimers() })
+
+describe('a running tool row (CA U1)', () => {
+ it('stays quiet at first, then counts', () => {
+ vi.useFakeTimers()
+ vi.setSystemTime(10_000)
+ const tc = { id: 't', toolName: 'shell_execute', args: { command: 'npm install' }, status: 'running', timestamp: 10_000, startedAt: 10_000 }
+ const v = render(<ToolCallBlock toolCall={tc as never} />)
+ expect(v.queryByTestId('tool-running-for')).toBeNull()
+ act(() => { vi.advanceTimersByTime(5_000) })
+ expect(v.getByTestId('tool-running-for').textContent).toBe('5s')
+ })
+})