Skip to content
Closed
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
1 change: 1 addition & 0 deletions packages/coding-agent/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
8 changes: 6 additions & 2 deletions packages/coding-agent/src/core/model-registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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;
Expand All @@ -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();
}

Expand Down
Original file line number Diff line number Diff line change
@@ -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();
});
});