Skip to content

Commit ae5b5cc

Browse files
fix(web): question answers keep /side and /usage routing
Answering a question bypassed onSend entirely, so /side and /usage went to the agent as the literal answer. Route answers through onSend again and take the answer branch right after /usage and the /side check, above the guards that only apply to a new message (loading, busy, provider). AI-assisted; verified with the tests and tools listed above. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 785b2ff commit ae5b5cc

2 files changed

Lines changed: 19 additions & 14 deletions

File tree

‎apps/web/src/components/chat/ChatComposer.tsx‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2136,12 +2136,6 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
21362136
submissionTarget,
21372137
event,
21382138
onSend: (sendEvent) => {
2139-
// The thread's send guards are for provider turns, so an answer skips them.
2140-
if (submissionTarget === "pending-user-input") {
2141-
sendEvent?.preventDefault();
2142-
onAdvanceActivePendingUserInput();
2143-
return;
2144-
}
21452139
providerInputRejectedRef.current = false;
21462140
onSend(
21472141
sendEvent,

‎apps/web/src/components/chat/useComposerSend.ts‎

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,25 @@ export function useComposerSend(input: ComposerSendInput) {
390390
return;
391391
}
392392

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+
393412
const notifyDirectAnnotationAttached = () => {
394413
if (!directAnnotation) return;
395414
toastManager.add(
@@ -442,14 +461,6 @@ export function useComposerSend(input: ComposerSendInput) {
442461
});
443462
return;
444463
}
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;
453464
// Where side chats are unavailable, `/side` text can still be a literal answer.
454465
if (sideChatDisabledReason !== null && sideChatCommand && !answeringQuestion) {
455466
toastManager.add(

0 commit comments

Comments
 (0)