fix: abort model retries immediately on user cancellation

This commit is contained in:
William Valentin
2026-02-18 11:21:57 -08:00
parent a76c5ae346
commit 55cde541ea
6 changed files with 177 additions and 3 deletions
+6
View File
@@ -100,6 +100,9 @@ export class NativeAgent {
async process(userMessage: string, attachments?: Attachment[]): Promise<string> {
this._cancelRequested = false;
if ('clearAbort' in this.modelClient && typeof this.modelClient.clearAbort === 'function') {
this.modelClient.clearAbort();
}
this._runInProgress = true;
// Detect and strip !!think prefix for per-message thinking mode
@@ -541,6 +544,9 @@ export class NativeAgent {
cancel(): void {
if (this._runInProgress) {
this._cancelRequested = true;
if ('requestAbort' in this.modelClient && typeof this.modelClient.requestAbort === 'function') {
this.modelClient.requestAbort();
}
}
}