Skip to content

fix(openai): show account models after API-key onboarding - #114258

Merged
steipete merged 1 commit into
mainfrom
codex/openai-onboarding-live-stress
Jul 27, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/openai-onboarding-live-stress

Conversation

@steipete

Copy link
Copy Markdown
Contributor

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, and chat-latest, without advertising unavailable models. Repeated onboarding persists only an OPENAI_API_KEY environment reference in the canonical agent SQLite store and the actual default completes a first agent turn. Test failures redact real credentials.

Evidence

  • Reproduced against a real account: OpenAI /v1/models returned mini, nano, and chat-latest; clean onboarding omitted all three. Existing default-model live test failed with Unsupported 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.
  • Mandatory fresh Codex autoreview and TruffleHog: clean.
  • Release tarball builds, passes import-graph/integrity checks, and installs successfully in a clean container.
  • Upstream Codex API-key contract personally checked at ../codex/codex-rs/app-server-protocol/src/protocol/v2/account.rs and ../codex/codex-rs/app-server/src/request_processors/account_processor.rs; no Codex protocol, authentication, migration, or provider ownership changes.

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. labels Jul 27, 2026
@clawsweeper

clawsweeper Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed July 26, 2026, 11:27 PM ET / July 27, 2026, 03:27 UTC.

ClawSweeper review

What this changes

The 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 readiness

⚠️ Ready for maintainer review - 2 items remain

This 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 main; no discrete patch defect was established from the available source and PR evidence.

Priority: P1
Reviewed head: b6644b48193490bb70379021a08cfaf8242d5dd5
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused provider fix with strong stated live proof and targeted coverage; it needs only the protected maintainer decision and a current-base refresh.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The PR body gives after-fix real-key live evidence for clean onboarding, repeated persistence, account-visible models, and a real default-model reply; redact credentials and private endpoints in any refreshed evidence.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The PR body gives after-fix real-key live evidence for clean onboarding, repeated persistence, account-visible models, and a real default-model reply; redact credentials and private endpoints in any refreshed evidence.
Evidence reviewed 4 items Current main catalog boundary: Current main builds the API-key catalog from manifest models and invokes the shared live model discovery helper only for the OpenAI HTTPS API endpoint; the proposed projection stays inside the OpenAI provider rather than adding a core or SDK policy path.
PR changed-surface coverage: The branch adds account-gated supplemental metadata in the OpenAI provider, focused unit expectations for discovered models and fallback behavior, and a clean-state live onboarding regression registered in the native live shard.
Real behavior evidence: The PR body reports five passing real-key live tests covering two fresh onboarding runs, SQLite-backed environment-reference persistence, account-visible models, and a successful default-model agent reply; the hosted Real behavior proof check is successful.
Findings None None.
Security None None.

How this fits together

OpenAI 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
Loading

Decision needed

Question Recommendation
Should the protected OpenAI provider change be approved after the branch is rebased and its account-aware catalog metadata is rechecked against current main? Rebase and approve: Refresh the branch against current main, confirm the discovered-model metadata and fallback tests still pass, then merge the provider-local repair.

Why: The patch changes the API-key provider’s user-selectable model catalog and carries a protected maintainer label; a human should confirm the supported-model and billing/capability metadata before merge.

Before merge

  • Resolve merge risk (P2) - Model discovery changes a provider-visible catalog; after rebasing, maintainers should confirm the exact head still preserves the documented manifest fallback and provider-owned capability, modality, context, and cost metadata for every supplemental model.
Agent review details

Security

None.

PR surface

Source +81, Tests +282. Total +363 across 5 files.

View PR surface stats
Area Files Added Removed Net
Source 1 81 0 +81
Tests 4 291 9 +282
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 5 372 9 +363

Review metrics

Metric Value Why it matters
Fresh-state live regression 1 new native live-shard scenario It exercises API-key onboarding, persisted credential-reference handling, account-visible model selection, and a real first reply rather than only catalog mocks.

Stored data model

Persistent data-model change detected: serialized state: test/openai-onboarding.live.test.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Refresh provider proof before merge (recommended)
    Rebase onto current main and rerun the focused provider plus fresh-state live onboarding proof so the account-gated catalog is validated on the mergeable head.
  2. Accept the current metadata contract
    Merge after maintainer confirmation that the listed model capabilities, costs, contexts, and GPT-5.4 Pro text-only modality are the intended API-key catalog contract.
Copy recommended automerge instruction
@clawsweeper automerge

Special instructions:
Rebase onto current main and rerun the focused OpenAI provider tests plus the real fresh-state onboarding live test; preserve the manifest fallback and account-gated supplemental model metadata.

Technical review

Best possible solution:

Rebase the provider-local fix onto current main, preserve account-gated discovery with the existing fallback, and land it only after the refreshed head retains focused and real onboarding proof.

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.

Labels

Label changes:

  • add P1: The reported API-key onboarding failure can prevent users from selecting models their authenticated OpenAI account supports during first use.
  • add merge-risk: 🚨 auth-provider: The patch changes the API-key provider’s account-specific model catalog and associated runtime metadata, which can affect model availability and provider behavior after upgrade.
  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR body gives after-fix real-key live evidence for clean onboarding, repeated persistence, account-visible models, and a real default-model reply; redact credentials and private endpoints in any refreshed evidence.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body gives after-fix real-key live evidence for clean onboarding, repeated persistence, account-visible models, and a real default-model reply; redact credentials and private endpoints in any refreshed evidence.

Label justifications:

  • P1: The reported API-key onboarding failure can prevent users from selecting models their authenticated OpenAI account supports during first use.
  • merge-risk: 🚨 auth-provider: The patch changes the API-key provider’s account-specific model catalog and associated runtime metadata, which can affect model availability and provider behavior after upgrade.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body gives after-fix real-key live evidence for clean onboarding, repeated persistence, account-visible models, and a real default-model reply; redact credentials and private endpoints in any refreshed evidence.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body gives after-fix real-key live evidence for clean onboarding, repeated persistence, account-visible models, and a real default-model reply; redact credentials and private endpoints in any refreshed evidence.

Evidence

What I checked:

  • Current main catalog boundary: Current main builds the API-key catalog from manifest models and invokes the shared live model discovery helper only for the OpenAI HTTPS API endpoint; the proposed projection stays inside the OpenAI provider rather than adding a core or SDK policy path. (extensions/openai/openai-provider.ts:185, e717d24c2e7b)
  • PR changed-surface coverage: The branch adds account-gated supplemental metadata in the OpenAI provider, focused unit expectations for discovered models and fallback behavior, and a clean-state live onboarding regression registered in the native live shard. (extensions/openai/openai-provider.ts:185, b6644b481934)
  • Real behavior evidence: The PR body reports five passing real-key live tests covering two fresh onboarding runs, SQLite-backed environment-reference persistence, account-visible models, and a successful default-model agent reply; the hosted Real behavior proof check is successful. (test/openai-onboarding.live.test.ts:1, b6644b481934)
  • Current-base refresh needed: GitHub reports the PR as mergeable but behind main; the review should be refreshed after rebasing onto current main SHA e717d24 so the exact merge head retains the provider and live-test behavior.

Likely related people:

  • steipete: Authored the proposed OpenAI provider and live-onboarding changes in the current PR head; the available review context does not expose enough prior file history to identify a separate current-main owner confidently. (role: recent OpenAI provider contributor; confidence: low; commits: b6644b481934; files: extensions/openai/openai-provider.ts, test/openai-onboarding.live.test.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Rebase onto current main and refresh the focused provider and live onboarding proof on that exact head.
  • Obtain maintainer confirmation of the account-discovered model metadata contract before merging.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@steipete

Copy link
Copy Markdown
Contributor Author

Maintainer decision on ClawSweeper rank-up moves:

  • Confirmed the provider-owned model contract against the real account, focused tests, and current official OpenAI model documentation: discovered models require account-returned IDs; discovery outages retain the manifest-only fallback; costs, context windows, and GPT-5.4 Pro's text-only input are explicitly tested.
  • Intentionally preserving the exact reviewed and fully green head instead of rebasing solely because main advanced. Verified that current origin/main has no changes in any of the five touched files since the merge base. The exact PR head has successful full hosted CI, full build, 84 focused assertions, five real-key live tests, and a fresh clean secret-scanned review. Rebase-only drift is advisory under repository landing policy.
  • No auth protocol, config migration, SQLite schema, or persistent data format is changed; the new test only verifies the already-shipped canonical SQLite env-ref contract.

Approved for the repository-native prepare/merge workflow.

@steipete
steipete merged commit 04bb2b7 into main Jul 27, 2026
167 of 175 checks passed
@steipete
steipete deleted the codex/openai-onboarding-live-stress branch July 27, 2026 03:34
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 27, 2026
obviyus added a commit that referenced this pull request Oct 1, 2026
…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]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 2, 2026
…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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extensions: openai maintainer Maintainer-authored PR merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant