Skip to content

Commit fb711a0

Browse files
roomotedaniel-lxs
andauthored
Fixes RooCodeInc#4903: Consistent cancellation error messages for thinking vs streaming phases (RooCodeInc#4904)
Co-authored-by: Daniel <[email protected]>
1 parent 562a007 commit fb711a0

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/core/task/Task.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1425,10 +1425,15 @@ export class Task extends EventEmitter<ClineEvents> {
14251425
// cancel task.
14261426
this.abortTask()
14271427

1428-
await abortStream(
1429-
"streaming_failed",
1430-
error.message ?? JSON.stringify(serializeError(error), null, 2),
1431-
)
1428+
// Check if this was a user-initiated cancellation
1429+
// If this.abort is true, it means the user clicked cancel, so we should
1430+
// treat this as "user_cancelled" rather than "streaming_failed"
1431+
const cancelReason = this.abort ? "user_cancelled" : "streaming_failed"
1432+
const streamingFailedMessage = this.abort
1433+
? undefined
1434+
: (error.message ?? JSON.stringify(serializeError(error), null, 2))
1435+
1436+
await abortStream(cancelReason, streamingFailedMessage)
14321437

14331438
const history = await provider?.getTaskWithId(this.taskId)
14341439

0 commit comments

Comments
 (0)