fix(openai): align Codex discovery client version (#113615)

* fix(openai): align Codex discovery client version

* chore: leave release notes to release workflow
This commit is contained in:
Peter Steinberger
2026-07-25 04:33:12 -07:00
committed by GitHub
parent d4794c90a0
commit 825d6f7f1f
4 changed files with 36 additions and 1 deletions
+1 -1
View File
@@ -84,7 +84,7 @@ function classifyOpenAiFailoverCode(code: string | undefined) {
const OPENAI_MODELS_ENDPOINT = "https://api.openai.com/v1/models";
// Keep synchronized with extensions/codex's exact @openai/codex dependency;
// the provider contract test fails when that managed-runtime pin changes.
const OPENAI_CODEX_CLIENT_VERSION = "0.144.6";
const OPENAI_CODEX_CLIENT_VERSION = "0.145.0";
const OPENAI_CODEX_MODELS_ENDPOINT = `${OPENAI_CODEX_RESPONSES_BASE_URL}/models?client_version=${OPENAI_CODEX_CLIENT_VERSION}`;
const OPENAI_MODELS_CACHE_TTL_MS = 60_000;
const OPENAI_CODEX_MODELS_CACHE_TTL_MS = 60_000;
+1
View File
@@ -2350,6 +2350,7 @@ const APPCAST_TEST_TARGETS = ["test/appcast.test.ts", "test/scripts/make-appcast
const CODEX_VERSION_CONTRACT_TEST_TARGETS = [
"extensions/codex/src/manifest.test.ts",
"extensions/openai/openai-provider.test.ts",
"test/scripts/codex-client-version-contract.test.ts",
];
const SOURCE_TEST_TARGETS = new Map([
...PRECISE_SOURCE_TEST_TARGETS,
@@ -0,0 +1,33 @@
// Codex Client Version Contract tests cover cross-plugin managed version alignment.
import fs from "node:fs";
import { describe, expect, it } from "vitest";
const CODEX_PACKAGE_JSON_URL = new URL("../../extensions/codex/package.json", import.meta.url);
const OPENAI_PROVIDER_URL = new URL("../../extensions/openai/openai-provider.ts", import.meta.url);
const OPENAI_CODEX_CLIENT_VERSION_PATTERN = /^const OPENAI_CODEX_CLIENT_VERSION = "([^"]+)";$/mu;
function readManagedCodexVersion(): string {
const packageJson = JSON.parse(fs.readFileSync(CODEX_PACKAGE_JSON_URL, "utf8")) as {
dependencies?: Record<string, unknown>;
};
const version = packageJson.dependencies?.["@openai/codex"];
if (typeof version !== "string") {
throw new Error("extensions/codex/package.json must pin @openai/codex exactly");
}
return version;
}
function readOpenAICodexClientVersion(): string {
const providerSource = fs.readFileSync(OPENAI_PROVIDER_URL, "utf8");
const version = OPENAI_CODEX_CLIENT_VERSION_PATTERN.exec(providerSource)?.[1];
if (!version) {
throw new Error("extensions/openai/openai-provider.ts must declare the Codex client version");
}
return version;
}
describe("Codex client version contract", () => {
it("matches OpenAI model discovery to the managed Codex package", () => {
expect(readOpenAICodexClientVersion()).toBe(readManagedCodexVersion());
});
});
+1
View File
@@ -298,6 +298,7 @@ describe("scripts/test-projects changed-target routing", () => {
targets: [
"extensions/codex/src/manifest.test.ts",
"extensions/openai/openai-provider.test.ts",
"test/scripts/codex-client-version-contract.test.ts",
],
});
},