Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(bots): settle authorization action recovery failures
zqchris24f726954030
diff --git a/apps/desktop/src/main/maker-ipc/__tests__/botAuthorizationService.test.ts b/apps/desktop/src/main/maker-ipc/__tests__/botAuthorizationService.test.tsindex 7b2ac56b0d..4c3b0d0e5f 100644--- a/apps/desktop/src/main/maker-ipc/__tests__/botAuthorizationService.test.ts+++ b/apps/desktop/src/main/maker-ipc/__tests__/botAuthorizationService.test.ts@@ -313,6 +313,29 @@ describe('Bot authorization transcript lifecycle (Grok parity)', () => {await restored.dispose();});+ it.each(['resolve', 'submit'])('retires a rejected %s action when its recovery write also fails', async (operation) => {+ const h = harness();+ await h.service.request('s', { kind: 'plugin', id: 'p' });+ const unavailable = new Error('Authorization owner or teammate is unavailable');+ h.deps.adapter.mockRejectedValue(unavailable);+ h.deps.save.mockRejectedValue(unavailable);+ const accepted = operation === 'resolve' ? await h.click() : await h.service.submit(+ h.card().snapshot.requestId,+ { actionId: 'connect', expectedRevision: h.card().snapshot.revision, value: 'fake-secret' },+ );+ expect(accepted).toBe(true);+ await flush();+ await vi.advanceTimersByTimeAsync(0); // let detached rejection handlers settle+ expect(h.deps.warn).toHaveBeenCalledWith(unavailable);+ expect(h.listeners.size).toBe(0);+ expect(h.adapter.execute).not.toHaveBeenCalled();+ expect(h.deps.resume).not.toHaveBeenCalled();+ // A subsequent click must revalidate restoration, not reuse the invalid entry.+ await expect(h.click()).rejects.toThrow('teammate is unavailable');+ expect(h.listeners.size).toBe(0);+ await h.service.dispose();+ });+it('disposal suppresses a callback from an outstanding action', async () => {const h = harness();let finish!: () => void;diff --git a/apps/desktop/src/main/maker-ipc/botAuthorizationService.ts b/apps/desktop/src/main/maker-ipc/botAuthorizationService.tsindex fdf70e6c7a..88ca68af94 100644--- a/apps/desktop/src/main/maker-ipc/botAuthorizationService.ts+++ b/apps/desktop/src/main/maker-ipc/botAuthorizationService.ts@@ -368,7 +368,14 @@ export class BotAuthorizationService {this.deps.warn(error);if (!entry.closed) {this.stopPoll(entry);- await this.phase(entry, 'failed', actionId, 'ACTION_FAILED');+ try {+ await this.phase(entry, 'failed', actionId, 'ACTION_FAILED');+ } catch (recoveryError) {+ // Owner/profile validation can reject the recovery write too. This+ // detached action must settle without leaving a live invalid watcher.+ this.close(entry);+ this.deps.warn(recoveryError);+ }}}).finally(() => {