The best way to control Claude Code, Codex and more from any computer or phone
fix(web): question answers submit while normal sends are blocked (#22874)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Julius Marminge <julius0216@outlook.com>
Theo Browne committed
Nov 11, 2026 at 03:07 UTC
d835e430dbc2863fb5bd9f2c76456e4773b0e0ef
4 files changed
+84
-36
apps/web/src/components/chat/ChatComposer.tsx
+23
-27
@@ -223,6 +223,7 @@ import { cn, isMacPlatform, randomUUID } from "~/lib/utils";
223
import {
224
getComposerPromptLengthValidationMessage,
225
getComposerSubmissionValidationMessage,
226
+ isComposerSubmissionBlocked,
227
submitComposerDraft,
228
} from "./composerSubmission";
229
import { ComposerPromptLengthValidation } from "./ComposerPromptLengthValidation";
@@ -1823,8 +1824,21 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
1824
},
1825
});
1826
const { blocksSubmission: voiceInputActive, submitAfterDictation } = speechInput;
1826
- const voiceSendDisabledReason =
1827
- sendDisabledReason ?? (speechInput.preparing ? "Preparing voice input" : null);
1827
+ const submissionTarget = activePendingProgress ? "pending-user-input" : "provider-turn";
1828
+ const submissionBlocked = isComposerSubmissionBlocked({
1829
+ submissionTarget,
1830
+ noProviderAvailable,
1831
+ sendDisabledReason,
1832
+ attachmentBlockReason,
1833
+ environmentUnavailable: environmentUnavailable !== null,
1834
+ });
1835
+ // The pending Submit button follows the answer's own blockers, matching submitComposer.
1836
+ const primaryActionSendDisabledReason =
1837
+ (activePendingProgress ? attachmentBlockReason : sendDisabledReason) ??
1838
+ (speechInput.preparing ? "Preparing voice input" : null);
1839
+ const primaryActionEnvironmentUnavailable =
1840
+ environmentUnavailable !== null ||
1841
+ (!activePendingProgress && (noProviderAvailable || projectSelectionRequired));
1842
const dictationShortcutLabel = useDictationShortcut({
1843
keybindings,
1844
speech: speechInput,
@@ -2070,13 +2084,7 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
2084
2085
const shouldBlurMobileComposerOnSubmit = () => {
2086
if (!isSoftwareKeyboardOpen) return false;
2073
- if (
2074
- isSendBusy ||
2075
- isSendDisabled ||
2076
- noProviderAvailable ||
2077
- environmentUnavailable !== null ||
2078
- phase === "running"
2079
- ) {
2087
+ if (isSendBusy || submissionBlocked || environmentUnavailable !== null || phase === "running") {
2088
return false;
2089
}
2090
if (activePendingProgress) {
@@ -2098,11 +2106,7 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
2106
submitAfterDictation(() => submitComposerRef.current(dispatchMode, submissionIntent));
2107
return false;
2108
}
2101
- if (
2102
- noProviderAvailable ||
2103
- isSendDisabled ||
2104
- !readEnvironmentScope(environmentId, AuthOrchestrationOperateScope)
2105
- ) {
2109
+ if (submissionBlocked || !readEnvironmentScope(environmentId, AuthOrchestrationOperateScope)) {
2110
event?.preventDefault();
2111
return false;
2112
}
@@ -2129,7 +2133,7 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
2133
}
2134
const submission = submitComposerDraft({
2135
prompt: promptRef.current,
2132
- submissionTarget: activePendingProgress ? "pending-user-input" : "provider-turn",
2136
+ submissionTarget,
2137
event,
2138
onSend: (sendEvent) => {
2139
providerInputRejectedRef.current = false;
@@ -3518,12 +3522,8 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
3522
isRunning={false}
3523
canInterrupt={false}
3524
isSendBusy={isSendBusy}
3521
- sendDisabledReason={voiceSendDisabledReason}
3522
- isEnvironmentUnavailable={
3523
- environmentUnavailable !== null ||
3524
- noProviderAvailable ||
3525
- projectSelectionRequired
3526
- }
3525
+ sendDisabledReason={primaryActionSendDisabledReason}
3526
+ isEnvironmentUnavailable={primaryActionEnvironmentUnavailable}
3527
isPreparingWorktree={false}
3528
hasSendableContent={false}
3529
preserveComposerFocusOnPointerDown
@@ -3602,12 +3602,8 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
3602
)}
3603
voiceInputActive={voiceInputActive}
3604
isSendBusy={isSendBusy}
3605
- sendDisabledReason={voiceSendDisabledReason}
3606
- isEnvironmentUnavailable={
3607
- environmentUnavailable !== null ||
3608
- noProviderAvailable ||
3609
- projectSelectionRequired
3610
- }
3605
+ sendDisabledReason={primaryActionSendDisabledReason}
3606
+ isEnvironmentUnavailable={primaryActionEnvironmentUnavailable}
3607
isPreparingWorktree={isPreparingWorktree}
3608
hasSendableContent={composerSendState.hasSendableContent || voiceInputActive}
3609
canResume={showResumeAction}
apps/web/src/components/chat/composerSubmission.test.ts
+28
-1
@@ -11,7 +11,7 @@ import {
11
} from "@t3tools/shared/assistantCitations";
12
import { describe, expect, it, vi } from "vite-plus/test";
13
14
-import { submitComposerDraft } from "./composerSubmission";
14
+import { isComposerSubmissionBlocked, submitComposerDraft } from "./composerSubmission";
15
16
const assistantCitation = {
17
version: 1 as const,
@@ -208,3 +208,30 @@ describe("submitComposerDraft", () => {
208
expect(onSend).toHaveBeenCalledOnce();
209
});
210
});
211
+
212
+describe("isComposerSubmissionBlocked", () => {
213
+ const sendBlocked = {
214
+ noProviderAvailable: true,
215
+ sendDisabledReason: "Messages loading",
216
+ attachmentBlockReason: null,
217
+ environmentUnavailable: false,
218
+ };
219
+
220
+ // regression: #9318
221
+ it("lets a pending answer through while provider-turn sends are blocked", () => {
222
+ expect(
223
+ isComposerSubmissionBlocked({ ...sendBlocked, submissionTarget: "pending-user-input" }),
224
+ ).toBe(false);
225
+ expect(isComposerSubmissionBlocked({ ...sendBlocked, submissionTarget: "provider-turn" })).toBe(
226
+ true,
227
+ );
228
+ });
229
+
230
+ it("still blocks a pending answer on its attachments or a lost connection", () => {
231
+ const answer = { ...sendBlocked, submissionTarget: "pending-user-input" as const };
232
+ expect(
233
+ isComposerSubmissionBlocked({ ...answer, attachmentBlockReason: "Attach the file again" }),
234
+ ).toBe(true);
235
+ expect(isComposerSubmissionBlocked({ ...answer, environmentUnavailable: true })).toBe(true);
236
+ });
237
+});
apps/web/src/components/chat/composerSubmission.ts
+14
@@ -30,6 +30,20 @@ export function getComposerSubmissionValidationMessage(
30
: null;
31
}
32
33
+// Answering a question responds to the open request instead of starting a provider turn, so
34
+// provider and turn-send state must not block it. Its own attachments and connection still do.
35
+export function isComposerSubmissionBlocked(input: {
36
+ submissionTarget: ComposerSubmissionInput["submissionTarget"];
37
+ noProviderAvailable: boolean;
38
+ sendDisabledReason: string | null;
39
+ attachmentBlockReason: string | null;
40
+ environmentUnavailable: boolean;
41
+}): boolean {
42
+ return input.submissionTarget === "pending-user-input"
43
+ ? input.attachmentBlockReason !== null || input.environmentUnavailable
44
+ : input.noProviderAvailable || input.sendDisabledReason !== null;
45
+}
46
+
47
export function submitComposerDraft(
48
options: ComposerSubmissionInput & {
49
event: ComposerSubmitEvent | undefined;
apps/web/src/components/chat/useComposerSend.ts
+19
-8
@@ -390,6 +390,25 @@ export function useComposerSend(input: ComposerSendInput) {
390
return;
391
}
392
393
+ const sendCtx = composerRef.current?.getSendContext();
394
+ // `/side` beats an open question and a plan follow-up, which would send the text to main.
395
+ const sideChatCommand =
396
+ sendCtx && !directAnnotation && !queuedRunEdit.isEditing
397
+ ? parseSideChatCommand(promptAtSend)
398
+ : null;
399
+ const answeringQuestion =
400
+ Boolean(activePendingProgress) && sendCtx?.answeringPendingUserInput !== false;
401
+ const startsSideChat =
402
+ onSideChat !== undefined && sideChatCommand !== null && sideChatDisabledReason === null;
403
+ // An answer responds to the open request rather than starting a turn, so the new-message
404
+ // guards below (loading, busy, provider) must not swallow it.
405
+ if (answeringQuestion && !startsSideChat && !directAnnotation) {
406
+ if (readEnvironmentScope(environmentId, AuthOrchestrationOperateScope) && activeThread) {
407
+ onAdvanceActivePendingUserInput();
408
+ }
409
+ return;
410
+ }
411
+
412
const notifyDirectAnnotationAttached = () => {
413
if (!directAnnotation) return;
414
toastManager.add(
@@ -442,14 +461,6 @@ export function useComposerSend(input: ComposerSendInput) {
461
});
462
return;
463
}
445
- const sendCtx = composerRef.current?.getSendContext();
446
- // `/side` beats an open question and a plan follow-up, which would send the text to main.
447
- const sideChatCommand =
448
- sendCtx && !directAnnotation && !queuedRunEdit.isEditing
449
- ? parseSideChatCommand(promptAtSend)
450
- : null;
451
- const answeringQuestion =
452
- Boolean(activePendingProgress) && sendCtx?.answeringPendingUserInput !== false;
464
// Where side chats are unavailable, `/side` text can still be a literal answer.
465
if (sideChatDisabledReason !== null && sideChatCommand && !answeringQuestion) {
466
toastManager.add(