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(chat): Komposer-Riegel sperrt nur noch die eigene Unterhaltung

purpleb46703a9acec
diff --git a/src/components/chat/ChatInput.tsx b/src/components/chat/ChatInput.tsx
index e2fc1c92..7f1552f1 100644
--- a/src/components/chat/ChatInput.tsx
+++ b/src/components/chat/ChatInput.tsx
@@ -24,21 +24,17 @@ interface Props {
onStop: () => void
/** THIS conversation is answering: the slot shows Stop. */
isGenerating: boolean
- /**
- * Another conversation is answering. The slot used to read one app-wide
- * flag, so every other chat silently lost its Send button and grew a Stop
- * that killed the foreign run (T1 nebenfund 4). Send stays where it is now
- * and the composer says in one line why it is waiting.
- */
- busyElsewhere?: boolean
/**
* THIS conversation's send is queued behind another local run (Runde 4,
* review-lanes.md Blocker 1+6): the built-in engine runs one slot, so a
* second local send waits its turn instead of racing the first one for it.
- * Distinct from `isGenerating` (no stream is flowing yet) and from
- * `busyElsewhere` (that one is a FOREIGN chat; this one is this chat's own
- * send, just not admitted yet) — the composer shows Stop, same as while
- * generating, and a line explains why nothing is happening yet.
+ * Distinct from plain `isGenerating`, where a stream is already flowing;
+ * here nothing has started yet, but the composer still shows Stop (the
+ * store aborter is registered the moment the run is admitted to the queue,
+ * not only once it starts) and a line explains why nothing is happening.
+ * Locking based on a DIFFERENT conversation is gone entirely as of this
+ * round: each conversation now only answers for its own send, running or
+ * queued, never for another one's.
*/
waitingForLocalLane?: boolean
pendingApproval?: AgentToolCall | null
@@ -108,7 +104,7 @@ function fileToImageAttachment(file: File): Promise<ImageAttachment> {
})
}
-export function ChatInput({ onSend, onStop, isGenerating, busyElsewhere, waitingForLocalLane, pendingApproval, onApprove, onReject, disabled, slashCommands, onAttachDocs, composerModel, composerActions, composerAbove }: Props) {
+export function ChatInput({ onSend, onStop, isGenerating, waitingForLocalLane, pendingApproval, onApprove, onReject, disabled, slashCommands, onAttachDocs, composerModel, composerActions, composerAbove }: Props) {
const [input, setInput] = useState('')
const [images, setImages] = useState<ImageAttachment[]>([])
const [isDragOver, setIsDragOver] = useState(false)
@@ -287,7 +283,7 @@ export function ChatInput({ onSend, onStop, isGenerating, busyElsewhere, waiting
const sendLockRef = useRef(0)
const handleSend = () => {
const trimmed = input.trim()
- if ((!trimmed && images.length === 0) || isGenerating || busyElsewhere || waitingForLocalLane || disabled) return
+ if ((!trimmed && images.length === 0) || isGenerating || waitingForLocalLane || disabled) return
if (!passSendLock(sendLockRef)) return
onSend(trimmed || '(image)', images.length > 0 ? images : undefined)
setInput('')
@@ -451,27 +447,20 @@ export function ChatInput({ onSend, onStop, isGenerating, busyElsewhere, waiting
{/* Prompt area: hints, image previews, then the textarea (buttons live
in the action bar below, web-parity two-row composer). */}
<div className="px-3 pt-2.5">
- {/* Another chat is answering. Saying so beats what this composer did
- before, which was to drop the Send button without a word and put a
- Stop button there that aborted the OTHER chat's run. One answer at
- a time is what the app really does today: the local engine runs a
- single slot, and the streaming buffers behind the composer are
- shared. Whoever lifts that lifts this line with it. */}
- {busyElsewhere && (
- <div role="status" className={`${HINWEIS_ZEILE} ${HINWEIS_TEXT.ruhig} mb-1.5 px-1`} data-testid="composer-busy-elsewhere">
- <span className="flex-1 min-w-0">
- Another chat is still answering. This app runs one answer at a time, so wait for it to finish or stop it in that chat.
- </span>
- </div>
- )}
{/* Runde 4 (review-lanes.md Blocker 1+6): the built-in engine runs a
single slot, so a second local send queues instead of failing or
hanging silently. This is THIS chat's own send, already accepted,
- just not admitted yet — Stop above already works on it (the store
+ just not admitted yet. Stop above already works on it: the store
aborter is registered the moment the run is admitted to the
- queue, before the queue promotes it), this line only says why
- nothing is streaming yet. Disappears the moment the run starts. */}
- {!busyElsewhere && waitingForLocalLane && (
+ queue, before the queue promotes it. This line only says why
+ nothing is streaming yet, and disappears the moment the run
+ starts. A DIFFERENT conversation being busy no longer shows
+ anything here at all: the composer used to drop the Send button
+ in every other chat too and put a Stop there that aborted the
+ foreign run (T1 nebenfund 4); that lock is gone now that a local
+ second send queues visibly instead of racing the first one, and
+ a cloud second send just runs alongside it. */}
+ {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.
@@ -721,7 +710,7 @@ export function ChatInput({ onSend, onStop, isGenerating, busyElsewhere, waiting
) : (
<button
onClick={handleSend}
- disabled={(!input.trim() && images.length === 0) || isTranscribing || !!busyElsewhere}
+ disabled={(!input.trim() && images.length === 0) || isTranscribing || !!waitingForLocalLane}
className="lu-control lu-control--icon lu-primary w-full h-full"
aria-label="Send message"
>
diff --git a/src/components/chat/ChatView.tsx b/src/components/chat/ChatView.tsx
index 653cbb7e..a0c6bc98 100644
--- a/src/components/chat/ChatView.tsx
+++ b/src/components/chat/ChatView.tsx
@@ -119,15 +119,21 @@ export function ChatView() {
//
// Since T1 point 4 the COMPOSER reads it too. It used to read the hook's
// app-wide `isGenerating`, so every other conversation lost its Send button
- // and got a Stop button that aborted the foreign run. `composerBusy` splits
- // the one flag into the two questions the composer actually has.
+ // and got a Stop button that aborted the foreign run. `composerBusy` still
+ // resolves what THIS conversation's own slot should show (own run, or an
+ // orphaned run the maps have not caught up with yet); as of Runde 4
+ // (review-lanes.md Blocker 1+6) it no longer feeds a lock on any OTHER
+ // conversation into the composer at all, because there is nothing left to
+ // lock: a second local send now queues visibly instead of racing the first
+ // one for the built-in engine's one slot, and a second cloud send just runs
+ // alongside it.
const generatingMap = useGenerationStore((s) => s.generating)
const activeGenerating = !!activeConversationId && !!generatingMap[activeConversationId]
const busy = composerBusy(isGenerating, generatingMap, activeConversationId)
- // Runde 4 (review-lanes.md Blocker 1+6): THIS conversation's own send is
- // queued behind another local run. Not part of `generatingMap` (no stream
- // is flowing yet), so `composerBusy` cannot see it — folded in here so the
- // composer shows Stop instead of Send while it waits.
+ // THIS conversation's own send queued behind another local run. Not part of
+ // `generatingMap` (no stream is flowing yet), so `composerBusy` cannot see
+ // it. Folded into `isGenerating` below so the composer shows Stop instead
+ // of Send while it waits.
const queuedForLocalLane = useIsQueuedForLocalLane(activeConversationId)
const docCount = useRAGStore((s) =>
@@ -637,7 +643,6 @@ export function ChatView() {
onSend={sendMessage}
onStop={stopGeneration}
isGenerating={busy.thisChat || queuedForLocalLane}
- busyElsewhere={busy.otherChat}
waitingForLocalLane={queuedForLocalLane}
pendingApproval={pendingApproval}
onApprove={approveToolCall}
diff --git a/src/components/chat/CodexView.tsx b/src/components/chat/CodexView.tsx
index ff53d655..4507e5a6 100644
--- a/src/components/chat/CodexView.tsx
+++ b/src/components/chat/CodexView.tsx
@@ -45,7 +45,6 @@ import { CodexConfirmDialog } from './CodexConfirmDialog'
import { Hinweis } from '../ui/Hinweis'
import { HINWEIS_TEXT } from '../../lib/hinweis'
import { stripModelNoise } from '../../lib/strip-model-noise'
-import { composerBusy } from '../../lib/composer-busy'
import { useIsQueuedForLocalLane } from '../../lib/run-idle'
// Code always drives a tool loop, so the aggressive tier applies here.
@@ -96,17 +95,14 @@ export function CodexView() {
const generatingMap = useGenerationStore((s) => s.generating)
const codexGenerating = !!activeConversationId && !!generatingMap[activeConversationId]
const pendingConfirm = useCodexConfirmStore((s) => s.pending)
- // Nachbesserung 9 (review-lanes.md): parity with ChatView.tsx. Before this,
- // CodexView never asked composerBusy at all, so the Code tab could send
- // while the Chat tab was still generating: the one path Blocker 1's
- // Reichweite point actually noted as reachable today (Chat<->Code, not
- // Chat<->Chat, which the composer lock already covers). Same asymmetry the
- // review flagged: a Chat send is blocked mid-Code-run, a Code send was not
- // blocked mid-Chat-run.
- const busy = composerBusy(isRunning || codexGenerating, generatingMap, activeConversationId)
- // Runde 4 (review-lanes.md Blocker 1+6): same fold-in as ChatView.tsx. A
- // queued send has no `generating` entry yet, so composerBusy alone cannot
- // show it.
+ // Runde 4 (review-lanes.md Blocker 1+6): THIS conversation's own send
+ // queued behind another local run. Not part of `generatingMap` (no stream
+ // is flowing yet), so it needs its own read. Nachbesserung 9 (Runde 3) had
+ // added a cross-conversation lock here via `composerBusy` (parity with
+ // ChatView.tsx, closing the one path Blocker 1's Reichweite point noted as
+ // reachable: Chat<->Code); that lock is gone as of this round, the same as
+ // in ChatView.tsx, now that a local second send queues visibly instead of
+ // racing the first one and a cloud second send just runs alongside it.
const queuedForLocalLane = useIsQueuedForLocalLane(activeConversationId)
// G8-3 (David): "sobald er fertig gedacht hat, hakt das so komisch ab und
@@ -652,7 +648,6 @@ export function CodexView() {
// parallel send and no Stop button. The generating flag follows the
// conversation, not the hook instance.
isGenerating={isRunning || codexGenerating || queuedForLocalLane}
- busyElsewhere={busy.otherChat}
waitingForLocalLane={queuedForLocalLane}
slashCommands="agent"
composerModel={<ModelSelector openUpward surface="code" />}
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.tsx
index 23c0899c..c2bd3985 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
@@ -14,6 +14,12 @@
* react to the real `lib/run-lanes.ts` queue (admit/release), the same
* module state the three send paths now book into via `runInLane`?
*
+ * Nachtrag Schritt 4: dieser Datei fehlt inzwischen ein COUNTER-CHECK gegen
+ * `busyElsewhere`, das gab es hier einmal. `busyElsewhere` selbst ist mit
+ * Schritt 4 aus `ChatInput` verschwunden (composer-busy.ts und ChatInput.tsx
+ * sperren nur noch die eigene Unterhaltung), also gibt es nichts mehr, das
+ * diese Wartezeile verdraengen koennte.
+ *
* Run: npx vitest run src/components/chat/__tests__/composer-zeigt-warten-auf-lokale-spur.test.tsx
*/
import { describe, it, expect, beforeEach, afterEach } from 'vitest'
@@ -54,17 +60,6 @@ describe('ChatInput waehrend des Wartens auf die lokale Spur', () => {
expect(screen.getByRole('button', { name: 'Send message' })).toBeTruthy()
})
- it('COUNTER-CHECK: busyElsewhere (fremde Unterhaltung) verdraengt die eigene Wartezeile', () => {
- // Beide koennten technisch gleichzeitig wahr sein (eine andere Unterhaltung
- // laeuft UND diese wartet auf die lokale Spur); die fremde Meldung hat
- // Vorrang, weil sie den dringlicheren Fall beschreibt (jemand anders haelt
- // gerade ueberhaupt die Maschine).
- render(
- <ChatInput onSend={() => {}} onStop={() => {}} isGenerating={true} busyElsewhere={true} waitingForLocalLane={true} />,
- )
- expect(screen.getByTestId('composer-busy-elsewhere')).toBeTruthy()
- expect(screen.queryByTestId('composer-waiting-local-lane')).toBeNull()
- })
})
describe('useIsQueuedForLocalLane reagiert auf die echte Warteschlange', () => {
diff --git a/src/components/chat/__tests__/senden-und-stop-je-unterhaltung.test.tsx b/src/components/chat/__tests__/senden-und-stop-je-unterhaltung.test.tsx
index 34f5ddf6..f42c615d 100644
--- a/src/components/chat/__tests__/senden-und-stop-je-unterhaltung.test.tsx
+++ b/src/components/chat/__tests__/senden-und-stop-je-unterhaltung.test.tsx
@@ -55,45 +55,46 @@ const stopButton = () => screen.queryByRole('button', { name: 'Stop generation'
beforeEach(() => cleanup())
+/**
+ * Runde 4 (review-lanes.md Blocker 1+6): the cross-conversation lock this
+ * file used to test (`busyElsewhere`, "Another chat is still answering...")
+ * is gone from `ChatInput` entirely. It is no longer needed: a second local
+ * send now queues visibly instead of racing the first one for the built-in
+ * engine's one slot (see composer-zeigt-warten-auf-lokale-spur.test.tsx for
+ * that line), and a second cloud send just runs alongside the first. What is
+ * left to prove here is the negative: a conversation that is NOT the one
+ * answering keeps an ordinary, USABLE Send button, full stop, regardless of
+ * what `composerBusy` reports about some other conversation.
+ */
describe('the composer of a chat that is NOT the one answering', () => {
- /** What ChatView hands down while conversation `b` is the one generating. */
+ /** What ChatView hands down while conversation `b` is the one generating:
+ * `thisChat` is what still reaches ChatInput's `isGenerating`. */
const asSeenFromA = composerBusy(true, { b: true }, 'a')
- it('keeps its Send button instead of losing it to a foreign run', () => {
+ it('keeps its Send button instead of losing it to a foreign run, and shows no waiting line', () => {
render(
<ChatInput
onSend={() => {}}
onStop={() => { throw new Error('a foreign run must not be stoppable from here') }}
isGenerating={asSeenFromA.thisChat}
- busyElsewhere={asSeenFromA.otherChat}
/>,
)
expect(sendButton()).toBeTruthy()
expect(stopButton()).toBeNull()
+ expect(screen.queryByTestId('composer-busy-elsewhere')).toBeNull()
+ expect(screen.queryByTestId('composer-waiting-local-lane')).toBeNull()
})
- it('says in English why it is waiting, instead of going quiet', () => {
- render(
- <ChatInput onSend={() => {}} onStop={() => {}} isGenerating={asSeenFromA.thisChat} busyElsewhere={asSeenFromA.otherChat} />,
- )
- const line = screen.getByTestId('composer-busy-elsewhere')
- expect(line.textContent).toContain('Another chat is still answering')
- expect(line.textContent).toContain('one answer at a time')
- // It has to tell the user what to do next, not just that something is off.
- expect(line.textContent).toMatch(/wait for it to finish or stop it in that chat/)
- expect(line.getAttribute('role')).toBe('status')
- })
-
- it('does not fire a send while another chat holds the engine', () => {
+ it('does fire a send while another chat is answering, no lock left to stop it', () => {
let sent = 0
render(
- <ChatInput onSend={() => { sent += 1 }} onStop={() => {}} isGenerating={asSeenFromA.thisChat} busyElsewhere={asSeenFromA.otherChat} />,
+ <ChatInput onSend={() => { sent += 1 }} onStop={() => {}} isGenerating={asSeenFromA.thisChat} />,
)
const box = screen.getByRole('textbox')
fireEvent.change(box, { target: { value: 'hello' } })
- expect(sendButton()!.disabled).toBe(true)
+ expect(sendButton()!.disabled).toBe(false)
fireEvent.keyDown(box, { key: 'Enter' })
- expect(sent).toBe(0)
+ expect(sent).toBe(1)
})
})
@@ -103,7 +104,7 @@ describe('the composer of the chat that IS answering', () => {
it('shows Stop, and no waiting line', () => {
let stopped = 0
render(
- <ChatInput onSend={() => {}} onStop={() => { stopped += 1 }} isGenerating={asSeenFromB.thisChat} busyElsewhere={asSeenFromB.otherChat} />,
+ <ChatInput onSend={() => {}} onStop={() => { stopped += 1 }} isGenerating={asSeenFromB.thisChat} />,
)
expect(sendButton()).toBeNull()
expect(screen.queryByTestId('composer-busy-elsewhere')).toBeNull()
@@ -113,7 +114,7 @@ describe('the composer of the chat that IS answering', () => {
it('COUNTER-CHECK: an idle chat shows Send and says nothing', () => {
const idle = composerBusy(false, {}, 'b')
- render(<ChatInput onSend={() => {}} onStop={() => {}} isGenerating={idle.thisChat} busyElsewhere={idle.otherChat} />)
+ render(<ChatInput onSend={() => {}} onStop={() => {}} isGenerating={idle.thisChat} />)
expect(sendButton()).toBeTruthy()
expect(sendButton()!.disabled).toBe(true) // empty box, not a busy engine
expect(screen.queryByTestId('composer-busy-elsewhere')).toBeNull()
@@ -208,13 +209,15 @@ describe('Stop bricht nur die eigene Erzeugung ab', () => {
it('der Komposer liest nicht mehr die app-weite Fahne', () => {
const view = src('../ChatView.tsx')
const composer = view.slice(view.indexOf('<ChatInput'), view.indexOf('composerActions='))
- // Runde 4 (review-lanes.md Blocker 1+6): `isGenerating` traegt jetzt auch
- // den Warteschlangen-Fall (`queuedForLocalLane`), damit der Stop-Knopf
- // schon waehrend des Wartens auf die lokale Spur steht, nicht erst wenn
- // der Strom beginnt. Die Aussage dieses Tests bleibt dieselbe: kein
- // app-weites `isGenerating`, alles hier ist je-Unterhaltung.
+ // Runde 4 Schritt 2 (review-lanes.md Blocker 1+6): `isGenerating` traegt
+ // jetzt auch den Warteschlangen-Fall (`queuedForLocalLane`), damit der
+ // Stop-Knopf schon waehrend des Wartens auf die lokale Spur steht, nicht
+ // erst wenn der Strom beginnt. Schritt 4: `busyElsewhere` ist ganz weg,
+ // kein Aufrufer sperrt mehr wegen einer ANDEREN Unterhaltung. Die Aussage
+ // dieses Tests bleibt dieselbe: kein app-weites `isGenerating`, alles
+ // hier ist je-Unterhaltung.
expect(composer).toContain('isGenerating={busy.thisChat || queuedForLocalLane}')
- expect(composer).toContain('busyElsewhere={busy.otherChat}')
+ expect(composer).not.toContain('busyElsewhere')
expect(composer).toContain('waitingForLocalLane={queuedForLocalLane}')
expect(composer).not.toContain('isGenerating={isGenerating}')
// Die MessageList behaelt die app-weite Fahne mit Absicht: Regenerate und
diff --git a/src/hooks/__tests__/useAgentChat-lokale-spur-reiht-zweiten-agentenlauf-ein.test.ts b/src/hooks/__tests__/useAgentChat-lokale-spur-reiht-zweiten-agentenlauf-ein.test.ts
index 7b45a86a..e40d7997 100644
--- a/src/hooks/__tests__/useAgentChat-lokale-spur-reiht-zweiten-agentenlauf-ein.test.ts
+++ b/src/hooks/__tests__/useAgentChat-lokale-spur-reiht-zweiten-agentenlauf-ein.test.ts
@@ -4,7 +4,7 @@
* Runde 4 (review-lanes.md Blocker 1+6): useAgentChat.ts's sendAgentMessage
* must run through `runInLane` on the local lane, same as plain chat. Two
* conversations on the built-in engine (n_parallel=1) may not both fire a
- * request at once — the second must queue, show up in `queuedRunIds()`, and
+ * request at once. The second must queue, show up in `queuedRunIds()`, and
* only start once the first agent run is done.
*
* `laneOf`/`currentLaneFacts` are mocked to force the 'local' lane
diff --git a/src/hooks/__tests__/useChat-lokale-spur-reiht-zweite-sendung-ein.test.ts b/src/hooks/__tests__/useChat-lokale-spur-reiht-zweite-sendung-ein.test.ts
index ba312b2a..d7ef8628 100644
--- a/src/hooks/__tests__/useChat-lokale-spur-reiht-zweite-sendung-ein.test.ts
+++ b/src/hooks/__tests__/useChat-lokale-spur-reiht-zweite-sendung-ein.test.ts
@@ -3,7 +3,7 @@
*
* Runde 4 (review-lanes.md Blocker 1+6): useChat.ts's plain sendMessage
* must run through `runInLane` on the local lane. Two conversations on the
- * built-in engine (n_parallel=1) may not both fire a request at once — the
+ * built-in engine (n_parallel=1) may not both fire a request at once: the
* second must queue and only start once the first is done.
*
* `laneOf`/`currentLaneFacts` are mocked to force BOTH conversations onto
diff --git a/src/hooks/__tests__/useCodex-lokale-spur-reiht-zweiten-lauf-ein.test.ts b/src/hooks/__tests__/useCodex-lokale-spur-reiht-zweiten-lauf-ein.test.ts
index d5b462d6..2f86b3fa 100644
--- a/src/hooks/__tests__/useCodex-lokale-spur-reiht-zweiten-lauf-ein.test.ts
+++ b/src/hooks/__tests__/useCodex-lokale-spur-reiht-zweiten-lauf-ein.test.ts
@@ -5,7 +5,7 @@
* its sendInstruction wrapper) must run through `runInLane` on the local
* lane, same as useChat.ts and useAgentChat.ts. Two Coding-Agent
* conversations on the built-in engine (n_parallel=1) may not both reach
- * their provider call at once — the second must queue.
+ * their provider call at once: the second must queue.
*
* `resolveChatWorkspaceSlug` is used as the gate, the same technique as
* `useCodex-lauf-gehoert-seiner-unterhaltung.test.ts`: it is the first real
@@ -26,7 +26,7 @@ vi.mock('../../api/workspace-slug', () => ({
resolveChatWorkspaceSlug: vi.fn(async (convId: string) => {
slugCalls.push(convId)
await new Promise<void>((resolve, reject) => { gates.push({ resolve, reject }) })
- // Never actually resolves successfully in this test — rejecting is the
+ // Never actually resolves successfully in this test, rejecting is the
// fastest, most deterministic way to end a run via the outer safety-net
// catch (Nachbesserung 5, review-lanes.md) once the lane-admission
// question has already been observed. What matters here is WHEN the
@@ -96,7 +96,7 @@ describe('runInstruction reiht einen zweiten lokalen Coding-Lauf ein', () => {
expect(slugCalls).toEqual([convA])
expect(queuedRunIds()).toEqual([convB])
- // Let A's gate fail — A's run ends (through the safety-net catch),
+ // Let A's gate fail, so A's run ends (through the safety-net catch),
// releasing the local lane.
await act(async () => {
gates[0].reject(new Error('workspace slug unavailable (test)'))
diff --git a/src/hooks/__tests__/zwei-cloud-unterhaltungen-eine-bekommt-busy.test.ts b/src/hooks/__tests__/zwei-cloud-unterhaltungen-eine-bekommt-busy.test.ts
index 57d69a4d..8eec7da7 100644
--- a/src/hooks/__tests__/zwei-cloud-unterhaltungen-eine-bekommt-busy.test.ts
+++ b/src/hooks/__tests__/zwei-cloud-unterhaltungen-eine-bekommt-busy.test.ts
@@ -149,7 +149,7 @@ describe('zwei Cloud-Unterhaltungen, eine bekommt dauerhaft busy (429)', () => {
expect(answerB).toMatch(/rate limited by lu cloud/i)
expect(answerB).toMatch(/wait a moment and try again/i)
// Never reads as an exhausted-wallet message (different code path,
- // different dialog) — a mislabel here would pop the top-up dialog for a
+ // different dialog): a mislabel here would pop the top-up dialog for a
// transient busy instead of the truth.
expect(answerB).not.toMatch(/credit/i)
diff --git a/src/hooks/useAgentChat.ts b/src/hooks/useAgentChat.ts
index 6c31667f..10562974 100644
--- a/src/hooks/useAgentChat.ts
+++ b/src/hooks/useAgentChat.ts
@@ -418,7 +418,7 @@ export function useAgentChat() {
// here to the end of this call (RAG, memory, the tool loop, the /loop
// driver) runs inside runInLane's body, so a local turn that has to wait
// for the built-in engine's one llama-server slot has not yet touched the
- // chat store when it is queued — nothing has been added that a cancelled
+ // chat store when it is queued, so nothing has been added that a cancelled
// wait would need to unwind. The re-entry guard above already claimed
// activeAgentRuns/isAgentRunning synchronously, before any await, so a
// second send on the SAME conversation is refused before it ever reaches
diff --git a/src/lib/__tests__/composer-busy.test.ts b/src/lib/__tests__/composer-busy.test.ts
index 007770bf..4eb55606 100644
--- a/src/lib/__tests__/composer-busy.test.ts
+++ b/src/lib/__tests__/composer-busy.test.ts
@@ -4,7 +4,14 @@
* Befund T1 (Box, 11.09.2026), Punkt 4 und Nebenfund 4: solange irgendwo eine
* Antwort lief, verschwand der Sendeknopf in JEDER Unterhaltung, und der
* Stop-Knopf in der zweiten brach die Erzeugung der ersten ab. Der Komposer
- * las eine einzige app-weite Fahne. Diese Datei nagelt die Aufteilung fest.
+ * las eine einzige app-weite Fahne. Diese Datei nagelt fest, dass die eigene
+ * Unterhaltung ihr Stop korrekt zeigt.
+ *
+ * Runde 4 (review-lanes.md Blocker 1+6): `otherChat` ist aus dem
+ * Rueckgabewert entfernt (siehe composer-busy.ts's Kopfkommentar). Es gibt
+ * keinen Aufrufer mehr, der eine ANDERE Unterhaltung sperrt; ein lokaler
+ * zweiter Lauf reiht sich sichtbar ein (lib/run-lanes.ts), ein Cloud-Lauf
+ * laeuft parallel. Diese Datei prueft seither nur noch `thisChat`.
*
* Run: npx vitest run src/lib/__tests__/composer-busy.test.ts
*/
@@ -14,13 +21,13 @@ import { composerBusy } from '../composer-busy'
describe('composerBusy', () => {
it('gives Stop to the chat that is answering and leaves the other one Send', () => {
const map = { a: true }
- expect(composerBusy(true, map, 'a')).toEqual({ thisChat: true, otherChat: false })
- expect(composerBusy(true, map, 'b')).toEqual({ thisChat: false, otherChat: true })
+ expect(composerBusy(true, map, 'a')).toEqual({ thisChat: true })
+ expect(composerBusy(true, map, 'b')).toEqual({ thisChat: false })
})
it('says nothing at all while nothing runs', () => {
- expect(composerBusy(false, {}, 'a')).toEqual({ thisChat: false, otherChat: false })
- expect(composerBusy(false, { a: false }, 'a')).toEqual({ thisChat: false, otherChat: false })
+ expect(composerBusy(false, {}, 'a')).toEqual({ thisChat: false })
+ expect(composerBusy(false, { a: false }, 'a')).toEqual({ thisChat: false })
})
it('keeps Stop on a run the map does not know about, rather than losing it', () => {
@@ -28,7 +35,7 @@ describe('composerBusy', () => {
// a stream and registering it: the hook knows, the map does not yet. The
// chat on screen keeps Stop, because a run nobody can stop is worse than a
// Stop button one click too early.
- expect(composerBusy(true, {}, 'a')).toEqual({ thisChat: true, otherChat: false })
+ expect(composerBusy(true, {}, 'a')).toEqual({ thisChat: true })
})
it('does not hand the chat on screen a Stop for a run that is somewhere else', () => {
@@ -37,11 +44,11 @@ describe('composerBusy', () => {
})
it('lets a chat that is answering itself stay Stop while another one also runs', () => {
- expect(composerBusy(true, { a: true, b: true }, 'a')).toEqual({ thisChat: true, otherChat: false })
+ expect(composerBusy(true, { a: true, b: true }, 'a')).toEqual({ thisChat: true })
})
it('survives a chat list with no conversation open', () => {
- expect(composerBusy(true, { b: true }, null)).toEqual({ thisChat: false, otherChat: true })
- expect(composerBusy(false, {}, null)).toEqual({ thisChat: false, otherChat: false })
+ expect(composerBusy(true, { b: true }, null)).toEqual({ thisChat: false })
+ expect(composerBusy(false, {}, null)).toEqual({ thisChat: false })
})
})
diff --git a/src/lib/composer-busy.ts b/src/lib/composer-busy.ts
index fc4af577..a7c19422 100644
--- a/src/lib/composer-busy.ts
+++ b/src/lib/composer-busy.ts
@@ -8,6 +8,19 @@
* truth already existed in `generationStore.generating`; only the composer
* never asked it.
*
+ * Runde 4 (review-lanes.md Blocker 1+6): `otherChat` used to reach the
+ * composer too, as `busyElsewhere`, a lock that dropped this chat's Send
+ * button and put up a line whenever ANY other conversation was generating.
+ * That lock is gone: a local second send now queues visibly instead of
+ * racing the first one for the built-in engine's one slot (`lib/run-slot.ts`,
+ * `lib/run-lanes.ts`), and a cloud second send just runs alongside the first,
+ * so there is nothing left for a cross-conversation lock to protect against.
+ * `otherChat` stays computed here, unexported to a caller by choice, purely
+ * because `thisChat` below still needs it: `hookGenerating` is wider than the
+ * map (see below), and without excluding a run that another conversation
+ * clearly owns, a stale or orphaned hook flag could hand THIS chat's Stop
+ * button to a run that belongs elsewhere.
+ *
* `hookGenerating` stays in the answer on purpose. It is wider than the map:
* it also covers a run this app instance did not register, an orphaned run
* picked up after a reload, and the window between starting a stream and
@@ -18,8 +31,6 @@
export interface ComposerBusy {
/** The conversation on screen is answering: it shows Stop. */
thisChat: boolean
- /** Some OTHER conversation is answering: this one says so instead of going quiet. */
- otherChat: boolean
}
export function composerBusy(
@@ -32,6 +43,5 @@ export function composerBusy(
const own = !!activeConversationId && !!generatingMap[activeConversationId]
return {
thisChat: own || (hookGenerating && !otherChat),
- otherChat: otherChat && !own,
}
}
diff --git a/src/lib/run-idle.ts b/src/lib/run-idle.ts
index e9f67dd9..2b1c8831 100644
--- a/src/lib/run-idle.ts
+++ b/src/lib/run-idle.ts
@@ -197,7 +197,7 @@ export function isRunActive(conversationId: string | null | undefined): boolean
* Stop button (not Send) while a send is queued, and the "waiting for the
* local model" line. `useSyncExternalStore` with `subscribeRunLanes` is the
* plain React wrapper around the module state `lib/run-lanes.ts` already
- * keeps and already wakes on — no second copy of "is it queued", the two
+ * keeps and already wakes on, no second copy of "is it queued": the two
* view components just read the same one fact reactively instead of via
* `getState()`-equivalent calls that would not trigger a re-render when a
* run gets promoted out of the queue.