Repository navigation
fix(openai): new ChatGPT-login models stay hidden until an OpenClaw release - #167387
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed October 8, 2026, 2:47 PM ET / 18:47 UTC (Revision 3). ClawSweeper reviewWhat this changesChatGPT-login model discovery reports npm’s newest stable Codex version, with a shared cache and fallback to the last successful version or bundled pin. Example: The user refreshes the model list with ChatGPT login.
Review scores
ProductKind: Feature · Worth it: Yes Merge readiness✅ Ready for maintainer review The recorded area-owner decision resolves the prior product blocker. Real CLI evidence covers the changed discovery path, and no actionable patch defects remain. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe OpenAI plugin retrieves an account-specific model catalog for ChatGPT login and converts it into selectable OpenClaw models. The reported Codex client version influences which models the backend returns. flowchart LR
A[ChatGPT login] --> B[OpenAI model discovery]
C[npm stable Codex version] --> D[Cached version selection]
E[Bundled fallback version] --> D
D --> B
B --> F[Account model catalog]
F --> G[Selectable OpenClaw models]
Technical reviewBest possible solution: Use the accepted discovery policy while keeping executing-runtime selection with its separate owner. Do we have a high-confidence way to reproduce the issue? Not applicable as a demonstrated current-main defect: the tested account already sees gpt-6.1-sol with main’s 0.160.0 pin. The real CLI control does establish that advertised versions influence model visibility. Is this the best way to solve the issue? Yes, within the recorded product decision: the change stays in the existing provider discovery owner and preserves bounded fallback behavior without adding runtime-update machinery. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 082c68a9cbd8. Provenance checked
TestingProof path: shipped entry point. Added test files: 5. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +110, Tests +112. Total +222 across 7 files. View PR surface stats
LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment History |
|
Maintainer decision: ChatGPT model discovery should advertise npm's newest stable This intentionally replaces the alignment contract from #113615. We accept that a model whose protocol the current build does not handle can appear and then fail on its first turn; a visible, explainable failure is better than new models staying hidden until an OpenClaw release. The Codex harness change from #157920's closing note (report the running binary) is a separate follow-up and is not part of this PR. @clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Landed in 41a8839. ChatGPT-login model discovery now reports npm's newest stable |
…elease (openclaw#167387) Related: openclaw#157920 ## What Problem This Solves Fixes: new ChatGPT-login models stay hidden from `/models` until an OpenClaw release, because model discovery reports a hard-coded Codex client version. ## User Impact User impact: with ChatGPT login, models that need a newer Codex client appear in the model list once that Codex version is published to npm, with no OpenClaw release. Example: 2026.9.8 reports `client_version=0.158.0`, so the ChatGPT backend hides `gpt-6.1-sol`. With this change, OpenClaw reports `0.161.0` (current npm `latest`) and the model appears. ## Why This Change Was Made ChatGPT model discovery now asks npm for `@openai/codex`'s `latest` stable version and sends it as `client_version`. - One small request to `registry.npmjs.org`, through the SSRF guard, with a 5 s timeout. - The version is cached for 6 hours. Concurrent discoveries share one request. - If npm is unreachable or returns something odd, OpenClaw keeps the last version it got from npm, or the bundled pin (`0.160.0`, unchanged contract test) if it never got one, and retries after 5 minutes. - If the model-list request itself fails, the previous list stays (existing catalog retention for failed providers). - Only stable versions are used. If OpenClaw pins a newer prerelease, the pin wins. - This changes only the version OpenClaw *reports* for discovery. The bundled Codex binary and the Codex harness are unchanged. Tradeoff: openclaw#113615 aligned this value with the bundled Codex pin. Reporting a newer version can list a model whose protocol the current build does not handle yet; that model then fails on its first turn instead of being hidden. We chose visible-and-explainable over silently missing. This is the same tradeoff Hermes makes (it reports `99.0.0`); a real published version is more honest and avoids out-of-sequence version handling on the backend. ## Evidence **Backend behavior (real ChatGPT account, token kept in the browser):** visible models by `client_version`: | `client_version` | `gpt-6.1-sol` listed | |---|---| | `0.158.0` (2026.9.8 pin) | no | | `0.160.0` (current pin) | yes | | `0.161.0` (npm `latest`) | yes | **Real CLI flow** (`pnpm openclaw --profile <isolated> models list --provider openai --refresh --plain`, ChatGPT OAuth profile). To make the run discriminating, the fallback pin was temporarily set to `0.158.0` in a throwaway edit (reverted): - npm reachable → `openai/gpt-6.1-sol` listed (npm `latest` 0.161.0 wins over the old pin). - npm lookup forced to fail → `openai/gpt-6.1-sol` missing (falls back to the old pin). **Real npm lookup through the guarded fetch:** first call returned `.../models?client_version=0.161.0` in 356 ms; the second call hit the cache in 0 ms. **Tests:** new unit tests cover the npm version, cache reuse and expiry, shared in-flight request, fallback on HTTP error / prerelease / older-than-pin, keeping the last npm version when a later refresh fails, and the 5-minute failure retry. Existing OpenAI discovery tests pass with the resolver isolated. `node scripts/check-changed.mjs` passes. No overlap with Pash/Sarah changes: `a9c35f3d0f6` (openclaw#127394) touches `openai-provider.test.ts` for account-model routing, not discovery versioning. **Merge danger:** two-way door. No stored state, config, or schema change; a revert restores the pinned version. Blast radius: ChatGPT-login model discovery only. Worst case, a model that the current build cannot drive appears in the list and fails on its first turn. Co-authored-by: Ayaan Zaidi <[email protected]>
|
Follow-up: reverted in #167633. With ChatGPT login the default runtime is the bundled Codex harness, which reports its own (pinned) version on every turn, so advertising npm's newer version could list models that the default runtime then rejects. |
…cts (#167633) Reverts #167387. ## What Problem This Solves Fixes: with ChatGPT login, the model picker can list a model that then fails with HTTP 400 on the default runtime, when npm's newest Codex is ahead of OpenClaw's bundled Codex. ## User Impact User impact: ChatGPT-login model discovery again reports the bundled Codex version (`0.160.0`), so it lists only models the bundled Codex can run. New ChatGPT models appear when the bundled Codex pin moves, as before #167387. ## Why This Change Was Made #167387 made discovery report npm's latest stable `@openai/codex` version. With ChatGPT login and `agentRuntime` unset/`auto`, turns on the official ChatGPT endpoint run on the Codex harness with the bundled, pinned binary (`docs/providers/openai/runtimes.md`). That binary reports its own version on each turn, and the backend gates models on it. So a model whose minimum Codex version is above the pin is listed but rejected. This is the 2026.9.8 GPT-6.1 failure (bundled 0.158.0, model needs ≥ 0.159.2) for the next gated model. Codex's own discovery also reports the real package version (`client_version_to_whole()` in `codex-rs/models-manager`). This restores the alignment contract from #113615 (discovery version = bundled Codex version, guarded by `test/scripts/codex-client-version-contract.test.ts`). Hermes reports `99.0.0`, but its default ChatGPT runtime talks to the backend directly and its Codex app-server mode is opt-in with a user-managed binary, so the same trade does not fit OpenClaw's default. No failing model was observed: all currently listed ChatGPT models need Codex ≤ 0.155. This removes a reachable failure, not a reported one. ## Evidence - Clean `git revert` of 41a8839; the bundled pin is still `0.160.0`, so the restored constant matches and the contract test passes. - `openai-provider`, `openai-codex-discovery`, `openai-model-discovery-auth-order` and `codex-client-version-contract` tests pass. **Merge danger:** two-way door. No stored state, config or schema. Blast radius: ChatGPT-login model discovery; models gated above the bundled Codex version stop appearing until the pin moves. Co-authored-by: Ayaan Zaidi <[email protected]>
…cts (openclaw#167633) Reverts openclaw#167387. ## What Problem This Solves Fixes: with ChatGPT login, the model picker can list a model that then fails with HTTP 400 on the default runtime, when npm's newest Codex is ahead of OpenClaw's bundled Codex. ## User Impact User impact: ChatGPT-login model discovery again reports the bundled Codex version (`0.160.0`), so it lists only models the bundled Codex can run. New ChatGPT models appear when the bundled Codex pin moves, as before openclaw#167387. ## Why This Change Was Made openclaw#167387 made discovery report npm's latest stable `@openai/codex` version. With ChatGPT login and `agentRuntime` unset/`auto`, turns on the official ChatGPT endpoint run on the Codex harness with the bundled, pinned binary (`docs/providers/openai/runtimes.md`). That binary reports its own version on each turn, and the backend gates models on it. So a model whose minimum Codex version is above the pin is listed but rejected. This is the 2026.9.8 GPT-6.1 failure (bundled 0.158.0, model needs ≥ 0.159.2) for the next gated model. Codex's own discovery also reports the real package version (`client_version_to_whole()` in `codex-rs/models-manager`). This restores the alignment contract from openclaw#113615 (discovery version = bundled Codex version, guarded by `test/scripts/codex-client-version-contract.test.ts`). Hermes reports `99.0.0`, but its default ChatGPT runtime talks to the backend directly and its Codex app-server mode is opt-in with a user-managed binary, so the same trade does not fit OpenClaw's default. No failing model was observed: all currently listed ChatGPT models need Codex ≤ 0.155. This removes a reachable failure, not a reported one. ## Evidence - Clean `git revert` of 5859153; the bundled pin is still `0.160.0`, so the restored constant matches and the contract test passes. - `openai-provider`, `openai-codex-discovery`, `openai-model-discovery-auth-order` and `codex-client-version-contract` tests pass. **Merge danger:** two-way door. No stored state, config or schema. Blast radius: ChatGPT-login model discovery; models gated above the bundled Codex version stop appearing until the pin moves. Co-authored-by: Ayaan Zaidi <[email protected]>
Related: #157920
What Problem This Solves
Fixes: new ChatGPT-login models stay hidden from
/modelsuntil an OpenClaw release, because model discovery reports a hard-coded Codex client version.User Impact
User impact: with ChatGPT login, models that need a newer Codex client appear in the model list once that Codex version is published to npm, with no OpenClaw release.
Example: 2026.9.8 reports
client_version=0.158.0, so the ChatGPT backend hidesgpt-6.1-sol. With this change, OpenClaw reports0.161.0(current npmlatest) and the model appears.Why This Change Was Made
ChatGPT model discovery now asks npm for
@openai/codex'slateststable version and sends it asclient_version.registry.npmjs.org, through the SSRF guard, with a 5 s timeout.0.160.0, unchanged contract test) if it never got one, and retries after 5 minutes.Tradeoff: #113615 aligned this value with the bundled Codex pin. Reporting a newer version can list a model whose protocol the current build does not handle yet; that model then fails on its first turn instead of being hidden. We chose visible-and-explainable over silently missing. This is the same tradeoff Hermes makes (it reports
99.0.0); a real published version is more honest and avoids out-of-sequence version handling on the backend.Evidence
Backend behavior (real ChatGPT account, token kept in the browser): visible models by
client_version:client_versiongpt-6.1-sollisted0.158.0(2026.9.8 pin)0.160.0(current pin)0.161.0(npmlatest)Real CLI flow (
pnpm openclaw --profile <isolated> models list --provider openai --refresh --plain, ChatGPT OAuth profile). To make the run discriminating, the fallback pin was temporarily set to0.158.0in a throwaway edit (reverted):openai/gpt-6.1-sollisted (npmlatest0.161.0 wins over the old pin).openai/gpt-6.1-solmissing (falls back to the old pin).Real npm lookup through the guarded fetch: first call returned
.../models?client_version=0.161.0in 356 ms; the second call hit the cache in 0 ms.Tests: new unit tests cover the npm version, cache reuse and expiry, shared in-flight request, fallback on HTTP error / prerelease / older-than-pin, keeping the last npm version when a later refresh fails, and the 5-minute failure retry. Existing OpenAI discovery tests pass with the resolver isolated.
node scripts/check-changed.mjspasses.Merge danger: two-way door. No stored state, config, or schema change; a revert restores the pinned version. Blast radius: ChatGPT-login model discovery only. Worst case, a model that the current build cannot drive appears in the list and fails on its first turn.