Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- **fix(codex): strip include from compact responses requests** (#6805 — thanks @yinaoxiong).
12 changes: 10 additions & 2 deletions open-sse/executors/codex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -1001,6 +1003,7 @@ export class CodexExecutor extends BaseExecutor {
delete body.stream;
delete body.stream_options;
delete body.client_metadata;
delete body.include;
} else {
Comment on lines 1003 to 1007

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The delete body.include; statement here is redundant because body.include is unconditionally deleted for compact requests later in the function (at line 1181, right after ensureCodexReasoningSummary(body) is called).

Whether ensureCodexReasoningSummary modifies/adds include or returns early, the second deletion at line 1181 ensures that include is completely stripped from the final payload. Removing this first deletion simplifies the code and avoids potential confusion about double-deletion.

      delete body.stream;
      delete body.stream_options;
      delete body.client_metadata;
    } else {

body.stream = true;
}
Expand Down Expand Up @@ -1174,6 +1177,9 @@ export class CodexExecutor extends BaseExecutor {
};
}
ensureCodexReasoningSummary(body);
if (isCompactRequest) {
delete body.include;
}
Comment on lines +1180 to +1182

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

According to the Repository Style Guide (Hard Rule 9), you must always include or update tests when changing production code in open-sse/.

Please add or update unit tests in tests/unit/executor-codex.test.ts to verify that include is correctly stripped from compact responses requests (both initially and after ensureCodexReasoningSummary is called).

References
  1. Always include tests when changing production code (src/, open-sse/, electron/, bin/).

delete body.reasoning_effort;

// Remove unsupported token limit parameters BEFORE the passthrough return.
Expand Down Expand Up @@ -1214,7 +1220,9 @@ export class CodexExecutor extends BaseExecutor {
applyCodexClientMetadata(
body,
credentials?.providerSpecificData?.codexClientIdentity as
CodexClientIdentity | null | undefined
| CodexClientIdentity
| null
| undefined
);
}

Expand Down
28 changes: 28 additions & 0 deletions tests/unit/codex-compact-strip-include-6805.test.ts
Original file line number Diff line number Diff line change
@@ -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");
});
Loading