mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-09-07 08:26:51 +00:00
fix: properly distinguish between user cancellations and API failures (#6025)
Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com> Co-authored-by: Roo Code <roomote@roocode.com> Co-authored-by: Daniel <57051444+daniel-lxs@users.noreply.github.com>
This commit is contained in:
parent
464a3ffa5f
commit
2eb586b422
1 changed files with 5 additions and 3 deletions
|
|
@ -1442,16 +1442,18 @@ export class Task extends EventEmitter<ClineEvents> {
|
|||
// could be in (i.e. could have streamed some tools the user
|
||||
// may have executed), so we just resort to replicating a
|
||||
// cancel task.
|
||||
this.abortTask()
|
||||
|
||||
// Check if this was a user-initiated cancellation
|
||||
// If this.abort is true, it means the user clicked cancel, so we should
|
||||
// Check if this was a user-initiated cancellation BEFORE calling abortTask
|
||||
// If this.abort is already true, it means the user clicked cancel, so we should
|
||||
// treat this as "user_cancelled" rather than "streaming_failed"
|
||||
const cancelReason = this.abort ? "user_cancelled" : "streaming_failed"
|
||||
const streamingFailedMessage = this.abort
|
||||
? undefined
|
||||
: (error.message ?? JSON.stringify(serializeError(error), null, 2))
|
||||
|
||||
// Now call abortTask after determining the cancel reason
|
||||
await this.abortTask()
|
||||
|
||||
await abortStream(cancelReason, streamingFailedMessage)
|
||||
|
||||
const history = await provider?.getTaskWithId(this.taskId)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue