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(agent): say when a run waits for approval, leave a note when Stop came first
purple2f859505ce74
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 4c04a9d4..d1fd80f5 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -32,7 +32,9 @@ cloud catalogue.file sends the call in pieces for many seconds, and the run said only"Working" the whole time. It now shows the tool's name and how much of thecall has arrived, for example "Preparing file_write 3 kB", as soon as the- first piece is in.+ first piece is in. A run that waits for your approval says so in the+ chat too, and Stop before the first word leaves a short note instead of an+ empty answer.- **Code conversations stay in the Code tab.** After a restart the last Codeconversation opened in the Chat tab, where the agent was off and a"continue" ran without tools. The app now starts on an empty chat, and thediff --git a/src/components/chat/MessageList.tsx b/src/components/chat/MessageList.tsxindex b2bc4e33..0311db70 100644--- a/src/components/chat/MessageList.tsx+++ b/src/components/chat/MessageList.tsx@@ -216,7 +216,13 @@ 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 conversationId={conversation?.id} label={isLoadingModel ? 'Loading model' : undefined} />+ <WorkingAnchor+ isRunning+ conversationId={conversation?.id}+ // A run waiting on the user is not working: same words as the Code+ // tab (G15b), Gegenprobe 01.10.2026 read "Working 49s" here.+ label={isLoadingModel ? 'Loading model' : pendingApprovalId ? 'Waiting for your approval' : undefined}+ />)}</div></div>diff --git a/src/components/chat/__tests__/a-waiting-approval-is-not-working.test.ts b/src/components/chat/__tests__/a-waiting-approval-is-not-working.test.tsnew file mode 100644index 00000000..2d151ff1--- /dev/null+++ b/src/components/chat/__tests__/a-waiting-approval-is-not-working.test.ts@@ -0,0 +1,44 @@+/**+ * @vitest-environment jsdom+ *+ * Gegenprobe on the real Windows build, 01.10.2026: an Agent run in the chat+ * waiting on an approval read "Working 49s" and kept counting, while the Code+ * tab in the same spot says "Waiting for your approval" (G15b). A run that+ * waits on the user now says so in the chat too.+ */+import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest'+import { createElement } from 'react'+import { render, screen, cleanup } from '@testing-library/react'+import { MessageList } from '../MessageList'+import { useChatStore } from '../../../stores/chatStore'+import type { Conversation } from '../../../types/chat'++vi.mock('../VoiceButton', () => ({ VoiceButton: () => null }))++beforeEach(() => {+ Element.prototype.scrollTo = () => {}+ const conv: Conversation = {+ id: 'c1', title: 'Poem', model: 'test-model', systemPrompt: '', mode: 'lu', createdAt: 1, updatedAt: 1,+ messages: [+ { id: 'u1', role: 'user', content: 'write a poem to poem.txt', timestamp: 1 },+ { id: 'a1', role: 'assistant', content: '', timestamp: 2 },+ ],+ }+ useChatStore.setState({ conversations: [conv], activeConversationId: 'c1' })+})+afterEach(() => cleanup())++const anchor = () => screen.getByTestId('working-anchor').textContent ?? ''++describe('the chat anchor while an approval waits', () => {+ it('says the run waits for the user, not that it works', () => {+ render(createElement(MessageList, { isGenerating: true, isThisChatGenerating: true, pendingApprovalId: 'tool-1', onApprove: () => {}, onReject: () => {} }))+ expect(anchor()).toContain('Waiting for your approval')+ expect(anchor()).not.toContain('Working')+ })++ it('without a pending approval it still reads Working', () => {+ render(createElement(MessageList, { isGenerating: true, isThisChatGenerating: true, pendingApprovalId: null }))+ expect(anchor()).toContain('Working')+ })+})diff --git a/src/hooks/__tests__/a-stopped-run-says-so.test.ts b/src/hooks/__tests__/a-stopped-run-says-so.test.tsnew file mode 100644index 00000000..447bbba5--- /dev/null+++ b/src/hooks/__tests__/a-stopped-run-says-so.test.ts@@ -0,0 +1,127 @@+/**+ * @vitest-environment jsdom+ *+ * Gegenprobe on the real Windows build, 01.10.2026: Stop before the model's+ * first token left an empty answer bubble with only the logo. A stopped run+ * that shows nothing now says it stopped; one that already wrote keeps it.+ *+ * Run: npx vitest run src/hooks/__tests__/a-stopped-run-says-so.test.ts+ */+import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'+import { renderHook, act, waitFor } from '@testing-library/react'++vi.mock('../../api/cloud/supabase', () => ({+ getAccessToken: async () => 'session-token-abc',+}))+vi.mock('../../api/rag', () => ({+ retrieveContext: async () => ({ context: { chunks: [], query: '', documentIds: [] }, scoredChunks: [] }),+ generateEmbeddings: async () => [[0.1, 0.2]],+}))+vi.mock('../../lib/ttsBridge', () => ({ autoSpeak: () => {} }))+vi.mock('../../api/vram-handoff', () => ({ requestGenerationCancel: () => {} }))+vi.mock('../useMemory', () => ({+ useMemory: () => ({ extractAndSave: async () => {} }),+ extractMemoriesFromPair: async () => {},+}))++import { useAgentChat } from '../useAgentChat'+import { useCodex } from '../useCodex'+import { useChatStore } from '../../stores/chatStore'+import { useModelStore } from '../../stores/modelStore'+import { useSettingsStore } from '../../stores/settingsStore'+import { useProviderStore } from '../../stores/providerStore'+import { useAgentModeStore } from '../../stores/agentModeStore'+import { useAgentTaskStore } from '../../stores/agentTaskStore'+import { useAgentLoopStore } from '../../stores/agentLoopStore'+import { useGenerationStore } from '../../stores/generationStore'+import { useTodoStore } from '../../stores/todoStore'+import { useToolAuditStore } from '../../stores/toolAuditStore'+import { useRunActivityStore } from '../../stores/runActivityStore'+import { STOPPED_NOTE } from '../../lib/stopped-note'+import { DEFAULT_SETTINGS } from '../../lib/constants'+import { __resetRunStopsForTests } from '../../lib/run-stop'+import { toolRegistry, registerBuiltinTools } from '../../api/mcp'++const MODEL = 'lu-cloud::zai-org/GLM-5.3'+const enc = new TextEncoder()+const line = (payload: object) => enc.encode(`data: ${JSON.stringify(payload)}\n\n`)++beforeEach(() => {+ registerBuiltinTools(toolRegistry)+ __resetRunStopsForTests()+ useChatStore.setState({ conversations: [], activeConversationId: null })+ useAgentTaskStore.setState({ byConv: {} })+ useAgentLoopStore.setState({ loops: {} })+ useGenerationStore.setState({ generating: {}, aborters: {}, runs: {} })+ useAgentModeStore.setState({ agentModeActive: {} })+ useTodoStore.setState({ byConversation: {}, updatedAt: {} })+ useToolAuditStore.setState({ entries: {} })+ useRunActivityStore.setState({ activity: {} })+ useSettingsStore.setState({ settings: { ...DEFAULT_SETTINGS, appMode: 'cloud', cavemanMode: 'off' } })+ useProviderStore.setState((s) => ({+ providers: { ...s.providers, 'lu-cloud': { ...s.providers['lu-cloud'], enabled: true } },+ }))+ useModelStore.setState({ models: [], activeModel: MODEL })+})+afterEach(() => vi.restoreAllMocks())++function heldStream() {+ let push!: (b: Uint8Array) => void+ vi.spyOn(globalThis, 'fetch').mockImplementation(async (input: RequestInfo | URL, init?: RequestInit) => {+ if (!String(input).includes('/chat/completions')) return new Response('{}', { status: 200 })+ const body = new ReadableStream<Uint8Array>({+ start(c) {+ push = (b) => c.enqueue(b)+ init?.signal?.addEventListener('abort', () => c.error(new DOMException('aborted', 'AbortError')))+ },+ })+ return new Response(body, { status: 200, headers: { 'content-type': 'text/event-stream' } })+ })+ return { push: (o: object) => push(line(o)), ready: () => typeof push === 'function' }+}++function start() {+ const { result } = renderHook(() => useAgentChat())+ const convId = useChatStore.getState().createConversation(MODEL, '')+ useChatStore.getState().setActiveConversation(convId)+ useAgentModeStore.getState().setAgentModeActive(convId, true)+ let run!: Promise<void>+ act(() => { run = result.current.sendAgentMessage('write a poem') })+ return { result, convId, run: () => run }+}++const answer = (convId: string) =>+ useChatStore.getState().conversations.find((c) => c.id === convId)!.messages.filter((m) => m.role === 'assistant').at(-1)!++describe('a stopped run says so', () => {+ it('Stop before the first token: the answer is the note, not empty', async () => {+ const s = heldStream()+ const { result, convId, run } = start()+ await waitFor(() => expect(s.ready()).toBe(true))+ await act(async () => { result.current.stopAgent(); await run() })+ expect(answer(convId).content).toBe(STOPPED_NOTE)+ })++ it('Stop after text arrived: the text stays, no note on top', async () => {+ const s = heldStream()+ const { result, convId, run } = start()+ await waitFor(() => expect(s.ready()).toBe(true))+ s.push({ choices: [{ delta: { content: 'Roses are red' } }] })+ await waitFor(() => expect(JSON.stringify(answer(convId))).toContain('Roses are red'))+ await act(async () => { result.current.stopAgent(); await run() })+ expect(answer(convId).content).not.toBe(STOPPED_NOTE)+ expect(JSON.stringify(answer(convId))).toContain('Roses are red')+ })++ it('Code tab: Stop before the first token leaves the note too', async () => {+ const s = heldStream()+ const { result } = renderHook(() => useCodex())+ const convId = useChatStore.getState().createConversation(MODEL, '', 'codex')+ useChatStore.getState().setActiveConversation(convId)+ let run!: Promise<unknown>+ act(() => { run = result.current.sendInstruction('create notes.md') })+ await waitFor(() => expect(s.ready()).toBe(true))+ await act(async () => { result.current.stopCodex(); await run })+ expect(answer(convId).content).toBe(STOPPED_NOTE)+ })+})diff --git a/src/hooks/useAgentChat.ts b/src/hooks/useAgentChat.tsindex aeb0e06a..9a7027df 100644--- a/src/hooks/useAgentChat.ts+++ b/src/hooks/useAgentChat.ts@@ -78,6 +78,7 @@ import { useAgentTaskStore } from '../stores/agentTaskStore'import { useAgentGoalStore, renderGoalSection } from '../stores/agentGoalStore'import { endLoopUnlessRearmed, useAgentLoopStore } from '../stores/agentLoopStore'import { beginRun, isRunStopped, stopRun } from '../lib/run-stop'+import { noteStoppedIfEmpty } from '../lib/stopped-note'import { buildLoopRecheck, loopPassSaysDone } from '../lib/agent-commands'import { applyStoredCompaction } from '../lib/compact-summary'import { maybeAutoCompact } from '../lib/run-compact-command'@@ -3000,6 +3001,8 @@ export function useAgentChat() {// to false, and reject B's pending approvals, leaving the NEW run// unstoppable through generationStore (Stop button, sign-out, window// close, app quit) even though activeAgentRuns still pointed at it.+ // A Stop before anything was written leaves a line, not an empty bubble.+ if (abort.signal.aborted || isRunStopped(convId)) noteStoppedIfEmpty(convId, assistantMessage.id)const stillOwnsSlot = activeAgentRuns.get(convId) === runStateif (stillOwnsSlot) {useGenerationStore.getState().clearAborter(convId)diff --git a/src/hooks/useCodex.ts b/src/hooks/useCodex.tsindex f26a84fb..36a64190 100644--- a/src/hooks/useCodex.ts+++ b/src/hooks/useCodex.ts@@ -28,6 +28,7 @@ import { useAgentTaskStore } from '../stores/agentTaskStore'import { useAgentGoalStore, renderGoalSection } from '../stores/agentGoalStore'import { endLoopUnlessRearmed, useAgentLoopStore } from '../stores/agentLoopStore'import { beginRun, isRunStopped, stopRun } from '../lib/run-stop'+import { noteStoppedIfEmpty } from '../lib/stopped-note'import { CODEX_CONFIRM_TOOLS, renderApprovalPreview } from './codexShellGate'import { buildHermesToolPrompt, buildHermesToolResult, buildHermesToolCall, parseHermesToolCalls, stripToolCallTags, hasToolCallTags } from '../api/hermes-tool-calling'import { streamProviderTurn, type StreamedProviderTurn } from '../lib/provider-stream'@@ -2553,6 +2554,8 @@ export function useCodex() {})}} finally {+ // A Stop before anything was written leaves a line, not an empty bubble.+ if (convId && (abort.signal.aborted || isRunStopped(convId))) noteStoppedIfEmpty(convId, assistantMsg.id)// ── Continue capability (parity with original Codex CLI) ────────// Persist the tool-call chain from this turn as hidden messages in// the chat store. On the next turn, the history builder includesdiff --git a/src/lib/release-notes.ts b/src/lib/release-notes.tsindex 70ac2185..1209c721 100644--- a/src/lib/release-notes.ts+++ b/src/lib/release-notes.ts@@ -172,7 +172,7 @@ export const RELEASE_NOTES: ReleaseNote[] = [},{title: 'The run says which tool the model is writing.',- detail: 'A model writing a long file sends the call in pieces for many seconds, and the run said only "Working" the whole time. It now shows the tool\'s name and how much of the call has arrived as soon as the first piece is in.',+ detail: 'A model writing a long file sends the call in pieces for many seconds, and the run said only "Working" the whole time. It now shows the tool\'s name and how much of the call has arrived as soon as the first piece is in. A run waiting for your approval says so in the chat too, and Stop before the first word leaves a note instead of an empty answer.',},{title: 'Code conversations stay in the Code tab.',diff --git a/src/lib/stopped-note.ts b/src/lib/stopped-note.tsnew file mode 100644index 00000000..650d56d3--- /dev/null+++ b/src/lib/stopped-note.ts@@ -0,0 +1,20 @@+import { useChatStore } from '../stores/chatStore'++/**+ * What a stopped run's answer says when nothing else would. Gegenprobe on the+ * real Windows build, 01.10.2026: Stop on a Code run before the model's first+ * token left an empty bubble with only the logo, which read as a crash. The+ * run state is kept for the next message ("continue" picks up, same probe).+ */+export const STOPPED_NOTE = 'Stopped. Send "continue" to pick up from here.'++/** Write the note into the run's answer, only if the answer shows nothing yet. */+export function noteStoppedIfEmpty(conversationId: string | null | undefined, messageId: string): void {+ if (!conversationId) return+ const msg = useChatStore.getState().conversations+ .find((c) => c.id === conversationId)?.messages.find((m) => m.id === messageId)+ if (!msg || msg.content.trim()) return+ const shows = (msg.agentBlocks ?? []).some((b) => b.phase === 'tool_call' || (b.phase === 'answer' && b.content.trim()))+ if (shows) return+ useChatStore.getState().updateMessageContent(conversationId, messageId, STOPPED_NOTE)+}