Skip to content

Commit a0d9234

Browse files
committed
Preserve partial responses on canceling request
1 parent 473cff7 commit a0d9234

File tree

3 files changed

+488
-7
lines changed

3 files changed

+488
-7
lines changed

cli/src/hooks/helpers/send-message.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,12 @@ export const handleRunCompletion = (params: {
301301
isQueuePausedRef,
302302
} = params
303303

304+
// If user aborted, the abort handler already handled UI updates (interruption notice, etc.)
305+
// Don't process the server response as it would interfere with the abort handler's work.
306+
if (streamRefs.state.wasAbortedByUser) {
307+
return
308+
}
309+
304310
const output = runState.output
305311
const finalizeAfterError = () => {
306312
finalizeQueueState({
@@ -322,9 +328,6 @@ export const handleRunCompletion = (params: {
322328
}
323329

324330
if (output.type === 'error') {
325-
if (streamRefs.state.wasAbortedByUser) {
326-
return
327-
}
328331

329332
if (isOutOfCreditsError(output)) {
330333
updater.setError(OUT_OF_CREDITS_MESSAGE)

0 commit comments

Comments
 (0)