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) {...@@ -8733,7 +8733,18 @@ export default function ChatView(props: ChatViewProps) {
8733 );8733 );
8734 const messageIdForSend = newMessageId();8734 const messageIdForSend = newMessageId();
8735 const messageCreatedAt = new Date().toISOString();8735 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");
8737 const outgoingMessageText = formatOutgoingPrompt({8748 const outgoingMessageText = formatOutgoingPrompt({
8738 provider: ctxSelectedProvider,8749 provider: ctxSelectedProvider,
8739 model: ctxSelectedModel,8750 model: ctxSelectedModel,
...@@ -9299,6 +9310,22 @@ export default function ChatView(props: ChatViewProps) {...@@ -9299,6 +9310,22 @@ export default function ChatView(props: ChatViewProps) {
9299 failure = turnAttachmentsResult;9310 failure = turnAttachmentsResult;
9300 }9311 }
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
9302 let backgroundDraftOpened = false;9329 let backgroundDraftOpened = false;
9303 let turnStartSucceeded = false;9330 let turnStartSucceeded = false;
9304 if (failure === null && turnAttachmentsResult._tag === "Success") {9331 if (failure === null && turnAttachmentsResult._tag === "Success") {
...@@ -9376,7 +9403,7 @@ export default function ChatView(props: ChatViewProps) {...@@ -9376,7 +9403,7 @@ export default function ChatView(props: ChatViewProps) {
9376 titleSeed: title,9403 titleSeed: title,
9377 runtimeMode,9404 runtimeMode,
9378 interactionMode: sendInteractionMode,9405 interactionMode: sendInteractionMode,
9379 dispatchMode,9406 dispatchMode: turnDispatchMode,
9380 ...(bootstrap ? { bootstrap } : {}),9407 ...(bootstrap ? { bootstrap } : {}),
9381 createdAt: messageCreatedAt,9408 createdAt: messageCreatedAt,
9382 },9409 },