Repository navigation
fix(openai): show account models after API-key onboarding - #114258
Conversation
|
Codex review: needs maintainer review before merge. Reviewed July 26, 2026, 11:27 PM ET / July 27, 2026, 03:27 UTC. ClawSweeper reviewWhat this changesThe PR adds account-aware OpenAI API-key model catalog entries with provider-owned capabilities and costs, plus a real fresh-state onboarding regression test in the native live shard. Merge readinessThis PR addresses a credible first-use OpenAI API-key onboarding gap with provider-local, account-gated model projection and strong stated live evidence. It should remain open for protected maintainer review and a refresh against current Priority: P1 Review scores
Verification
How this fits togetherOpenAI API-key onboarding selects the OpenAI provider and builds a model catalog for the account. That catalog feeds the model picker and the first agent run, so its discovery filtering and metadata determine which models users can choose and how they run. flowchart LR
A[OpenAI API-key onboarding] --> B[OpenAI provider catalog]
B --> C[Authenticated model discovery]
C --> D[Account-gated known model metadata]
D --> E[Model picker and default selection]
E --> F[First agent turn]
C --> G[Manifest fallback on discovery failure]
G --> E
Decision needed
Why: The patch changes the API-key provider’s user-selectable model catalog and carries a protected Before merge
Agent review detailsSecurityNone. PR surfaceSource +81, Tests +282. Total +363 across 5 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Copy recommended automerge instructionTechnical reviewBest possible solution: Rebase the provider-local fix onto current Do we have a high-confidence way to reproduce the issue? Yes in source terms: current main uses manifest-only API-key catalog rows before shared discovery filtering, while the PR adds account-gated known rows and a fresh-state live test. The report also supplies a concrete real-account reproduction, but this read-only review did not independently run it. Is this the best way to solve the issue? Yes, provisionally. Keeping supplemental OpenAI models and their metadata inside the owning provider, projecting them only after authenticated discovery, and retaining the existing manifest fallback is narrower and safer than a core or SDK special case. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against e717d24c2e7b. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Maintainer decision on ClawSweeper rank-up moves:
Approved for the repository-native prepare/merge workflow. |
|
Merged via squash.
|
…PI-key users (#162563) ## What Problem This Solves Fixes: with an OpenAI API key, chat models that the account's `/v1/models` lists but the bundled manifest doesn't (for example `gpt-5.2`, `gpt-4.1`, `o3`) are missing from `/models`. Selecting one fails with `Unknown model: openai/gpt-5.2`. ## User Impact API-key users can pick and run current GPT and o-series chat models that their account exposes, including future ids that ship before a manifest update. Manifest models keep their existing rows and prices. Admitted models report cost as unknown: the cost is omitted, not shown as `$0`. Media, realtime, search, embedding, legacy, dated-snapshot, fine-tune and experiment ids stay hidden. ## Why This Change Was Made #114258 intersects the manifest with the account's live catalog so OpenClaw advertises only models the account can use, and manifest metadata wins. This change keeps that intersection. It also admits live ids that match current chat families (`gpt-4o`, `gpt-4.1`, `gpt-5`+, `o1`+) and are neither known route ids nor manifest rows. Admitted rows are deliberately conservative: Responses API, text-only input, 128k context, 16,384 max output tokens, and reasoning only for GPT-5+ and o-series. Their cost uses the existing zero placeholder. Shared usage reporting already treats zero catalog rates as unknown pricing, so it omits the cost instead of reporting `$0`. Some families appear in `/v1/models` but return 404 on `/v1/responses` for the same key: every `*-chat-latest` and `*-cyber` id, and all `*-codex` ids except `gpt-5.3-codex`. They are excluded, along with `preview`, `alpha` and `beta` variants. The admission rules now live in a new `account-models.ts`, and the API-key catalog tests moved to `openai-api-key-catalog.test.ts`. The provider module and its test file stay within their line-count caps. ## Evidence - Regression test `admits account chat models missing from the manifest with conservative metadata` fails on `main` (`expected [ 'gpt-5.5' ]`) and passes on this branch. It covers admitted rows (`gpt-4.1-mini`, a future `gpt-6.2`, `o3`), conservative metadata, the zero cost placeholder, manifest precedence, and 25 excluded ids (snapshot, chat-latest, codex, cyber, preview/alpha/beta, search, audio, realtime, image, embedding, moderation, fine-tune, experiment). - Live before/after with the same real API key against two isolated Gateways built from `main` (`d0f06ee`) and this branch: - The account's `/v1/models` lists 169 ids. `models.list` showed 16 OpenAI rows on `main` and 34 on the branch. The 18 added ids are `gpt-4.1`, `gpt-4.1-mini`, `gpt-4.1-nano`, `gpt-4o`, `gpt-4o-mini`, `gpt-5`, `gpt-5-mini`, `gpt-5-nano`, `gpt-5-pro`, `gpt-5.1`, `gpt-5.2`, `gpt-5.2-pro`, `o1`, `o1-pro`, `o3`, `o3-mini`, `o3-pro` and `o4-mini`. Each one returned 200 from a direct `/v1/responses` probe. The picker gained no non-chat ids. All 16 manifest rows, including `gpt-6.1-sol` from #161400, are identical on both builds. - Running a turn on `openai/gpt-5.2`: `main` fails with `Unknown model: openai/gpt-5.2`. The branch replies `ok`. The run reports usage (20k input / 5 output tokens) with no `costUsd`, and `/status` shows tokens but no Cost row. - `openai/gpt-6.1-sol` (manifest-owned) works the same on both builds, with priced cost (`$0.0028` on `main`, `$0.0025` on the branch). - `pnpm test extensions/openai/openai-provider.test.ts extensions/openai/openai-api-key-catalog.test.ts`: 70 passed. `pnpm check:changed` passed. - Test cost: the only new test is the regression; the other nine API-key catalog tests moved unchanged out of `openai-provider.test.ts`. Local `pnpm test <file> --maxWorkers=1` wall time is 25.0s for `openai-api-key-catalog.test.ts` (10 tests) and 23.8s for `openai-provider.test.ts` (60 tests), mostly transform. In CI run [36839484116](https://github.com/openclaw/openclaw/actions/runs/36839484116), test time sums to 2.07s and 12.8s; the new regression takes 3ms. - No overlap with Pash/Sarah changes: #127394 touches only the ChatGPT/Codex discovery path and shared test fixtures. Co-authored-by: Ayaan Zaidi <[email protected]>
…PI-key users (openclaw#162563) ## What Problem This Solves Fixes: with an OpenAI API key, chat models that the account's `/v1/models` lists but the bundled manifest doesn't (for example `gpt-5.2`, `gpt-4.1`, `o3`) are missing from `/models`. Selecting one fails with `Unknown model: openai/gpt-5.2`. ## User Impact API-key users can pick and run current GPT and o-series chat models that their account exposes, including future ids that ship before a manifest update. Manifest models keep their existing rows and prices. Admitted models report cost as unknown: the cost is omitted, not shown as `$0`. Media, realtime, search, embedding, legacy, dated-snapshot, fine-tune and experiment ids stay hidden. ## Why This Change Was Made openclaw#114258 intersects the manifest with the account's live catalog so OpenClaw advertises only models the account can use, and manifest metadata wins. This change keeps that intersection. It also admits live ids that match current chat families (`gpt-4o`, `gpt-4.1`, `gpt-5`+, `o1`+) and are neither known route ids nor manifest rows. Admitted rows are deliberately conservative: Responses API, text-only input, 128k context, 16,384 max output tokens, and reasoning only for GPT-5+ and o-series. Their cost uses the existing zero placeholder. Shared usage reporting already treats zero catalog rates as unknown pricing, so it omits the cost instead of reporting `$0`. Some families appear in `/v1/models` but return 404 on `/v1/responses` for the same key: every `*-chat-latest` and `*-cyber` id, and all `*-codex` ids except `gpt-5.3-codex`. They are excluded, along with `preview`, `alpha` and `beta` variants. The admission rules now live in a new `account-models.ts`, and the API-key catalog tests moved to `openai-api-key-catalog.test.ts`. The provider module and its test file stay within their line-count caps. ## Evidence - Regression test `admits account chat models missing from the manifest with conservative metadata` fails on `main` (`expected [ 'gpt-5.5' ]`) and passes on this branch. It covers admitted rows (`gpt-4.1-mini`, a future `gpt-6.2`, `o3`), conservative metadata, the zero cost placeholder, manifest precedence, and 25 excluded ids (snapshot, chat-latest, codex, cyber, preview/alpha/beta, search, audio, realtime, image, embedding, moderation, fine-tune, experiment). - Live before/after with the same real API key against two isolated Gateways built from `main` (`dd8d9f0`) and this branch: - The account's `/v1/models` lists 169 ids. `models.list` showed 16 OpenAI rows on `main` and 34 on the branch. The 18 added ids are `gpt-4.1`, `gpt-4.1-mini`, `gpt-4.1-nano`, `gpt-4o`, `gpt-4o-mini`, `gpt-5`, `gpt-5-mini`, `gpt-5-nano`, `gpt-5-pro`, `gpt-5.1`, `gpt-5.2`, `gpt-5.2-pro`, `o1`, `o1-pro`, `o3`, `o3-mini`, `o3-pro` and `o4-mini`. Each one returned 200 from a direct `/v1/responses` probe. The picker gained no non-chat ids. All 16 manifest rows, including `gpt-6.1-sol` from openclaw#161400, are identical on both builds. - Running a turn on `openai/gpt-5.2`: `main` fails with `Unknown model: openai/gpt-5.2`. The branch replies `ok`. The run reports usage (20k input / 5 output tokens) with no `costUsd`, and `/status` shows tokens but no Cost row. - `openai/gpt-6.1-sol` (manifest-owned) works the same on both builds, with priced cost (`$0.0028` on `main`, `$0.0025` on the branch). - `pnpm test extensions/openai/openai-provider.test.ts extensions/openai/openai-api-key-catalog.test.ts`: 70 passed. `pnpm check:changed` passed. - Test cost: the only new test is the regression; the other nine API-key catalog tests moved unchanged out of `openai-provider.test.ts`. Local `pnpm test <file> --maxWorkers=1` wall time is 25.0s for `openai-api-key-catalog.test.ts` (10 tests) and 23.8s for `openai-provider.test.ts` (60 tests), mostly transform. In CI run [36839484116](https://github.com/openclaw/openclaw/actions/runs/36839484116), test time sums to 2.07s and 12.8s; the new regression takes 3ms. - No overlap with Pash/Sarah changes: openclaw#127394 touches only the ChatGPT/Codex discovery path and shared test fixtures. Co-authored-by: Ayaan Zaidi <[email protected]>
What Problem This Solves
Fixes an issue where users onboarding with a valid OpenAI API key could not select supported models that their account actually exposes. The same onboarding default,
openai/gpt-5.6, could not be selected by the existing OpenAI live regression suite, so a real first-use break could escape release coverage.Why This Change Was Made
Keep first-party model discovery and metadata inside the OpenAI provider plugin. Project supplemental models only when authenticated discovery confirms account access, preserve the existing manifest-only fallback when discovery is unavailable, and retain accurate model costs, context windows, response transport, and the documented text-only GPT-5.4 Pro modality. Register a production-faithful fresh-state onboarding test in the existing native release live shard.
User Impact
A newly onboarded OpenAI user can see and use supported account-visible models, including
gpt-5.4-mini,gpt-5.4-nano, andchat-latest, without advertising unavailable models. Repeated onboarding persists only anOPENAI_API_KEYenvironment reference in the canonical agent SQLite store and the actual default completes a first agent turn. Test failures redact real credentials.Evidence
/v1/modelsreturned mini, nano, and chat-latest; clean onboarding omitted all three. Existing default-model live test failed withUnsupported live OpenAI model: gpt-5.6.pnpm test extensions/openai/openai-provider.test.ts test/scripts/test-live-shard.test.ts: 84 assertions pass, including authenticated account filtering, unavailable-discovery fallback, model capabilities, and native live-shard selection.OPENCLAW_LIVE_OPENAI_MODELS=gpt-5.6,gpt-5.4-mini,gpt-5.4-nano,chat-latest pnpm test:live -- extensions/openai/openai-provider.live.test.ts test/openai-onboarding.live.test.ts: all five live tests pass with a real, remotely hydrated API key; the onboarding regression exercises a clean state, two CLI onboarding runs, SQLite-only env-ref persistence, and a real default-model agent reply.../codex/codex-rs/app-server-protocol/src/protocol/v2/account.rsand../codex/codex-rs/app-server/src/request_processors/account_processor.rs; no Codex protocol, authentication, migration, or provider ownership changes.