The best way to control Claude Code, Codex and more from any computer or phone
fix(web,mobile): Send now tells you why it could not send (#31283)
Julius Marminge committed
Nov 16, 2026 at 20:19 UTC
8753e4d36bfdc33f0df9046ea239ad8f361b8ff1
3 files changed
+92
-27
apps/mobile/src/features/threads/ThreadQueueControl.tsx
+22
-14
@@ -191,22 +191,30 @@ export function ThreadQueueSheet({ route }: StaticScreenProps<QueueTarget>) {
191
busyRef.current = true;
192
setBusyRunId(runId);
193
void Haptics.selectionAsync();
194
- if (action === "remove") {
195
- await cancel(buildCancelQueuedRunCommand({ ...target, runId }));
196
- } else if (workflow?.canSendNow) {
197
- await resume({ ...target, input: { threadId: target.threadId, runId } });
198
- } else if (workflow?.activeRun && workflow.canPromoteToSteer) {
199
- await promote({
200
- ...target,
201
- input: {
202
- threadId: target.threadId,
203
- queuedRunId: runId,
204
- targetRunId: workflow.activeRun.id,
205
- },
206
- });
207
- }
194
+ const result =
195
+ action === "remove"
196
+ ? await cancel(buildCancelQueuedRunCommand({ ...target, runId }))
197
+ : workflow?.canSendNow
198
+ ? await resume({ ...target, input: { threadId: target.threadId, runId } })
199
+ : workflow?.activeRun && workflow.canPromoteToSteer
200
+ ? await promote({
201
+ ...target,
202
+ input: {
203
+ threadId: target.threadId,
204
+ queuedRunId: runId,
205
+ targetRunId: workflow.activeRun.id,
206
+ },
207
+ })
208
+ : null;
209
busyRef.current = false;
210
setBusyRunId(null);
211
+ if (action === "steer" && result?._tag === "Failure" && !isAtomCommandInterrupted(result)) {
212
+ const error = squashAtomCommandFailure(result);
213
+ Dialog.alert(
214
+ "Could not send queued message",
215
+ error instanceof Error ? error.message : "Try again.",
216
+ );
217
+ }
218
};
219
220
const content = (
apps/web/src/components/chat/QueuedRunsControl.browser.test.tsx
+46
-2
@@ -1,11 +1,18 @@
1
import { RegistryContext } from "@effect/atom-react";
2
import type { EnvironmentThreadState } from "@t3tools/client-runtime/state/threads";
3
-import { EnvironmentId, MessageId, ThreadId } from "@t3tools/contracts";
3
+import {
4
+ CommandId,
5
+ EnvironmentId,
6
+ MessageId,
7
+ OrchestrationV2DispatchCommandError,
8
+ ThreadId,
9
+} from "@t3tools/contracts";
10
import { serializeAssistantCitation } from "@t3tools/shared/assistantCitations";
11
import {
12
formatComposerContextReference,
13
toComposerContextId,
14
} from "@t3tools/shared/composerContextReferences";
15
+import * as Cause from "effect/Cause";
16
import * as DateTime from "effect/DateTime";
17
import * as Option from "effect/Option";
18
import { AsyncResult, type Atom, AtomRegistry } from "effect/reactivity";
@@ -16,6 +23,7 @@ import { page } from "vite-plus/test/browser";
23
const state = vi.hoisted(() => ({
24
threadState: null as unknown as Atom.Writable<AsyncResult.AsyncResult<EnvironmentThreadState>>,
25
workflow: null as unknown,
26
+ commandResult: undefined as unknown,
27
}));
28
29
vi.mock(import("@t3tools/client-runtime/state/thread-workflows"), async (importOriginal) => ({
@@ -66,7 +74,7 @@ vi.mock(import("../../state/threads"), async (importOriginal) => {
74
75
vi.mock(import("../../state/use-atom-command"), async (importOriginal) => ({
76
...(await importOriginal()),
69
- useAtomCommand: (() => async () => undefined) as never,
77
+ useAtomCommand: (() => async () => state.commandResult) as never,
78
}));
79
80
vi.mock(import("../../assets/assetUrls"), async (importOriginal) => ({
@@ -80,12 +88,14 @@ import { EMPTY_ENVIRONMENT_THREAD_STATE } from "@t3tools/client-runtime/state/th
88
89
import { act, render as renderUi } from "../../../test/render";
90
import { makeStreamingTimelineFixture, makeThreadProjectionFixture } from "../../test-fixtures";
91
+import { ToastProvider } from "../ui/toast";
92
import { QueuedRunsControl } from "./QueuedRunsControl";
93
import { ExpandedImageDialog } from "./ExpandedImageDialog";
94
import type { ExpandedImagePreview } from "./ExpandedImagePreview";
95
96
function setup() {
97
state.workflow = null;
98
+ state.commandResult = undefined;
99
}
100
101
const baseProps = {
@@ -399,3 +409,37 @@ it("does not re-render while assistant text streams into the thread", async () =
409
await act(() => registry.set(state.threadState, thread("Hello there", true)));
410
expect(renders).toBeGreaterThan(settled);
411
});
412
+
413
+it("tells the user why Send now was rejected", async () => {
414
+ setup();
415
+ const reason = "Target run run:active is stopping and cannot be steered.";
416
+ state.workflow = {
417
+ activeRun: { id: "run:active" },
418
+ canPromoteToSteer: true,
419
+ queuedRuns: [
420
+ {
421
+ run: { id: "run:queued", userMessageId: "message:queued" },
422
+ text: "Follow up",
423
+ attachments: [],
424
+ },
425
+ ],
426
+ };
427
+ state.commandResult = AsyncResult.failure(
428
+ Cause.fail(
429
+ new OrchestrationV2DispatchCommandError({
430
+ commandId: CommandId.make("command:promote"),
431
+ commandType: "queued-message.promote-to-steer",
432
+ message: reason,
433
+ detail: reason,
434
+ }),
435
+ ),
436
+ );
437
+ await using _screen = await renderUi(
438
+ <ToastProvider timeout={0}>
439
+ <QueuedRunsControl {...baseProps} />
440
+ </ToastProvider>,
441
+ );
442
+
443
+ await page.getByRole("button", { name: "Send now" }).click();
444
+ await vi.waitFor(() => expect(page.getByText(reason).element()).toBeVisible());
445
+});
apps/web/src/components/chat/QueuedRunsControl.tsx
+24
-11
@@ -1,4 +1,8 @@
1
import { scopeThreadRef } from "@t3tools/client-runtime/environment";
2
+import {
3
+ isAtomCommandInterrupted,
4
+ squashAtomCommandFailure,
5
+} from "@t3tools/client-runtime/state/runtime";
6
import { deriveThreadQueueWorkflowState } from "@t3tools/client-runtime/state/thread-workflows";
7
import { assistantCitationsToPlainText } from "@t3tools/shared/assistantCitations";
8
import {
@@ -34,6 +38,7 @@ import { useAtomCommand } from "../../state/use-atom-command";
38
import { isImageAttachment, type ChatImageAttachment, type ChatMessage } from "../../types";
39
import { cn } from "~/lib/utils";
40
import { Button, InlineButton } from "../ui/button";
41
+import { toastManager } from "../ui/toast";
42
import { Tooltip, TooltipPopup, TooltipTrigger } from "../ui/tooltip";
43
import type { TimestampFormat } from "@t3tools/contracts/settings";
44
import { GuestMessageName } from "./guestMessageStyle";
@@ -168,19 +173,27 @@ export function QueuedRunsControl({
173
if (!canSendRun(freshContext) || steerInFlightRef.current) return;
174
steerInFlightRef.current = true;
175
setBusyRunId(queuedRunId);
171
- if (workflow?.canSendNow) {
172
- await resume({
173
- environmentId: props.environmentId,
174
- input: { threadId: props.threadId, runId: queuedRunId },
175
- });
176
- } else if (activeRun !== null) {
177
- await promote({
178
- environmentId: props.environmentId,
179
- input: { threadId: props.threadId, queuedRunId, targetRunId: activeRun.id },
180
- });
181
- }
176
+ const result = workflow?.canSendNow
177
+ ? await resume({
178
+ environmentId: props.environmentId,
179
+ input: { threadId: props.threadId, runId: queuedRunId },
180
+ })
181
+ : activeRun !== null
182
+ ? await promote({
183
+ environmentId: props.environmentId,
184
+ input: { threadId: props.threadId, queuedRunId, targetRunId: activeRun.id },
185
+ })
186
+ : null;
187
steerInFlightRef.current = false;
188
setBusyRunId(null);
189
+ if (result?._tag === "Failure" && !isAtomCommandInterrupted(result)) {
190
+ const error = squashAtomCommandFailure(result);
191
+ toastManager.add({
192
+ type: "error",
193
+ title: "Could not send queued message",
194
+ description: error instanceof Error ? error.message : "An error occurred.",
195
+ });
196
+ }
197
};
198
199
useImperativeHandle(ref, () => ({