The best way to control Claude Code, Codex and more from any computer or phone
fix(clients): queued messages can't be edited while a question is open (#25593)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Julius Marminge committed
Oct 26, 2026 at 14:28 UTC
fe507c5a1e064c82e7b49a002e5f9520cfaeaaac
8 files changed
+81
-27
apps/mobile/src/features/threads/ThreadDetailScreen.tsx
+8
-1
@@ -26,6 +26,7 @@ import type { ComposerTextPaste } from "../../native/T3ComposerEditor.types";
26
import { type EnvironmentConnectionPhase } from "@t3tools/client-runtime/connection";
27
import type { EnvironmentThreadShell } from "@t3tools/client-runtime/state/shell";
28
import type { HandoffEndpoints } from "@t3tools/client-runtime/handoff";
29
+import { queuedRunEditBlockedReason } from "@t3tools/client-runtime/queued-run-edit";
30
import {
31
childThreadInputsTitle,
32
type CodexFeedbackSubmission,
@@ -777,6 +778,9 @@ function ThreadDetailBody(props: ThreadDetailScreenProps) {
778
const activeUserInputRequestId = props.activePendingUserInput?.requestId ?? null;
779
const composerSlotHidden =
780
activeUserInputRequestId !== null || props.creationState?.kind === "failed";
781
+ const pendingMessageEditBlocked =
782
+ queuedRunEditBlockedReason({ openQuestionCount: activeUserInputRequestId === null ? 0 : 1 }) !==
783
+ null;
784
const [usageLimitsPanel, setUsageLimitsPanel] = useState<{
785
readonly key: string;
786
readonly threadKey: string;
@@ -1167,6 +1171,7 @@ function ThreadDetailBody(props: ThreadDetailScreenProps) {
1171
};
1172
1173
const handleEditPendingMessage = async (message: QueuedThreadMessage) => {
1174
+ if (pendingMessageEditBlocked) return;
1175
const scope = threadScope.current.signal;
1176
const edited = await settlePromise(() => editPendingThreadMessage(message));
1177
if (AsyncResult.isFailure(edited)) {
@@ -1296,7 +1301,9 @@ function ThreadDetailBody(props: ThreadDetailScreenProps) {
1301
dispatchingMessageId={props.dispatchingMessageId}
1302
// A native subagent has no composer to edit a pending message in;
1303
// Cancel on the edit banner would discard it.
1299
- onEditPendingMessage={isProviderSubagent ? null : handleEditPendingMessage}
1304
+ onEditPendingMessage={
1305
+ isProviderSubagent || pendingMessageEditBlocked ? null : handleEditPendingMessage
1306
+ }
1307
contentPresentation={props.contentPresentation}
1308
agentLabel={agentLabel}
1309
threadTitle={props.selectedThread.title}
apps/mobile/src/features/threads/ThreadQueueControl.tsx
+14
-2
@@ -1,6 +1,9 @@
1
import { type StaticScreenProps, useNavigation } from "@react-navigation/native";
2
import { useAtomValue } from "@effect/atom-react";
3
-import { makeQueuedRunsAtom } from "@t3tools/client-runtime/queued-run-edit";
3
+import {
4
+ makeQueuedRunsAtom,
5
+ queuedRunEditBlockedReason,
6
+} from "@t3tools/client-runtime/queued-run-edit";
7
import type { ChatAttachment, EnvironmentId, RunId, ThreadId } from "@t3tools/contracts";
8
import { Atom } from "effect/reactivity";
9
import { Image } from "expo-image";
@@ -75,6 +78,10 @@ export function ThreadQueueSheet({ route }: StaticScreenProps<QueueTarget>) {
78
const workflow = useThreadQueueWorkflow(target);
79
const threadKey = scopedThreadKey(target.environmentId, target.threadId);
80
const editing = useQueuedRunEdit(threadKey);
81
+ const pendingRequests = useAtomValue(environmentThreadDetails.pendingRequestsAtom(target));
82
+ const editBlockedReason = queuedRunEditBlockedReason({
83
+ openQuestionCount: pendingRequests?.userInputs.length ?? 0,
84
+ });
85
const reorder = useAtomCommand(threadEnvironment.reorderQueuedRun, "reorder queued message");
86
const promote = useAtomCommand(threadEnvironment.promoteQueuedRun, "promote queued message");
87
const cancel = useAtomCommand(threadEnvironment.cancelQueuedRun, "remove queued message");
@@ -127,6 +134,7 @@ export function ThreadQueueSheet({ route }: StaticScreenProps<QueueTarget>) {
134
return;
135
}
136
if (action === "edit") {
137
+ if (editBlockedReason !== null) return;
138
const entry = queuedRuns[index]!;
139
void Haptics.selectionAsync();
140
beginQueuedRunEdit(
@@ -212,6 +220,9 @@ export function ThreadQueueSheet({ route }: StaticScreenProps<QueueTarget>) {
220
/>
221
</View>
222
) : null}
223
+ {editBlockedReason !== null && queuedRuns.length > 0 ? (
224
+ <Text className="py-3 text-sm text-foreground-muted">{editBlockedReason}</Text>
225
+ ) : null}
226
{queuedRuns.length === 0 ? (
227
<Text className="pt-6 text-center text-sm text-foreground-muted">
228
No messages waiting in this queue.
@@ -231,6 +242,7 @@ export function ThreadQueueSheet({ route }: StaticScreenProps<QueueTarget>) {
242
canPromoteToSteer: workflow?.canPromoteToSteer ?? false,
243
canSendNow: workflow?.canSendNow ?? false,
244
canReorder: workflow?.canReorder ?? false,
245
+ editBlocked: editBlockedReason !== null,
246
index,
247
isEditing: editing?.runId === run.id,
248
isGuestMessage: context?.guest !== undefined,
@@ -372,7 +384,7 @@ export function ThreadQueueSheet({ route }: StaticScreenProps<QueueTarget>) {
384
accessibilityHint={
385
controls.canEdit
386
? "Opens this message in the composer for editing"
375
- : undefined
387
+ : (editBlockedReason ?? undefined)
388
}
389
disabled={!controls.canEdit}
390
onPress={() => void act(run.id, "edit")}
apps/mobile/src/features/threads/threadQueueControlPresentation.ts
+4
-1
@@ -19,6 +19,8 @@ export function resolveThreadQueueRowControls(input: {
19
readonly canPromoteToSteer: boolean;
20
readonly canSendNow: boolean;
21
readonly canReorder: boolean;
22
+ /** Something else holds the composer, such as an open question. */
23
+ readonly editBlocked?: boolean;
24
readonly index: number;
25
readonly isEditing?: boolean;
26
/** A guest's message keeps the guest's words; the owner can cancel it, not rewrite it. */
@@ -33,7 +35,8 @@ export function resolveThreadQueueRowControls(input: {
35
canDismiss: !input.busy,
36
// Re-opening the row already in the composer would reload it and throw
37
// away whatever has been typed since.
36
- canEdit: mutationEnabled && !isEditing && input.isGuestMessage !== true,
38
+ canEdit:
39
+ mutationEnabled && !isEditing && input.isGuestMessage !== true && input.editBlocked !== true,
40
canMoveDown: mutationEnabled && input.canReorder && input.index < input.queuedCount - 1,
41
canMoveUp: mutationEnabled && input.canReorder && input.index > 0,
42
canSend: mutationEnabled && (input.canPromoteToSteer || input.canSendNow) && !isEditing,
apps/web/src/components/ChatView.tsx
+4
@@ -1,4 +1,5 @@
1
import { sourceControlClients } from "@t3tools/client-runtime/source-control-clients";
2
+import { queuedRunEditBlockedReason } from "@t3tools/client-runtime/queued-run-edit";
3
import { ScrollToEndButton, WorkspaceFileDropOverlay } from "./chat/TimelineOverlays";
4
import { usePasteToFocusComposer } from "./chat/usePasteToFocusComposer";
5
import { announcedRun, isDetailBehindShell } from "./chat/threadActivityAnnouncement";
@@ -2924,6 +2925,9 @@ export default function ChatView(props: ChatViewProps) {
2925
threadId={activeThread.id}
2926
optimisticMessages={optimisticUserMessages}
2927
editingRunId={queuedRunEdit.editingRunId}
2928
+ editBlockedReason={queuedRunEditBlockedReason({
2929
+ openQuestionCount: pendingUserInputs.length,
2930
+ })}
2931
onEditQueuedRun={queuedRunEdit.beginEdit}
2932
onCancelEdit={queuedRunEdit.cancelEdit}
2933
/>
apps/web/src/components/chat/QueuedRunsControl.browser.test.tsx
+1
@@ -43,6 +43,7 @@ const baseProps = {
43
optimisticMessages: [],
44
threadId: "thread:test" as never,
45
editingRunId: null,
46
+ editBlockedReason: null,
47
onEditQueuedRun: () => undefined,
48
onCancelEdit: () => undefined,
49
} satisfies ComponentProps<typeof QueuedRunsControl>;
apps/web/src/components/chat/QueuedRunsControl.tsx
+29
-23
@@ -74,6 +74,8 @@ export function QueuedRunsControl({
74
Pick<ChatMessage, "id" | "inputIntent" | "text" | "attachments">
75
>;
76
readonly editingRunId: RunId | null;
77
+ /** Set while something else holds the composer, such as an open question. */
78
+ readonly editBlockedReason: string | null;
79
readonly onEditQueuedRun: (request: EditQueuedRunRequest) => void;
80
readonly onCancelEdit: () => void;
81
}) {
@@ -207,6 +209,7 @@ export function QueuedRunsControl({
209
!latest ||
210
latest.context?.guest !== undefined ||
211
props.editingRunId !== null ||
212
+ props.editBlockedReason !== null ||
213
busyRunId !== null
214
) {
215
return false;
@@ -413,32 +416,35 @@ export function QueuedRunsControl({
416
) : (
417
<>
418
<Tooltip>
416
- <TooltipTrigger
417
- render={
418
- <Button
419
- size="icon-xs"
420
- variant="ghost-muted"
421
- aria-label="Edit queued message"
422
- disabled={
423
- item.runId === null || !item.editable || busyRunId !== null
419
+ {/* The span keeps the tooltip, and its reason, on a disabled button. */}
420
+ <TooltipTrigger render={<span className="flex shrink-0" />}>
421
+ <Button
422
+ size="icon-xs"
423
+ variant="ghost-muted"
424
+ aria-label="Edit queued message"
425
+ disabled={
426
+ item.runId === null ||
427
+ !item.editable ||
428
+ busyRunId !== null ||
429
+ props.editBlockedReason !== null
430
+ }
431
+ onClick={() => {
432
+ if (item.runId !== null && item.messageId !== null) {
433
+ props.onEditQueuedRun({
434
+ runId: item.runId,
435
+ messageId: item.messageId,
436
+ text: item.text,
437
+ attachments: item.attachments,
438
+ });
439
}
425
- onClick={() => {
426
- if (item.runId !== null && item.messageId !== null) {
427
- props.onEditQueuedRun({
428
- runId: item.runId,
429
- messageId: item.messageId,
430
- text: item.text,
431
- attachments: item.attachments,
432
- });
433
- }
434
- }}
435
- />
436
- }
437
- >
438
- <PencilIcon />
440
+ }}
441
+ >
442
+ <PencilIcon />
443
+ </Button>
444
</TooltipTrigger>
445
<TooltipPopup>
441
- {`Edit in the composer${item.serverIndex === queued.length - 1 && props.editShortcutLabel ? ` (${props.editShortcutLabel})` : ""}`}
446
+ {props.editBlockedReason ??
447
+ `Edit in the composer${item.serverIndex === queued.length - 1 && props.editShortcutLabel ? ` (${props.editShortcutLabel})` : ""}`}
448
</TooltipPopup>
449
</Tooltip>
450
<Tooltip>
packages/client-runtime/src/queuedRunEdit.test.ts
+10
@@ -5,6 +5,7 @@ import { describe, expect, it } from "vite-plus/test";
5
import {
6
makeQueuedRunEditStore,
7
makeQueuedRunsAtom,
8
+ queuedRunEditBlockedReason,
9
resolveQueuedEditExit,
10
type QueuedRunStatus,
11
} from "./queuedRunEdit.ts";
@@ -40,6 +41,15 @@ describe("resolveQueuedEditExit", () => {
41
});
42
});
43
44
+describe("queuedRunEditBlockedReason", () => {
45
+ it("blocks edits only while a question holds the composer", () => {
46
+ expect(queuedRunEditBlockedReason({ openQuestionCount: 0 })).toBeNull();
47
+ expect(queuedRunEditBlockedReason({ openQuestionCount: 1 })).toBe(
48
+ "Answer the question to edit queued messages",
49
+ );
50
+ });
51
+});
52
+
53
describe("makeQueuedRunEditStore", () => {
54
it("fires once when the edited run leaves the queue, with the latest edit", () => {
55
const { registry, runs, store, exits, begin } = setup();
packages/client-runtime/src/queuedRunEdit.ts
+11
@@ -61,6 +61,17 @@ export function resolveQueuedEditExit(input: {
61
return input.threadDraftEmpty ? "kept" : "discarded";
62
}
63
64
+/**
65
+ * Why a queued message can't be opened in the composer now, or null when it
66
+ * can. An open question takes the composer over for its answer, so an edit
67
+ * begun then would happen out of sight and could be sent before it is seen.
68
+ */
69
+export function queuedRunEditBlockedReason(input: {
70
+ readonly openQuestionCount: number;
71
+}): string | null {
72
+ return input.openQuestionCount > 0 ? "Answer the question to edit queued messages" : null;
73
+}
74
+
75
interface ExitWatch<E> {
76
readonly runs: QueuedRunsAtom;
77
readonly runId: RunId;