Skip to content

fix(openai): new ChatGPT-login models stay hidden until an OpenClaw release - #167387

Merged
obviyus merged 2 commits into
mainfrom
fix/codex-latest-client-version
Oct 8, 2026
Merged

obviyus merged 2 commits into
mainfrom
fix/codex-latest-client-version

Conversation

@obviyus

@obviyus obviyus commented Oct 8, 2026 •

Copy link
Copy Markdown
Collaborator

Related: #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: #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.

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.

@clawsweeper

clawsweeper Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 8, 2026
@clawsweeper

clawsweeper Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed October 8, 2026, 2:47 PM ET / 18:47 UTC (Revision 3).

ClawSweeper review

What this changes

ChatGPT-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.

  • Before: Discovery reports client_version=0.160.0, which already exposes gpt-6.1-sol for the tested account.
  • After: Discovery reports npm’s 0.161.0 without upgrading the bundled runtime, allowing the backend to return models eligible for that version.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, correctly scoped change with real CLI proof and an explicitly accepted compatibility tradeoff.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The fully inspected body records real ChatGPT OAuth discovery through the shipped CLI, with npm success versus forced failure distinguishing model visibility under a disclosed temporary old fallback. This proves the changed discovery path, not universal inference compatibility; that limitation is explicitly accepted. No stored-data contract changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Feature · Worth it: Yes
User problem: New account models can remain absent from the picker while OpenClaw reports an older bundled Codex version.
Reason: This intentionally changes the existing compatibility policy rather than repairing a demonstrated current-main mismatch. The area-owner decision accepts fresher visibility and its possible first-turn failures.

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
Reviewed head: a8e547aaf25d3918bcd0d9d8cadc3782585bb1c9

Before merge

None.

Findings

None.

Agent review details

How this fits together

The 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]
Loading

Technical review

Best 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

Testing

Proof path: shipped entry point. Added test files: 5.

Security

None.

Evidence

What I checked:

Likely related people:

  • obviyus: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • vincentkoc: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

PR surface

Source +110, Tests +112. Total +222 across 7 files.

View PR surface stats
Area Files Added Removed Net
Source 2 116 6 +110
Tests 5 134 22 +112
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 7 250 28 +222

Labels

Label changes:

  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.

Label justifications:

  • P2: This is a bounded model-discovery improvement without an established urgent current-main regression.
  • merge-risk: 🚨 auth-provider: Discovery can offer models unsupported by the executing client; the recorded area-owner decision explicitly accepts this tradeoff.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only; repair and merge need explicit maintainer commands such as @clawsweeper autofix or @clawsweeper automerge.

History

Review history (2 earlier review cycles)
  • reviewed 2026-10-08T18:25:04.107Z sha 55e28fb :: blocked before merge. :: none
  • reviewed 2026-10-08T18:35:01.067Z sha a8e547a :: blocked before merge. :: none

@obviyus
obviyus marked this pull request as ready for review October 8, 2026 18:27
@obviyus

obviyus commented Oct 8, 2026

Copy link
Copy Markdown
Collaborator Author

Maintainer decision: ChatGPT model discovery should advertise npm's newest stable @openai/codex version, not the bundled pin.

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

@clawsweeper

clawsweeper Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Oct 8, 2026
@obviyus
obviyus merged commit 41a8839 into main Oct 8, 2026
104 of 106 checks passed
@obviyus
obviyus deleted the fix/codex-latest-client-version branch October 8, 2026 19:10
@obviyus

obviyus commented Oct 8, 2026

Copy link
Copy Markdown
Collaborator Author

Landed in 41a8839. ChatGPT-login model discovery now reports npm's newest stable @openai/codex version (cached 6 h, keeps the last good version on failure, bundled pin as first-run fallback), so models gated on a newer Codex client show up without an OpenClaw release. Proof: real models list --refresh with a ChatGPT login listed gpt-6.1-sol with npm reachable and hid it with npm forced to fail against an old pin.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 9, 2026
…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]>
@obviyus

obviyus commented Oct 9, 2026

Copy link
Copy Markdown
Collaborator Author

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.

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

Labels

extensions: openai merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. P2 Normal backlog priority with limited blast radius. 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