diff --git a/changelog.d/fixes/6805-strip-include-compact-responses.md b/changelog.d/fixes/6805-strip-include-compact-responses.md new file mode 100644 index 00000000000..6c46a717a42 --- /dev/null +++ b/changelog.d/fixes/6805-strip-include-compact-responses.md @@ -0,0 +1 @@ +- **fix(codex): strip include from compact responses requests** (#6805 — thanks @yinaoxiong). diff --git a/open-sse/executors/codex.ts b/open-sse/executors/codex.ts index 6bca470eb55..ceaa8bda692 100644 --- a/open-sse/executors/codex.ts +++ b/open-sse/executors/codex.ts @@ -894,7 +894,9 @@ export class CodexExecutor extends BaseExecutor { headers["chatgpt-account-id"] = workspaceId; } const clientIdentity = credentials?.providerSpecificData?.codexClientIdentity as - CodexClientIdentity | null | undefined; + | CodexClientIdentity + | null + | undefined; // Originator header — identifies the client type to the Codex backend. // Ref: openai/codex login/src/auth/default_client.rs DEFAULT_ORIGINATOR = "codex_cli_rs" @@ -1001,6 +1003,7 @@ export class CodexExecutor extends BaseExecutor { delete body.stream; delete body.stream_options; delete body.client_metadata; + delete body.include; } else { body.stream = true; } @@ -1174,6 +1177,9 @@ export class CodexExecutor extends BaseExecutor { }; } ensureCodexReasoningSummary(body); + if (isCompactRequest) { + delete body.include; + } delete body.reasoning_effort; // Remove unsupported token limit parameters BEFORE the passthrough return. @@ -1214,7 +1220,9 @@ export class CodexExecutor extends BaseExecutor { applyCodexClientMetadata( body, credentials?.providerSpecificData?.codexClientIdentity as - CodexClientIdentity | null | undefined + | CodexClientIdentity + | null + | undefined ); } diff --git a/tests/unit/codex-compact-strip-include-6805.test.ts b/tests/unit/codex-compact-strip-include-6805.test.ts new file mode 100644 index 00000000000..91e0d080c3f --- /dev/null +++ b/tests/unit/codex-compact-strip-include-6805.test.ts @@ -0,0 +1,28 @@ +import test from "node:test"; +import assert from "node:assert/strict"; + +import { CodexExecutor } from "../../open-sse/executors/codex.ts"; + +// #6805: compact Codex requests must not forward `include` (e.g. +// "reasoning.encrypted_content") — the compact endpoint rejects it. Kept in a +// standalone file so the frozen executor-codex.test.ts does not grow past its cap. +test("CodexExecutor.transformRequest strips include from compact requests (#6805)", () => { + const executor = new CodexExecutor(); + const result = executor.transformRequest( + "gpt-5.3-codex", + { + _nativeCodexPassthrough: true, + include: ["reasoning.encrypted_content"], + instructions: "keep this", + stream: false, + }, + false, + { + requestEndpointPath: "/responses/compact", + providerSpecificData: { requestDefaults: { serviceTier: "priority" } }, + } + ); + assert.equal(result.include, undefined); + assert.equal(result._nativeCodexPassthrough, undefined); + assert.equal(result.instructions, "keep this"); +});