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): Wartezeile sagt jetzt ehrlich, dass der Halter auf Freigabe wartet
purplee0281a60c79f
diff --git a/src/components/chat/ChatInput.tsx b/src/components/chat/ChatInput.tsxindex 350b4c29..50ce3d30 100644--- a/src/components/chat/ChatInput.tsx+++ b/src/components/chat/ChatInput.tsx@@ -44,6 +44,17 @@ interface Props {* to the plain sentence.*/localLaneQueuePosition?: number | null+ /**+ * The conversation holding the local lane ahead of THIS one is not+ * generating, it is stuck on a tool approval from a person (Runde 5,+ * review-lanes.md Runde 2 Antwort zu Punkt 1). "Waiting for the local+ * model to finish another answer" is false in that window: no model is+ * thinking, and there is no bound on how long a person takes to click.+ */+ waitingOnApproval?: boolean+ /** The holder's own title, for "waiting on <title>'s approval", falling+ * back to the generic wording when unavailable. */+ waitingOnApprovalIn?: stringpendingApproval?: AgentToolCall | nullonApprove?: () => voidonReject?: () => void@@ -111,7 +122,7 @@ function fileToImageAttachment(file: File): Promise<ImageAttachment> {})}-export function ChatInput({ onSend, onStop, isGenerating, waitingForLocalLane, localLaneQueuePosition, pendingApproval, onApprove, onReject, disabled, slashCommands, onAttachDocs, composerModel, composerActions, composerAbove }: Props) {+export function ChatInput({ onSend, onStop, isGenerating, waitingForLocalLane, localLaneQueuePosition, waitingOnApproval, waitingOnApprovalIn, pendingApproval, onApprove, onReject, disabled, slashCommands, onAttachDocs, composerModel, composerActions, composerAbove }: Props) {const [input, setInput] = useState('')const [images, setImages] = useState<ImageAttachment[]>([])const [isDragOver, setIsDragOver] = useState(false)@@ -470,7 +481,13 @@ export function ChatInput({ onSend, onStop, isGenerating, waitingForLocalLane, l{waitingForLocalLane && (<div role="status" className={`${HINWEIS_ZEILE} ${HINWEIS_TEXT.ruhig} mb-1.5 px-1`} data-testid="composer-waiting-local-lane"><span className="flex-1 min-w-0">- Waiting for the local model to finish another answer.+ {waitingOnApproval ? (+ waitingOnApprovalIn+ ? `Waiting: "${waitingOnApprovalIn}" is holding the local model while it waits for your approval.`+ : 'Waiting: another conversation is holding the local model while it waits for your approval.'+ ) : (+ 'Waiting for the local model to finish another answer.'+ )}{!!localLaneQueuePosition && localLaneQueuePosition > 1 && (` ${localLaneQueuePosition - 1} more chat${localLaneQueuePosition - 1 === 1 ? '' : 's'} ahead of this one.`)}diff --git a/src/components/chat/ChatView.tsx b/src/components/chat/ChatView.tsxindex 466042aa..21bc3110 100644--- a/src/components/chat/ChatView.tsx+++ b/src/components/chat/ChatView.tsx@@ -42,7 +42,7 @@ import { CodexView } from './CodexView'import { useCodexStore } from '../../stores/codexStore'import { useGenerationStore } from '../../stores/generationStore'import { composerBusy } from '../../lib/composer-busy'-import { useIsQueuedForLocalLane, useLocalLaneQueuePosition } from '../../lib/run-idle'+import { useIsQueuedForLocalLane, useLocalLaneQueuePosition, useLocalLaneHolderWaitsForApproval, useLocalLaneHolderId } from '../../lib/run-idle'import { useRemoteStore } from '../../stores/remoteStore'import { displayModelName } from '../../api/providers'import { MONOGRAM, MONOGRAM_INVERT } from '../layout/brand'@@ -136,6 +136,14 @@ export function ChatView() {// of Send while it waits.const queuedForLocalLane = useIsQueuedForLocalLane(activeConversationId)const localLaneQueuePosition = useLocalLaneQueuePosition(activeConversationId)+ // Runde 5 (review-lanes.md, Runde 2 Antwort zu Punkt 1): the waiting line+ // must not claim a model is thinking when the holder is really stuck on a+ // person's tool approval.+ const waitingOnApproval = useLocalLaneHolderWaitsForApproval(activeConversationId)+ const localLaneHolderId = useLocalLaneHolderId(activeConversationId)+ const localLaneHolderTitle = useChatStore((s) =>+ localLaneHolderId ? s.conversations.find((c) => c.id === localLaneHolderId)?.title : undefined+ )const docCount = useRAGStore((s) =>activeConversationId ? (s.documents[activeConversationId] || []).length : 0@@ -646,6 +654,8 @@ export function ChatView() {isGenerating={busy.thisChat || queuedForLocalLane}waitingForLocalLane={queuedForLocalLane}localLaneQueuePosition={localLaneQueuePosition}+ waitingOnApproval={waitingOnApproval}+ waitingOnApprovalIn={localLaneHolderTitle}pendingApproval={pendingApproval}onApprove={approveToolCall}onReject={rejectToolCall}diff --git a/src/components/chat/__tests__/composer-zeigt-warten-auf-lokale-spur.test.tsx b/src/components/chat/__tests__/composer-zeigt-warten-auf-lokale-spur.test.tsxindex 6a5ca5ea..df7c3ee6 100644--- a/src/components/chat/__tests__/composer-zeigt-warten-auf-lokale-spur.test.tsx+++ b/src/components/chat/__tests__/composer-zeigt-warten-auf-lokale-spur.test.tsx@@ -30,10 +30,11 @@import { describe, it, expect, beforeEach, afterEach } from 'vitest'import { cleanup, fireEvent, render, screen, renderHook, act } from '@testing-library/react'import { ChatInput } from '../ChatInput'-import { useIsQueuedForLocalLane, useLocalLaneQueuePosition } from '../../../lib/run-idle'+import { useIsQueuedForLocalLane, useLocalLaneQueuePosition, useLocalLaneHolderWaitsForApproval, useLocalLaneHolderId } from '../../../lib/run-idle'import { admit, release, __resetRunLanesForTests } from '../../../lib/run-lanes'+import { enqueueApproval, dequeueApproval, resetApprovals } from '../../../lib/approval-queue'-beforeEach(() => __resetRunLanesForTests())+beforeEach(() => { __resetRunLanesForTests(); resetApprovals() })afterEach(() => cleanup())describe('ChatInput waehrend des Wartens auf die lokale Spur', () => {@@ -80,6 +81,105 @@ describe('ChatInput waehrend des Wartens auf die lokale Spur', () => {const line = screen.getByTestId('composer-waiting-local-lane')expect(line.textContent).not.toMatch(/ahead of/)})++ // Runde 5 (review-lanes.md, Runde 2 Antwort zu Punkt 1): the line must not+ // say "the model is thinking" when the holder is really stuck on a human.+ it('sagt statt der Modell-Zeile, dass der Halter auf eine Freigabe wartet', () => {+ render(+ <ChatInput+ onSend={() => {}}+ onStop={() => {}}+ isGenerating={true}+ waitingForLocalLane={true}+ waitingOnApproval={true}+ />,+ )+ const line = screen.getByTestId('composer-waiting-local-lane')+ expect(line.textContent).toContain('waits for your approval')+ expect(line.textContent).not.toContain('finish another answer')+ })++ it('nennt die Unterhaltung des Halters, wenn sie bekannt ist', () => {+ render(+ <ChatInput+ onSend={() => {}}+ onStop={() => {}}+ isGenerating={true}+ waitingForLocalLane={true}+ waitingOnApproval={true}+ waitingOnApprovalIn="Refactor the billing module"+ />,+ )+ const line = screen.getByTestId('composer-waiting-local-lane')+ expect(line.textContent).toContain('"Refactor the billing module" is holding the local model')+ })++ // GEGENPROBE: ohne `waitingOnApproval` bleibt die alte, richtige Zeile fuer+ // den Normalfall stehen (der Halter generiert wirklich).+ it('GEGENPROBE: ohne waitingOnApproval bleibt es bei der Modell-Zeile', () => {+ render(+ <ChatInput onSend={() => {}} onStop={() => {}} isGenerating={true} waitingForLocalLane={true} />,+ )+ const line = screen.getByTestId('composer-waiting-local-lane')+ expect(line.textContent).toContain('finish another answer')+ expect(line.textContent).not.toContain('approval')+ })+})++describe('useLocalLaneHolderWaitsForApproval reagiert auf Spur UND Freigabe-Warteschlange', () => {+ it('wird erst wahr, wenn die eigene Unterhaltung wartet UND der Halter auf eine Freigabe haengt', () => {+ const { result, rerender } = renderHook(({ id }: { id: string }) => useLocalLaneHolderWaitsForApproval(id), {+ initialProps: { id: 'conv-b' },+ })+ expect(result.current).toBe(false)++ act(() => {+ admit('local', 'conv-a', () => {})+ admit('local', 'conv-b', () => {})+ })+ rerender({ id: 'conv-b' })+ // conv-b wartet jetzt, aber conv-a (der Halter) generiert noch, wartet auf+ // keine Freigabe: die alte, richtige Zeile gilt weiter.+ expect(result.current).toBe(false)++ const entry = { toolCall: { id: 't1', toolName: 'shell', args: {} } as never, resolve: () => {} }+ act(() => { enqueueApproval('conv-a', entry) })+ rerender({ id: 'conv-b' })+ expect(result.current).toBe(true)++ // Die Freigabe wird beantwortet: der Halter generiert wieder, die Zeile+ // faellt zurueck auf die Modell-Wortlaut.+ act(() => { dequeueApproval('conv-a') })+ rerender({ id: 'conv-b' })+ expect(result.current).toBe(false)++ // GEGENPROBE: eine Freigabe in einer DRITTEN, unbeteiligten Unterhaltung+ // darf conv-b's Zeile nicht umschreiben.+ act(() => { enqueueApproval('conv-z', entry) })+ rerender({ id: 'conv-b' })+ expect(result.current).toBe(false)+ })+})++describe('useLocalLaneHolderId reagiert auf die echte Warteschlange', () => {+ it('nennt den Halter nur, waehrend die eigene Unterhaltung wartet', () => {+ const { result, rerender } = renderHook(({ id }: { id: string }) => useLocalLaneHolderId(id), {+ initialProps: { id: 'conv-b' },+ })+ expect(result.current).toBeNull()++ act(() => {+ admit('local', 'conv-a', () => {})+ admit('local', 'conv-b', () => {})+ })+ rerender({ id: 'conv-b' })+ expect(result.current).toBe('conv-a')++ act(() => { release('conv-a') })+ rerender({ id: 'conv-b' })+ // conv-b haelt die Spur jetzt selbst: kein Halter mehr ueber ihm.+ expect(result.current).toBeNull()+ })})describe('useLocalLaneQueuePosition reagiert auf die echte Warteschlange', () => {diff --git a/src/lib/run-idle.ts b/src/lib/run-idle.tsindex 158095a8..dbc98751 100644--- a/src/lib/run-idle.ts+++ b/src/lib/run-idle.ts@@ -61,7 +61,8 @@ import { useSyncExternalStore } from 'react'import { useGenerationStore } from '../stores/generationStore'import { useCodexStore } from '../stores/codexStore'import { isRunStopped } from './run-stop'-import { anyRunQueued, isRunQueued, runQueuePosition, subscribeRunLanes } from './run-lanes'+import { anyRunQueued, isRunQueued, localLaneHolder, runQueuePosition, subscribeRunLanes } from './run-lanes'+import { headApproval, subscribeApprovals } from './approval-queue'import { isActiveCodexStatus, type CodexThreadStatus } from '../types/codex'/**@@ -223,6 +224,51 @@ export function useLocalLaneQueuePosition(conversationId: string | null | undefireturn useSyncExternalStore(subscribeRunLanes, () => runQueuePosition(conversationId))}+/** Both sources the wait-reason question below reads: the lane's own holder+ * and queue, PLUS the approval queue, whose head decides whether the+ * holder is answering or waiting on a human. */+function subscribeRunLanesAndApprovals(listener: () => void): () => void {+ const abLane = subscribeRunLanes(listener)+ const abApproval = subscribeApprovals(listener)+ return () => { abLane(); abApproval() }+}++/**+ * React hook: while THIS conversation waits in the local lane's queue, is the+ * holder ahead of it stuck on a HUMAN, not a model (Runde 5, review-lanes.md+ * Runde 2 Antwort zu Punkt 1, "Der wartende Agent")?+ *+ * `runInLane` holds the lane for the holder's WHOLE run, tool-approval wait+ * included, which is correct (the run is not over, and inference resumes the+ * moment the human answers). But "Waiting for the local model to finish+ * another answer" is a lie in that window: no model is thinking, a person is,+ * and there is no bound on how long a person takes. The line has to say that,+ * so a customer does not read a silent multi-minute wait as a hang and file+ * the exact support ticket B1 already fixed once (David 2026-06-16 lineage).+ *+ * `false` while not queued, or while the holder IS generating: the ordinary+ * "another answer" wording stays correct there and this hook must not flap+ * it every time a chunk arrives.+ */+export function useLocalLaneHolderWaitsForApproval(conversationId: string | null | undefined): boolean {+ return useSyncExternalStore(subscribeRunLanesAndApprovals, () => {+ if (!isRunQueued(conversationId)) return false+ const holder = localLaneHolder()+ return !!holder && headApproval(holder) !== null+ })+}++/** The title of the conversation currently holding the local lane, only+ * while THIS conversation is queued behind it, for the "waiting on+ * <name>'s approval" line. `null` covers both "not queued" and "no title+ * available" so the caller can fall back to the generic wording either way. */+export function useLocalLaneHolderId(conversationId: string | null | undefined): string | null {+ return useSyncExternalStore(subscribeRunLanes, () => {+ if (!isRunQueued(conversationId)) return null+ return localLaneHolder()+ })+}+/*** Wake `listener` whenever ANY of the three sources moves: a generating flag,* a coding thread's status, or the local lane's queue.