Repository navigation
fix(openai): prevent onboarding from offering unavailable account models - #114356
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed July 27, 2026, 2:08 AM ET / 06:08 UTC. ClawSweeper reviewWhat this changesThis PR keeps a successfully discovered OpenAI account model list authoritative during onboarding while preserving eligible configured and static provider routes, and adds the installed-onboarding release lane plus related regression coverage. Merge readiness⛔ Blocked until real behavior proof from a real setup is added - 5 items remain Keep this PR open for maintainer handling. The patch targets a real P1 OpenAI onboarding failure and uses a narrow prepared-catalog change rather than changing the public manifest cache API, but it remains compatibility-sensitive and the added PR-body evidence is focused test output rather than inspectable exact-head live onboarding proof. Current main still unconditionally merges eligible manifest models into discovered entries, so the central behavior is not already implemented. (raw.githubusercontent.com) **Likely related people**
Priority: P1 Review scores
Verification
How this fits togetherOpenAI onboarding builds a prepared model catalog from account discovery, plugin manifests, and explicit configuration before presenting selectable models to the user. The release workflow then runs package-acceptance lanes against the immutable release artifact before shipment. flowchart LR
A[OpenAI account discovery] --> C[Prepared model catalog]
B[Plugin manifests and configured models] --> C
C --> D[Onboarding model picker]
D --> E[Selected provider route]
F[Release package artifact] --> G[Installed onboarding acceptance]
G --> H[Release decision]
Decision needed
Why: The change intentionally alters provider/auth-derived model availability and release coverage; the maintainer label requires explicit human confirmation of that compatibility policy. Before merge
Agent review detailsSecurityNone. PR surfaceSource +49, Tests +274, Config 0. Total +323 across 5 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep account-discovered models authoritative only after successful runtime discovery, retain explicitly configured and non-runtime manifest routes through the existing planner, and land after a maintainer confirms the precedence policy with redacted current-head live proof. Do we have a high-confidence way to reproduce the issue? Yes, source-reproducible: current main merges eligible manifest entries into the discovered catalog, while the PR’s expanded model-catalog cases encode restricted and account-denied discovery states. I did not execute the live provider scenario in this read-only review. (raw.githubusercontent.com) Is this the best way to solve the issue? Yes, likely: using the existing catalog planner’s supplemental selection at the prepared-catalog boundary is narrower and safer than altering discovery or the manifest-cache contract, subject to maintainer confirmation of the intended precedence policy. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against ffec7731a4ac. LabelsLabel 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
HistoryReview history (1 earlier review cycle)
|
|
Merged via squash.
|
…els (openclaw#114356) * fix(openai): keep account models and onboarding release proof authoritative * fix(openai): document configured model catalog authority
…ker reads (#200988) ## What Problem This Solves A model that a provider launches does not appear in the Gateway model picker until the Gateway restarts, its config or credentials change, the next 6-hourly hosted catalog revision is adopted, or the user presses **Refresh**. Example: OpenAI launched `gpt-6.2-astra` and `gpt-6.2-sol` on 2026-11-17. Typed `openai/gpt-6.2-sol` turns worked on every release, but the picker kept the OpenAI listing saved before the launch. Cause: #167008 stopped ordinary `models.list` reads from renewing an expired provider listing, because that expiry was the provider's 60-second HTTP response-cache TTL and almost every picker open rebuilt the catalog. Nothing replaced it, so a saved live listing never ages on its own. ## Why This Change Was Made - A successful live listing now expires at the later of its response-cache deadline and 15 minutes after acquisition (`discoveryDeadline`). The floor keeps short TTLs from renewing on almost every read (#167008). A longer TTL still wins (#168050, ClawRouter's one hour), so the expiry relist, which honors each feed's cache, always reaches the provider instead of re-stamping a cached response as fresh. - `models.list` calls the catalog owner's existing `refreshExpiredModelCatalog`, which relists only expired providers in the background. The read returns the published rows at once; open pickers update through the existing catalog publication push. - Expiry and failed-discovery retry relists no longer mark providers pending. They revalidate rows the user already sees, so pickers show no loading state and chat `/models` adds no `checking models…` line for them. First sign-in, changed credentials and explicit **Refresh** still report progress. - The listing still decides which models a signed-in provider shows (#114356). This change only keeps that listing fresh. Accepted cost: at most one background relist per live-listed provider per 15 minutes (or per its cache TTL, when longer), and only while someone opens a picker. Providers whose listing is not retained in the live response cache (`ttlMs: 0`, self-hosted discovery) keep the previous behavior. ## User Impact A newly launched provider model appears in the picker within about 15 minutes of the provider listing it, on the first picker open, with no restart, no **Refresh**, no loading indicator and no OpenClaw release. ## Evidence - **Regression (vitest-source):** `models-list.freshness.integration.test.ts` keeps the real live response cache (500 ms TTL, no cache clearing). It asserts that the listing ages out on the 15-minute floor rather than the short TTL, and that an ordinary `models.list` read on an aged listing serves saved rows with no `pendingProviders`, relists once in the background, then publishes the new model. Fails on merge base `e235b2b983b6` (3/3, deadline equals the cache TTL); the no-pending assertion also fails on this PR's previous head `41ee4d30` (3/3, provider listed as pending); passes on this head (3/3). - **Renewal contract (vitest-source):** `server-chat-metadata-lifecycle.catalog-renewal.test.ts` now asserts that an expiry renewal never publishes a pending provider and that settling it sends only the real catalog change, with no refresh-status broadcast. An explicit refresh in the same file still reports refresh status. - **E2E, CLI reads (fix: source tier; base: `e235b2b983b6` dist-nodts):** two isolated Gateways, each with a fake LiteLLM proxy as its live listing and hosted catalog refresh disabled. At 04:03:46Z each proxy starts listing `fake-2`; an ordinary `gateway call models.list` (no refresh) runs once a minute. | Time (UTC) | Fix Gateway picker | Base Gateway picker | |---|---|---| | 04:03:41 (before) | `fake-1` | `fake-1` | | 04:04 to 04:17 | `fake-1` | `fake-1` | | 04:18:58 | `fake-1`, `fake-2` | `fake-1` | | 04:23:58 | `fake-1`, `fake-2` | `fake-1` | Proxy request logs: the fix Gateway listed at startup and once more at 04:17:58, the first read after the listing aged; no other requests. The base Gateway never listed again. - **E2E, Control UI (dist-nodts, real browser):** this head and the previous head `41ee4d30`, each with a fake LiteLLM listing whose `/models` response is held for 25 s after a new model is added. The picker is opened once the listing aged (proxy logs show the relist request at that moment), then again after release. During the relist both pickers render the saved models immediately with no loading state; the new model appears after the relist publishes. The visible difference from the previous head is the pending flag (`pendingProviders`, and chat `/models` `checking models…`), which the tests above pin as absent. Screenshots: #200988 (comment) - **Affected suites (vitest-source, exact head):** freshness, renewal, worker recovery, publication events, auth-login catalog, prepared-runtime sources, native picker failures and configured catalog index: 52 tests across 5 shards pass. - **Review and CI:** local ClawSweeper review (`gpt-6.1-sol`) on `3fd0cae6` found no issues; required CI is green on the same head. Co-authored-by: Ayaan Zaidi <[email protected]>
…ker reads (openclaw#200988) ## What Problem This Solves A model that a provider launches does not appear in the Gateway model picker until the Gateway restarts, its config or credentials change, the next 6-hourly hosted catalog revision is adopted, or the user presses **Refresh**. Example: OpenAI launched `gpt-6.2-astra` and `gpt-6.2-sol` on 2026-11-17. Typed `openai/gpt-6.2-sol` turns worked on every release, but the picker kept the OpenAI listing saved before the launch. Cause: openclaw#167008 stopped ordinary `models.list` reads from renewing an expired provider listing, because that expiry was the provider's 60-second HTTP response-cache TTL and almost every picker open rebuilt the catalog. Nothing replaced it, so a saved live listing never ages on its own. ## Why This Change Was Made - A successful live listing now expires at the later of its response-cache deadline and 15 minutes after acquisition (`discoveryDeadline`). The floor keeps short TTLs from renewing on almost every read (openclaw#167008). A longer TTL still wins (openclaw#168050, ClawRouter's one hour), so the expiry relist, which honors each feed's cache, always reaches the provider instead of re-stamping a cached response as fresh. - `models.list` calls the catalog owner's existing `refreshExpiredModelCatalog`, which relists only expired providers in the background. The read returns the published rows at once; open pickers update through the existing catalog publication push. - Expiry and failed-discovery retry relists no longer mark providers pending. They revalidate rows the user already sees, so pickers show no loading state and chat `/models` adds no `checking models…` line for them. First sign-in, changed credentials and explicit **Refresh** still report progress. - The listing still decides which models a signed-in provider shows (openclaw#114356). This change only keeps that listing fresh. Accepted cost: at most one background relist per live-listed provider per 15 minutes (or per its cache TTL, when longer), and only while someone opens a picker. Providers whose listing is not retained in the live response cache (`ttlMs: 0`, self-hosted discovery) keep the previous behavior. ## User Impact A newly launched provider model appears in the picker within about 15 minutes of the provider listing it, on the first picker open, with no restart, no **Refresh**, no loading indicator and no OpenClaw release. ## Evidence - **Regression (vitest-source):** `models-list.freshness.integration.test.ts` keeps the real live response cache (500 ms TTL, no cache clearing). It asserts that the listing ages out on the 15-minute floor rather than the short TTL, and that an ordinary `models.list` read on an aged listing serves saved rows with no `pendingProviders`, relists once in the background, then publishes the new model. Fails on merge base `9decc8090873` (3/3, deadline equals the cache TTL); the no-pending assertion also fails on this PR's previous head `41ee4d30` (3/3, provider listed as pending); passes on this head (3/3). - **Renewal contract (vitest-source):** `server-chat-metadata-lifecycle.catalog-renewal.test.ts` now asserts that an expiry renewal never publishes a pending provider and that settling it sends only the real catalog change, with no refresh-status broadcast. An explicit refresh in the same file still reports refresh status. - **E2E, CLI reads (fix: source tier; base: `9decc8090873` dist-nodts):** two isolated Gateways, each with a fake LiteLLM proxy as its live listing and hosted catalog refresh disabled. At 04:03:46Z each proxy starts listing `fake-2`; an ordinary `gateway call models.list` (no refresh) runs once a minute. | Time (UTC) | Fix Gateway picker | Base Gateway picker | |---|---|---| | 04:03:41 (before) | `fake-1` | `fake-1` | | 04:04 to 04:17 | `fake-1` | `fake-1` | | 04:18:58 | `fake-1`, `fake-2` | `fake-1` | | 04:23:58 | `fake-1`, `fake-2` | `fake-1` | Proxy request logs: the fix Gateway listed at startup and once more at 04:17:58, the first read after the listing aged; no other requests. The base Gateway never listed again. - **E2E, Control UI (dist-nodts, real browser):** this head and the previous head `41ee4d30`, each with a fake LiteLLM listing whose `/models` response is held for 25 s after a new model is added. The picker is opened once the listing aged (proxy logs show the relist request at that moment), then again after release. During the relist both pickers render the saved models immediately with no loading state; the new model appears after the relist publishes. The visible difference from the previous head is the pending flag (`pendingProviders`, and chat `/models` `checking models…`), which the tests above pin as absent. Screenshots: openclaw#200988 (comment) - **Affected suites (vitest-source, exact head):** freshness, renewal, worker recovery, publication events, auth-login catalog, prepared-runtime sources, native picker failures and configured catalog index: 52 tests across 5 shards pass. - **Review and CI:** local ClawSweeper review (`gpt-6.1-sol`) on `3fd0cae6` found no issues; required CI is green on the same head. Co-authored-by: Ayaan Zaidi <[email protected]>
Related: #114288
What Problem This Solves
Fixes an issue where users onboarding with an OpenAI account could be shown and select models that their account cannot actually access, even after successful account-specific model discovery. Also closes a release-acceptance gap that allowed a candidate package to pass without exercising fresh installed onboarding.
Why This Change Was Made
Use the existing model-catalog planner's supplemental selection at the prepared-catalog boundary, keeping the public manifest API and its identity-preserving cache unchanged. Runtime-discovered models now stay account-authoritative while explicitly configured models, account-visible synthetic metadata, distinct provider routes, static providers, and refreshable providers remain available. Strengthen real Gateway onboarding proof through the canonical persisted session accessor and add existing typed installed onboarding to the immutable release artifact's acceptance lanes.
User Impact
Users see and select OpenAI models their account can actually use. Configured models and provider-specific routing continue to work. Release acceptance now checks fresh installed onboarding against the same prepared package artifact, and live onboarding verifies that both the user and assistant messages are durably persisted.
Evidence
16d2b7e46784c75eb5d57329269e9fd47222d2ef; subsequently fetched and rebased ontodf5d85a5b2ff5249d1bbfbe95579251edfe8adb1.a4069dc9667f5a93855ee491c75f991ae9cd0d16: 274 passing account-catalog, OpenAI provider, SDK, Gateway transcript, release-planner, and package assertions across six Vitest shards; the exact changed immutable-artifact release-workflow regression also passes independently.node scripts/check-changed.mjsfallback: production lint, core/core-test/root-test typecheck, SDK compatibility, dependency/secret/boundary, database/schema, formatting, and runtime-cycle guards all pass.pnpm buildincluding the production runtime, all 142 public SDK exports, and production Control UI succeeds.gpt-5.6,gpt-5.6-sol,gpt-5.6-terra,gpt-5.6-luna,gpt-5.4-mini,gpt-5.4-nano, andchat-latest; real environment-reference onboarding, repeated onboarding, authenticated Gateway readiness, and actual Gateway agent turns also passed.../codex/codex-rs/app-server/src/models.rsand../codex/codex-rs/protocol/src/openai_models.rs.Inspectable after-fix behavior
Run on reviewed commit
a4069dc9667f5a93855ee491c75f991ae9cd0d16:The configured-model regression also checks both the configured OpenAI endpoint and the distinct provider-supplied route, including context-window and tool-compatibility metadata. This directly covers account-denied, restricted-account, upgrade/config compatibility, and synthetic route preservation.
That passing assertion parses the workflow and verifies the existing
release-typed-onboardinglane is first and consumes the same immutable package artifact digest, artifact ID/name, producer run/attempt, package SHA, source SHA, and version.The exact persisted Gateway live proof is visible in
test/openai-onboarding.live.test.ts:325: the existing real-agent run resolves the canonical session key and independently asserts bothhasPersistedTranscriptMessage(persistedEvents, "user", gatewayPrompt)andhasPersistedTranscriptMessage(persistedEvents, "assistant", replyMarker). The final-head key-bearing rerun now genuinely passed on the normally hydrated isolated Blacksmith runner; its exact verified commit, seven actual model completions, real authenticated Gateway response, and durable user/assistant transcript assertions are recorded below.Linux exact-head checks and build artifacts: https://github.com/openclaw/openclaw/actions/runs/30240758949
Maintainer compatibility review: configured runtime models, provider route variants, manifest cache identity, successful account-discovered rows, and both static and refreshable providers are explicitly covered by the passing after-fix matrix; no new config, auth profile, provider alias, database migration, or shipped compatibility shim was introduced.
Exact-head real OpenAI and Gateway proof
All exact-head hosted Linux checks, required Blacksmith Testbox, and the protected CI gate also pass: https://github.com/openclaw/openclaw/actions/runs/30241522309. This proof uses only the native hydrated provider helper; no API key, raw environment, private message, or transcript contents were emitted.