Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(remote-agent): 连回成功后才取供应商组的「新一轮」标记
fmfsaisaia8a6c9b1d2e2
diff --git a/apps/desktop/src/main/remote-agent/__tests__/connectionPool.test.ts b/apps/desktop/src/main/remote-agent/__tests__/connectionPool.test.tsindex 8f91938ccd..2f0bd20af0 100644--- a/apps/desktop/src/main/remote-agent/__tests__/connectionPool.test.ts+++ b/apps/desktop/src/main/remote-agent/__tests__/connectionPool.test.ts@@ -1038,6 +1038,43 @@ describe('remote connection pool with a real host', () => {await vi.waitFor(() => expect(pool.occupied()).toBe(1));});+ // PR #6483 review:接回前就取走了供应商组的「新一轮」标记,接回失败后重试不再带 groupNewRound。+ it('keeps the provider-group new-round mark until a reconnect succeeds', async () => {+ limits = { perDevice: 16, total: 64 };+ const pool = newPool();+ let newRound = false;+ const a = await startRemoteAgentSession('claude-code', {+ sessionId: randomUUID(), workingDir: project, model: 'm1',+ } as StartSessionOptions, {+ ...deps(pool),+ groupSwitch: { offer() {}, takeNewRound: () => { const taken = newRound; newRound = false; return taken; } },+ });+ opened.push(a);+ const events = watch(a);+ await ask(a, events, 'hello');+ await sleep(5);+ expect(await pool.releaseForRetry(member('other', 0, false))).toBe(true);+ newRound = true;+ const sentOptions: Array<Record<string, unknown>> = [];+ let offline = true;+ intercept = (request) => {+ if (request.op === 'open' && offline) {+ offline = false;+ throw new Error('[REMOTE_AGENT_UNAVAILABLE] offline');+ }+ if (request.op === 'call' && request.method === 'send') {+ sentOptions.push((request.payload as { json: unknown[] }).json[1] as Record<string, unknown>);+ }+ return undefined;+ };+ await expect(a.send({ type: 'user', content: 'lost' })).rejects.toThrow('offline');+ expect(newRound).toBe(true);+ expect(await ask(a, events, 'again')).toBe('ok:again');+ expect(sentOptions).toHaveLength(1);+ expect(sentOptions[0].groupNewRound).toBe(true);+ expect(newRound).toBe(false);+ });+it('gives up a release once a send has started', async () => {const pool = newPool();const a = await start(pool);diff --git a/apps/desktop/src/main/remote-agent/controller/proxyHandle.ts b/apps/desktop/src/main/remote-agent/controller/proxyHandle.tsindex cb1afd15cd..4332cfe110 100644--- a/apps/desktop/src/main/remote-agent/controller/proxyHandle.ts+++ b/apps/desktop/src/main/remote-agent/controller/proxyHandle.ts@@ -316,7 +316,6 @@ export function createRemoteAgentHandle(deps: RemoteHandleDeps): RemoteAgentHandasync function sendLike(method: 'send' | 'steer', message: UserMessage, opts?: SendOptions): Promise<void> {const encoded = await encodeSendOptions(opts, readImage);- if (method === 'send' && deps.takeGroupNewRound?.()) encoded.wire.groupNewRound = true;const wireMessage = await encodeUserMessage(message, readImage);const projectMessage = (wire: typeof wireMessage) => {if (typeof wire.content === 'string') wire.content = deps.workspace.mapTextForAgent(wire.content);@@ -337,6 +336,8 @@ export function createRemoteAgentHandle(deps: RemoteHandleDeps): RemoteAgentHand}}const client = await link.ensure();+ // 连回成功后才取供应商组的「新一轮」标记:连不回时消息没发出,标记要留给重试。+ if (method === 'send' && deps.takeGroupNewRound?.()) encoded.wire.groupNewRound = true;// 连回之后才转换路径:让出期间改过的目录要等连回补发后才有虚拟路径。projectMessage(wireMessage);if (encoded.wire.cindy?.autoReviewSourceContent) projectMessage(encoded.wire.cindy.autoReviewSourceContent);