diff --git a/packages/coding-agent/CHANGELOG.md b/packages/coding-agent/CHANGELOG.md index f7100b579..1114d1466 100644 --- a/packages/coding-agent/CHANGELOG.md +++ b/packages/coding-agent/CHANGELOG.md @@ -10,6 +10,7 @@ - Fixed the bundled `websearch` skill description and missing-key guidance omitting the `/login` → **MCP Connections** step required to configure Serper. - Fixed `retry_worker` cancelling its own recovery when a stopped session worker left a saved stop marker behind, leaving the session stuck at "Session worker is not connected". +- Fixed RLM model discovery omitting OpenAI Codex GPT-5.6 models ([#718](https://github.com/PrimeIntellect-ai/prime-agent/pull/718) by [@nickadminroot](https://github.com/nickadminroot)). ## [0.7.0] - 2026-08-05 diff --git a/packages/coding-agent/src/core/model-registry.ts b/packages/coding-agent/src/core/model-registry.ts index 8644ff5ad..d7cb73851 100644 --- a/packages/coding-agent/src/core/model-registry.ts +++ b/packages/coding-agent/src/core/model-registry.ts @@ -27,7 +27,7 @@ import { dirname, join } from "path"; import { type Static, type TProperties, Type } from "typebox"; import type { Validator } from "typebox/compile"; import type { TLocalizedValidationError } from "typebox/error"; -import { getAgentDir, VERSION } from "../config.js"; +import { getAgentDir } from "../config.js"; import type { AuthSourceToken, AuthStatus, AuthStorage } from "./auth-storage.js"; import { PRIME_INFERENCE_PROVIDER_ID } from "./prime-inference-auth.js"; import { @@ -372,6 +372,10 @@ function readOpenAICodexAccountId(token: string): string | undefined { } } +// Codex model discovery gates its catalog by Codex CLI semver, not the Prime Agent version. +// 0.144.0 is the first catalog version that advertises GPT-5.6 models. +const OPENAI_CODEX_DISCOVERY_CLIENT_VERSION = "0.144.0"; + function openAICodexModelsUrl(baseUrl: string): string { const normalized = baseUrl.replace(/\/+$/, ""); let path: string; @@ -383,7 +387,7 @@ function openAICodexModelsUrl(baseUrl: string): string { path = `${normalized}/codex/models`; } const url = new URL(path); - url.searchParams.set("client_version", VERSION); + url.searchParams.set("client_version", OPENAI_CODEX_DISCOVERY_CLIENT_VERSION); return url.toString(); } diff --git a/packages/coding-agent/test/suite/regressions/639-codex-discovery-client-version.test.ts b/packages/coding-agent/test/suite/regressions/639-codex-discovery-client-version.test.ts new file mode 100644 index 000000000..8ab92d3b0 --- /dev/null +++ b/packages/coding-agent/test/suite/regressions/639-codex-discovery-client-version.test.ts @@ -0,0 +1,41 @@ +import { afterEach, describe, expect, it, vi } from "vitest"; +import { createHarness, type Harness } from "../harness.js"; + +function openAICodexToken(accountId: string): string { + const payload = Buffer.from( + JSON.stringify({ "https://api.openai.com/auth": { chatgpt_account_id: accountId } }), + ).toString("base64url"); + return `header.${payload}.signature`; +} + +describe("#639 OpenAI Codex model discovery", () => { + let harness: Harness | undefined; + + afterEach(() => { + vi.unstubAllGlobals(); + harness?.cleanup(); + harness = undefined; + }); + + it("sends a Codex client version that advertises GPT-5.6 models", async () => { + harness = await createHarness({ + provider: "openai-codex", + models: [{ id: "gpt-5.6-luna" }], + }); + const fetchModels = vi.fn(async (input: string | URL | Request) => { + const url = new URL(input instanceof Request ? input.url : input); + expect(url.searchParams.get("client_version")).toBe("0.144.0"); + return new Response(JSON.stringify({ models: [{ slug: "gpt-5.6-luna" }] }), { + status: 200, + headers: { "content-type": "application/json" }, + }); + }); + vi.stubGlobal("fetch", fetchModels); + harness.authStorage.setRuntimeApiKey("openai-codex", openAICodexToken("account-1")); + + await expect(harness.session.findRlmModels("luna", 8)).resolves.toMatchObject({ + models: [{ selector: "openai-codex/gpt-5.6-luna" }], + }); + expect(fetchModels).toHaveBeenCalledOnce(); + }); +});