File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments