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
10 changes: 8 additions & 2 deletions src/codex/catalog/effort.ts
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,10 @@ export interface CatalogEffortCompatibility {
readonly affectedModels: readonly string[];
}

// These parser-valid sentinels do not appear in native model ladders, so absence from an
// observed bundled catalog is not evidence that the selected Codex runtime rejects them.
const CODEX_PARSER_SENTINEL_EFFORTS = new Set(["none", "minimal"]);

/**
* Report which reasoning efforts in a catalog the local Codex runtime would reject, without
* changing anything.
Expand All @@ -432,9 +436,11 @@ export function catalogEffortCompatibility(
const unsupported = new Set<string>();
const affected: string[] = [];
for (const entry of models) {
const rejected = catalogEntryEfforts(entry).filter(effort => !supported.has(effort));
const accepts = (effort: string): boolean => supported.has(effort)
|| CODEX_PARSER_SENTINEL_EFFORTS.has(effort);
const rejected = catalogEntryEfforts(entry).filter(effort => !accepts(effort));
const fallback = typeof entry.default_reasoning_level === "string"
&& !supported.has(entry.default_reasoning_level)
&& !accepts(entry.default_reasoning_level)
? [entry.default_reasoning_level]
: [];
if (rejected.length === 0 && fallback.length === 0) continue;
Expand Down
13 changes: 13 additions & 0 deletions tests/clients/client-catalog-compatibility.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,19 @@ describe("#4207 catalog effort compatibility", () => {
});
});

test("parser sentinels are accepted even when absent from observed native ladders", () => {
// Native bundled rows do not advertise these values, but the Codex catalog parser accepts
// both. The observed rows therefore cannot be treated as an exhaustive parser enum.
const observedNativeLadder = new Set(["low", "medium", "high", "xhigh"]);
const models = JSON.parse(catalogBody(["none", "minimal"], "provider/model", "minimal")).models;

expect(catalogEffortCompatibility(models, observedNativeLadder)).toEqual({
compatible: true,
unsupportedEfforts: [],
affectedModels: [],
});
});

test("an unobservable runtime ladder is not evidence of incompatibility", () => {
const models = JSON.parse(catalogBody(["low", "max"])).models;
expect(catalogEffortCompatibility(models, null).compatible).toBe(true);
Expand Down
Loading