File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -1442,16 +1442,18 @@ export class Task extends EventEmitter<ClineEvents> {
14421442 // could be in (i.e. could have streamed some tools the user
14431443 // may have executed), so we just resort to replicating a
14441444 // cancel task.
1445- this . abortTask ( )
14461445
1447- // Check if this was a user-initiated cancellation
1448- // If this.abort is true, it means the user clicked cancel, so we should
1446+ // Check if this was a user-initiated cancellation BEFORE calling abortTask
1447+ // If this.abort is already true, it means the user clicked cancel, so we should
14491448 // treat this as "user_cancelled" rather than "streaming_failed"
14501449 const cancelReason = this . abort ? "user_cancelled" : "streaming_failed"
14511450 const streamingFailedMessage = this . abort
14521451 ? undefined
14531452 : ( error . message ?? JSON . stringify ( serializeError ( error ) , null , 2 ) )
14541453
1454+ // Now call abortTask after determining the cancel reason
1455+ await this . abortTask ( )
1456+
14551457 await abortStream ( cancelReason , streamingFailedMessage )
14561458
14571459 const history = await provider ?. getTaskWithId ( this . taskId )
You can’t perform that action at this time.
0 commit comments