Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(desktop): recover Pi image rejection queues
zyaoii6ff983e3ef06
diff --git a/apps/desktop/src/main/maker-ipc/__tests__/agent-input-coordinator.test.ts b/apps/desktop/src/main/maker-ipc/__tests__/agent-input-coordinator.test.tsindex e5c56b1ba4..9548445177 100644--- a/apps/desktop/src/main/maker-ipc/__tests__/agent-input-coordinator.test.ts+++ b/apps/desktop/src/main/maker-ipc/__tests__/agent-input-coordinator.test.ts@@ -3713,6 +3713,45 @@ describe('AgentInputCoordinator send transaction', () => {);});+ it('dispatches new text after a persisted Pi image capability rejection', async () => {+ const h = createHarness();+ const sid = 'persisted-pi-image-capability-rejection';+ const image = makeItem('q-image', 'describe the screenshot');+ const next = makeItem('q-next', 'continue with text');+ h.setAgentKind('pi');+ h.sendToAgent.mockImplementationOnce(+ async (sessionId, _message, _createOpts, sendOpts) => {+ await persistQueuedUserMessage(sessionId, sendOpts);+ throw Object.assign(+ new Error('[PI_IMAGE_INPUT_UNSUPPORTED] image input disabled'),+ { code: 'PI_IMAGE_INPUT_UNSUPPORTED' },+ );+ },+ );++ h.coordinator.enqueue(sid, image);+ await flush();++ let projection = latestProjection(h.projections);+ expect(projection.pendingQueue).toEqual([]);+ expect(projection.recovery).toEqual({ kind: 'active-turn', item: image });+ expect(projection.error).toBe('[PI_IMAGE_INPUT_UNSUPPORTED] image input disabled');++ h.coordinator.enqueue(sid, next);+ await flush();++ projection = latestProjection(h.projections);+ expect(h.sendToAgent).toHaveBeenCalledTimes(2);+ expect(h.sendToAgent.mock.calls[1]?.[1]).toEqual({+ type: 'user',+ content: 'continue with text',+ });+ expect(projection.pendingQueue).toEqual([]);+ expect(projection.recovery).toBeNull();+ expect(projection.error).toBeNull();+ expect(projection.queueAbortPending).toBe(false);+ });+it('recovers a persisted turn when terminal error arrives before send resolves', async () => {const h = createHarness();const sid = 'terminal-before-send-resolve';diff --git a/apps/desktop/src/main/maker-ipc/agent-input-coordinator.ts b/apps/desktop/src/main/maker-ipc/agent-input-coordinator.tsindex f248bd428f..c103fe2a28 100644--- a/apps/desktop/src/main/maker-ipc/agent-input-coordinator.ts+++ b/apps/desktop/src/main/maker-ipc/agent-input-coordinator.ts@@ -3427,6 +3427,7 @@ export class AgentInputCoordinator {}latest.error = errorMessage(err);latest.stickyError = null;+ const piImageCapabilityRejected = isPiImageInputUnsupportedError(err);// 同 handleSendNotDispatched:调度来源的 prompt 不留可被人手动 Retry 的 recovery// (review #944 第九轮 P1;判据内建在 setActiveTurnRecovery)。const schedulerOrigin = this.setActiveTurnRecovery(latest, head) === 'dropped-scheduler';@@ -3437,6 +3438,10 @@ export class AgentInputCoordinator {// turn":之后所有用户与调度消息全部积压到 coordinator 被重置// (review #944 第十轮 P1)。latest.activeTurn = null;+ } else if (piImageCapabilityRejected) {+ // Pi 图片能力拒绝发生在 vendor RPC 之前,不会再有 terminal event 来释放 activeTurn;+ // 已持久化的用户行仍保留 active-turn recovery,供用户切换到视觉模型后重试。+ latest.activeTurn = null;}this.notifyRejectedUserTurn(sessionId, head);this.notifyUndispatchedUserTurn(sessionId, head, 'failed');