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.
TypeScript agentai-chatai-studioall-in-onecoding-agentdesktop-appfluximage-generationlinuxllmlocal-ailocal-llmopen-sourceprivacyself-hostedstable-diffusionuncensoreduncensored-aivideo-generationwindows
fix(chat): the Working clock counts from the run start
purple9dc27fb6dd02
diff --git a/src/components/chat/CodexView.tsx b/src/components/chat/CodexView.tsxindex 7499337c..828018da 100644--- a/src/components/chat/CodexView.tsx+++ b/src/components/chat/CodexView.tsx@@ -683,6 +683,7 @@ export function CodexView() {blocked run never looks like a working one (G15b). */}<WorkingAnchorisRunning={codexGenerating}+ conversationId={activeConversationId}label={pendingConfirm ? 'Waiting for your approval' : undefined}/></div>diff --git a/src/components/chat/MessageList.tsx b/src/components/chat/MessageList.tsxindex d6f23457..b2bc4e33 100644--- a/src/components/chat/MessageList.tsx+++ b/src/components/chat/MessageList.tsx@@ -216,7 +216,7 @@ export function MessageList({ isGenerating, isThisChatGenerating, isLoadingModelstreams. G14-6: one shimmering "Working" with the clock beside it,instead of three dots here and a floating counter elsewhere. */}{showTyping && lastMessage?.role === 'assistant' && (- <WorkingAnchor isRunning label={isLoadingModel ? 'Loading model' : undefined} />+ <WorkingAnchor isRunning conversationId={conversation?.id} label={isLoadingModel ? 'Loading model' : undefined} />)}</div></div>diff --git a/src/components/chat/WorkingAnchor.tsx b/src/components/chat/WorkingAnchor.tsxindex d5b1ae3d..9cad32ee 100644--- a/src/components/chat/WorkingAnchor.tsx+++ b/src/components/chat/WorkingAnchor.tsx@@ -1,5 +1,6 @@import { useEffect, useState } from 'react'import { formatElapsed } from '../../lib/format-elapsed'+import { useGenerationStore } from '../../stores/generationStore'interface Props {isRunning: boolean@@ -8,6 +9,11 @@ interface Props {* whenever the surface knows better, because a wait that looks like work* is how a nine minute approval stall got mistaken for progress (G15b). */label?: string+ /** The conversation whose run this is. Its booked start (generationStore+ * `runs[id].bookedAt`) drives the clock, so leaving the tab and coming+ * back does not start the count again at 0 (Gegenprobe 30.09.2026: an+ * eight minute run read "12s" after a tab switch). */+ conversationId?: string | null}/**@@ -18,8 +24,9 @@ interface Props {* exactly one anchor that says the app is alive, what it is doing, and for* how long. Reference is the Claude desktop app.*/-export function WorkingAnchor({ isRunning, label }: Props) {+export function WorkingAnchor({ isRunning, label, conversationId }: Props) {const [elapsed, setElapsed] = useState(0)+ const bookedAt = useGenerationStore((s) => (conversationId ? s.runs[conversationId]?.bookedAt : undefined))// The clock resets in the render where `isRunning` flips, not in an effect// afterwards. Two things were wrong with the effect version: `useRef(Date.now())`@@ -36,14 +43,15 @@ export function WorkingAnchor({ isRunning, label }: Props) {useEffect(() => {if (!isRunning) return- // The start belongs to this run, so it lives in the run's own closure —- // no ref, and nothing left over from the previous run to read back.- const start = Date.now()+ // The run's booked start when there is one; otherwise the start belongs+ // to this mount, in the effect's own closure, with nothing left over from+ // the previous run to read back.+ const start = bookedAt ?? Date.now()const interval = setInterval(() => {- setElapsed(Math.floor((Date.now() - start) / 1000))+ setElapsed(Math.max(0, Math.floor((Date.now() - start) / 1000)))}, 250)return () => clearInterval(interval)- }, [isRunning])+ }, [isRunning, bookedAt])if (!isRunning) return nulldiff --git a/src/components/chat/__tests__/the-run-clock-survives-a-remount.test.ts b/src/components/chat/__tests__/the-run-clock-survives-a-remount.test.tsnew file mode 100644index 00000000..9b20afe5--- /dev/null+++ b/src/components/chat/__tests__/the-run-clock-survives-a-remount.test.ts@@ -0,0 +1,54 @@+/**+ * @vitest-environment jsdom+ *+ * Gegenprobe on the real build, 30.09.2026: an eight minute Code run read+ * "12s" after the user left the tab and came back. The clock started when the+ * component mounted, not when the run did. It now counts from the run's+ * booked start (generationStore runs[id].bookedAt).+ */+import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'+import { createElement } from 'react'+import { render, screen, act, cleanup } from '@testing-library/react'+import { WorkingAnchor } from '../WorkingAnchor'+import { useGenerationStore } from '../../../stores/generationStore'++const T0 = new Date('2026-09-30T18:00:00Z').getTime()++beforeEach(() => {+ vi.useFakeTimers()+ vi.setSystemTime(T0)+ useGenerationStore.setState({ runs: {}, generating: {}, aborters: {} })+})+afterEach(() => {+ cleanup()+ vi.useRealTimers()+})++const clock = () => screen.getByTestId('working-anchor').textContent++describe('the Working clock', () => {+ it('counts from the run start, also in a component mounted later', () => {+ useGenerationStore.getState().bookRun('c1', 'cloud', Symbol('run'))+ vi.setSystemTime(T0 + 8 * 60_000)+ render(createElement(WorkingAnchor, { isRunning: true, conversationId: 'c1' }))+ act(() => { vi.advanceTimersByTime(300) })+ expect(clock()).toContain('8m 00s')+ })++ it('keeps counting across an unmount and a new mount', () => {+ useGenerationStore.getState().bookRun('c1', 'cloud', Symbol('run'))+ const first = render(createElement(WorkingAnchor, { isRunning: true, conversationId: 'c1' }))+ act(() => { vi.advanceTimersByTime(90_000) })+ first.unmount()+ act(() => { vi.advanceTimersByTime(10_000) })+ render(createElement(WorkingAnchor, { isRunning: true, conversationId: 'c1' }))+ act(() => { vi.advanceTimersByTime(300) })+ expect(clock()).toContain('1m 40s')+ })++ it('without a booked run it still counts from its own start', () => {+ render(createElement(WorkingAnchor, { isRunning: true }))+ act(() => { vi.advanceTimersByTime(5_000) })+ expect(clock()).toContain('5s')+ })+})