Skip to content

Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.

fix(studio): keep Stop generating visible while queuing (#9123)

Kenshie5978989ed2c
diff --git a/studio/frontend/src/components/assistant-ui/thread.tsx b/studio/frontend/src/components/assistant-ui/thread.tsx
index 27d1b337479..b7cfd2cbc23 100644
--- a/studio/frontend/src/components/assistant-ui/thread.tsx
+++ b/studio/frontend/src/components/assistant-ui/thread.tsx
@@ -7092,8 +7092,7 @@ const ComposerRightControls: FC<{
<AuiIf condition={({ thread }) => thread.isRunning}>
{/* Classed so the narrow-screen rules can treat this like the
sibling send/stop buttons; it is the flex item, not the button. */}
- <div className="aui-composer-run-controls ml-1.5 flex items-center">
- {queueDisabled ? (
+ <div className="aui-composer-run-controls ml-1.5 flex items-center gap-1.5">
<ComposerPrimitive.Cancel asChild={true}>
<Button
type="button"
@@ -7101,26 +7100,27 @@ const ComposerRightControls: FC<{
size="icon"
className="aui-composer-cancel size-9 rounded-full"
aria-label="Stop generating"
+ // Cancel only ends the reply; handlePromptQueueRunState then
+ // dispatches the next queued prompt. stop() ends the run.
onClick={stop}
>
<SquareIcon className="size-3 fill-current" />
</Button>
</ComposerPrimitive.Cancel>
- ) : (
- <TooltipIconButton
- tooltip={followUpTooltip}
- side="bottom"
- type="button"
- variant="default"
- size="icon"
- disabled={queueDisabled}
- onClick={onQueueClick}
- className="aui-composer-send size-9 rounded-full"
- aria-label={followUpLabel}
- >
- <ArrowUpIcon className="unsloth-send-icon aui-composer-send-icon size-[calc(21px*var(--ui-space-scale,1))] stroke-2" />
- </TooltipIconButton>
- )}
+ {!queueDisabled ? (
+ <TooltipIconButton
+ tooltip={followUpTooltip}
+ side="bottom"
+ type="button"
+ variant="default"
+ size="icon"
+ onClick={onQueueClick}
+ className="aui-composer-send size-9 rounded-full"
+ aria-label={followUpLabel}
+ >
+ <ArrowUpIcon className="unsloth-send-icon aui-composer-send-icon size-[calc(21px*var(--ui-space-scale,1))] stroke-2" />
+ </TooltipIconButton>
+ ) : null}
</div>
</AuiIf>
)}
diff --git a/studio/frontend/tests/composer-stop-queue.test.ts b/studio/frontend/tests/composer-stop-queue.test.ts
new file mode 100644
index 00000000000..6b11aab0a13
--- /dev/null
+++ b/studio/frontend/tests/composer-stop-queue.test.ts
@@ -0,0 +1,55 @@
+// SPDX-License-Identifier: AGPL-3.0-only
+// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0
+
+import assert from "node:assert/strict";
+import { readFile } from "node:fs/promises";
+import test from "node:test";
+
+function composerSource(): Promise<string> {
+ return readFile(
+ new URL("../src/components/assistant-ui/thread.tsx", import.meta.url),
+ "utf8",
+ );
+}
+
+test("stop stays available when the running composer can queue", async () => {
+ const source = await composerSource();
+ const start = source.indexOf(
+ "<AuiIf condition={({ thread }) => thread.isRunning}>",
+ );
+ assert.ok(start >= 0, "the running composer controls must exist");
+
+ const end = source.indexOf("</AuiIf>", start);
+ assert.ok(end > start, "the running composer controls must be closed");
+ const controls = source.slice(start, end);
+ const stopLabel = 'aria-label="Stop generating"';
+ const queueGuard = "{!queueDisabled ?";
+
+ const stopIndex = controls.indexOf(stopLabel);
+ const queueGuardIndex = controls.indexOf(queueGuard);
+ assert.ok(stopIndex >= 0, "the running composer must expose Stop generating");
+ assert.ok(
+ queueGuardIndex > stopIndex,
+ "queue availability must be evaluated after the independent stop action",
+ );
+ assert.doesNotMatch(
+ controls,
+ /\{queueDisabled \?/,
+ "Stop and Queue must not share an exclusive queueDisabled ternary",
+ );
+ assert.match(
+ controls.slice(queueGuardIndex),
+ /aria-label=\{followUpLabel\}/,
+ "the follow-up action must remain available when the draft is queueable",
+ );
+ const stopButton = controls.match(
+ /<Button[\s\S]*?aria-label="Stop generating"[\s\S]*?>/,
+ );
+ assert.ok(stopButton, "the running composer must render a stop button");
+ // Without it a cancelled reply just advances the queue (#6244 wired it).
+ assert.match(
+ stopButton[0],
+ /onClick=\{stop\}/,
+ "stop must still end the prompt queue run, not only the active reply",
+ );
+});