Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(desktop): strip unsupported Seed reasoning summary (#394)
Yecheng Fu11328fd7224c
diff --git a/apps/desktop/src/main/maker-host/__tests__/codexProxyHost.test.ts b/apps/desktop/src/main/maker-host/__tests__/codexProxyHost.test.tsindex e689e2cec8..62e0317f7f 100644--- a/apps/desktop/src/main/maker-host/__tests__/codexProxyHost.test.ts+++ b/apps/desktop/src/main/maker-host/__tests__/codexProxyHost.test.ts@@ -662,7 +662,7 @@ describe('codex proxy host', () => {clearSessionProvider('session-openai-custom-tool');});- it('normalizes the Codex tool set to ByteDance Seed Responses capabilities', async () => {+ it('normalizes requests to ByteDance Seed Responses capabilities', async () => {const host = await freshCodexProxyHost();const { setSessionProvider, clearSessionProvider } = await import('../session-provider-store.js');mockState.createAnthropicCompatProxy.mockResolvedValueOnce({@@ -676,6 +676,7 @@ describe('codex proxy host', () => {const transforms = mockState.createAnthropicCompatProxy.mock.calls[0]?.[0]?.transformRequest ?? [];let current: unknown = {model: 'bytedance-seed/seed-2.1-pro',+ reasoning: { effort: 'high', summary: 'auto' },tools: [{ type: 'function', name: 'exec_command' },{ type: 'function', name: 'write_stdin' },@@ -703,6 +704,7 @@ describe('codex proxy host', () => {expect(current).toEqual({model: 'bytedance-seed/seed-2.1-pro',+ reasoning: { effort: 'high' },tools: [{ type: 'function', name: 'exec_command' },{ type: 'function', name: 'write_stdin' },@@ -721,6 +723,17 @@ describe('codex proxy host', () => {{ type: 'message', role: 'user', content: [{ type: 'input_text', text: 'hello' }] },],});++ let summaryOnlyReasoning: unknown = {+ model: 'bytedance-seed/seed-2.1-pro',+ reasoning: { summary: 'auto' },+ };+ for (const transform of transforms) {+ const next = transform(summaryOnlyReasoning, ctx);+ if (next !== null && next !== undefined) summaryOnlyReasoning = next;+ }+ expect(summaryOnlyReasoning).toEqual({ model: 'bytedance-seed/seed-2.1-pro' });+clearSessionProvider('session-seed');});diff --git a/apps/desktop/src/main/maker-host/codex-proxy-host.ts b/apps/desktop/src/main/maker-host/codex-proxy-host.tsindex 3ba32dfc52..4824ba07c0 100644--- a/apps/desktop/src/main/maker-host/codex-proxy-host.ts+++ b/apps/desktop/src/main/maker-host/codex-proxy-host.ts@@ -661,6 +661,21 @@ function normalizeByteDanceSeedInput(body: Record<string, unknown>): Record<strireturn changed ? { ...body, input } : null;}+/** Seed accepts the reasoning effort, but rejects Responses' summary selector. */+function sanitizeByteDanceSeedReasoning(body: Record<string, unknown>): Record<string, unknown> | null {+ if (!isByteDanceSeedModel(body.model) || !isPlainObject(body.reasoning) || !('summary' in body.reasoning)) {+ return null;+ }++ const reasoning = { ...body.reasoning };+ delete reasoning.summary;++ const next: Record<string, unknown> = { ...body };+ if (Object.keys(reasoning).length > 0) next.reasoning = reasoning;+ else delete next.reasoning;+ return next;+}+function createByteDanceSeedResponsesCompatTransform(): RequestTransform {return (body) => {if (!isPlainObject(body)) return null;@@ -676,6 +691,11 @@ function createByteDanceSeedResponsesCompatTransform(): RequestTransform {current = withNormalizedInput;changed = true;}+ const withSanitizedReasoning = sanitizeByteDanceSeedReasoning(current);+ if (withSanitizedReasoning) {+ current = withSanitizedReasoning;+ changed = true;+ }return changed ? current : null;};}