authorgravatar for maria@kuuro.netmaria <maria@kuuro.net> 2026-10-03 20:47:41-03:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2026-10-03 20:47:41-03:00
loga976f8c74ca4eab6e16bb47b5fa446154b743371
treef9de603c425c9781a1fd3d80326239dc2a8ebca2
parent5108c978b1d9a8bd029e5ea96781d8cbc90b3877
signature Signed by PGP key B5690EEEBB952194

fix(web): sending past the resume banner compacts first (#15290)

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

1 files changed, 29 insertions(+), 2 deletions(-)

apps/web/src/components/ChatView.tsx+29-2
......@@ -8733,7 +8733,18 @@ export default function ChatView(props: ChatViewProps) {
87338733 );
87348734 const messageIdForSend = newMessageId();
87358735 const messageCreatedAt = new Date().toISOString();
8736 const shouldQueueBehindActiveRun = phase === "running" && dispatchMode === "queue";
8736 // Sending past the resume banner compacts first so the turn does not resend the stale
8737 // history. The message queues behind the /compact run; steering into it is rejected,
8738 // and a held queue would strand it.
8739 const compactBeforeSend =
8740 resumeCompactionBannerItem !== null &&
8741 !compactDisabled &&
8742 !hasHeldQueuedRuns &&
8743 multipleModelSelections === null &&
8744 messageTextForSend.toLowerCase() !== "/compact";
8745 const turnDispatchMode = compactBeforeSend ? "queue" : dispatchMode;
8746 const shouldQueueBehindActiveRun =
8747 compactBeforeSend || (phase === "running" && dispatchMode === "queue");
87378748 const outgoingMessageText = formatOutgoingPrompt({
87388749 provider: ctxSelectedProvider,
87398750 model: ctxSelectedModel,
......@@ -9299,6 +9310,22 @@ export default function ChatView(props: ChatViewProps) {
92999310 failure = turnAttachmentsResult;
93009311 }
93019312
9313 if (failure === null && compactBeforeSend) {
9314 const compactResult = await startThreadTurn({
9315 environmentId,
9316 input: {
9317 threadId: threadIdForSend,
9318 message: { messageId: newMessageId(), role: "user", text: "/compact", attachments: [] },
9319 modelSelection: ctxSelectedModelSelection,
9320 runtimeMode,
9321 interactionMode: sendInteractionMode,
9322 },
9323 });
9324 if (compactResult._tag === "Failure") {
9325 failure = compactResult;
9326 }
9327 }
9328
93029329 let backgroundDraftOpened = false;
93039330 let turnStartSucceeded = false;
93049331 if (failure === null && turnAttachmentsResult._tag === "Success") {
......@@ -9376,7 +9403,7 @@ export default function ChatView(props: ChatViewProps) {
93769403 titleSeed: title,
93779404 runtimeMode,
93789405 interactionMode: sendInteractionMode,
9379 dispatchMode,
9406 dispatchMode: turnDispatchMode,
93809407 ...(bootstrap ? { bootstrap } : {}),
93819408 createdAt: messageCreatedAt,
93829409 },