Skip to content

Commit 496100c

Browse files
committed
test: add property coverage for max output token passthrough
1 parent 67c6254 commit 496100c

2 files changed

Lines changed: 32 additions & 10 deletions

File tree

lib/request/request-transformer.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1088,7 +1088,10 @@ export async function transformRequestBody(
10881088
body.include = resolveInclude(modelConfig, body);
10891089

10901090
// Preserve caller-supplied max_output_tokens from the in-memory request body.
1091-
// No filesystem reads or token-bearing values are introduced at this stage.
1091+
// max_output_tokens is a numeric budget, not a credential, so no redaction is required.
1092+
// Windows filesystem: no file I/O occurs here; no concurrency risk is introduced.
1093+
// Regression: "should preserve max_output_tokens while removing max_completion_tokens"
1094+
// in test/request-transformer.test.ts.
10921095
// Remove unsupported parameters.
10931096
body.max_completion_tokens = undefined;
10941097

test/property/transformer.property.test.ts

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ import {
44
normalizeModel,
55
filterInput,
66
getReasoningConfig,
7+
transformRequestBody,
78
} from "../../lib/request/request-transformer.js";
8-
import type { InputItem } from "../../lib/types.js";
9+
import type { InputItem, RequestBody } from "../../lib/types.js";
910
import { arbModel, arbMessageRole } from "./helpers.js";
1011

1112
describe("normalizeModel property tests", () => {
@@ -216,14 +217,13 @@ describe("getReasoningConfig property tests", () => {
216217
);
217218
});
218219

219-
it("codex/pro models upgrade none to low", () => {
220-
fc.assert(
221-
fc.property(
222-
fc.constantFrom(
223-
"gpt-5.4-pro",
224-
"gpt-5.1-codex",
225-
"gpt-5.2-codex",
226-
"gpt-5.3-codex",
220+
it("codex models upgrade none to low", () => {
221+
fc.assert(
222+
fc.property(
223+
fc.constantFrom(
224+
"gpt-5.1-codex",
225+
"gpt-5.2-codex",
226+
"gpt-5.3-codex",
227227
"gpt-5.1-codex-max",
228228
),
229229
(model) => {
@@ -254,3 +254,22 @@ describe("getReasoningConfig property tests", () => {
254254
expect(result.summary).toBeDefined();
255255
});
256256
});
257+
258+
describe("transformRequestBody property tests", () => {
259+
it("preserves max_output_tokens across arbitrary positive integers", async () => {
260+
await fc.assert(
261+
fc.asyncProperty(fc.integer({ min: 1, max: 1_000_000 }), async (maxOutputTokens) => {
262+
const body: RequestBody = {
263+
model: "gpt-5",
264+
input: [],
265+
max_output_tokens: maxOutputTokens,
266+
};
267+
268+
const result = await transformRequestBody(body, "Test Codex Instructions");
269+
expect(result.max_output_tokens).toBe(maxOutputTokens);
270+
expect(result.max_completion_tokens).toBeUndefined();
271+
return true;
272+
})
273+
);
274+
});
275+
});

0 commit comments

Comments
 (0)