Skip to content

fix(openai): list ChatGPT models with the OpenClaw release version - #202380

Merged
obviyus merged 1 commit into
mainfrom
fix/codex-client-version-persisted
Nov 20, 2026
Merged

obviyus merged 1 commit into
mainfrom
fix/codex-client-version-persisted

Conversation

@obviyus

@obviyus obviyus commented Nov 20, 2026

Copy link
Copy Markdown
Collaborator

Supersedes #202284. Restores the approach of #201493. Related: #201130.

What Problem This Solves

ChatGPT subscription model discovery calls /backend-api/codex/models?client_version=<X>, and the backend hides every model whose minimal_client_version is above X. On main (#202284), X comes from a lookup of the latest @openai/codex on npm, cached in memory for six hours. That puts a registry request (1 s budget) on the model-listing path. A failed or slow lookup lists at the bundled 0.169.0 floor and can hide newly launched models. The in-memory cache also does not survive a restart or eviction.

Solution

  • List with the OpenClaw release that OpenClaw-harness Responses turns already send as the version header (provider attribution). The list and the turn use one value from one owner.
  • Send only the numeric YYYY.M.P part (year 2026 or later). For example, 2026.11.5-beta.1 lists as 2026.11.5. Anything else (unknown, 0.0.0-dev, a bad OPENCLAW_VERSION override, or a proxy without attribution headers) lists as 99.0.0.
  • Treat an empty subscription list as a failed listing. A ChatGPT account always has models, so an empty 200 response keeps the last good rows instead of replacing them. API-key access-program discovery, where an empty list is valid, is unchanged.
  • Delete the npm lookup, the six-hour cache, the 0.169.0 floor, the floor contract test, and the test mocks that existed only for them. Production: +19 / −74 lines.
  • Keep the Responses version header unchanged. Keep Codex binary selection and update behavior unchanged.

Why this replaces the earlier designs:

Accepted edge cases (code comment in base-url.ts):

I also considered an omp-style background npm refresh with persistence (oh-my-pi codex-version.ts). Plugin keyed state is unavailable in the catalog worker threads where discovery runs (Shared-state admission requires the host broker). An in-memory variant still needed a network request and reset to the floor on every restart.

User Impact

  • ChatGPT subscription users see newly launched models without an OpenClaw release, without a network lookup, and without depending on npm availability.
  • Listing makes one request: the ChatGPT /models call.
  • A transient empty model list from ChatGPT no longer clears the model picker.

Evidence

  • Red on main, green on the fix (extensions/openai/openai-codex-discovery.test.ts):
    • The version-table cases fail on main, which makes two requests (npm, then /models). The fix makes exactly one, to chatgpt.com, with the expected client_version.
    • The empty-list case fails on main (expected ['ready'] to deeply equal ['unavailable']) and passes on the fix.
    • Main result: 14 of 16 failed (the 2 GPT-6.1 Sol cases pass on both).
  • Focused suites green: openai-codex-discovery, openai-provider, openai-provider.codex-catalog, openai-api-key-catalog, platform-access-programs, base-url, src/plugins/contracts/provider-live-listing.contract.test.ts, test/openai-model-discovery-auth-order.test.ts, test/model-account-catalog-authority.integration.test.ts.
  • Live, real ChatGPT Pro login (2026-11-18 probe):
    • client_version 2026.11.5, 0.166.0, 0.169.0 and 99.0.0 return the same 13 models, including gpt-6.2-sol and gpt-6.2-astra (minimal_client_version 0.166.0).
    • 0.164.0 and 0.165.0 hide GPT-6.2. 0.0.0 returns a frozen legacy list of 7 models.
    • /responses with version: 2026.11.5 on gpt-6.2-sol returns 200.
  • End to end on this branch (isolated Gateway from source, fresh ChatGPT device-code login, nothing live touched):
    • models.list returned 11 subscription models with outcome ready, including gpt-6.2-sol (1.05M context) and gpt-6.2-astra.
    • The Gateway log shows no registry.npmjs.org request.
    • A real turn on openai/gpt-6.2-sol returned CXV_OK2.
    • The same account listed identical models at 0.169.0 and 0.171.0 earlier today. No live model is currently gated between the bundled pin and npm latest, so the "floor hides a model" case was proven in tests, not live.
  • Not proven live: a Gateway with OPENCLAW_VERSION=unknown (the dev tooling strips OPENCLAW_*). The version table covers that fallback.

Merge Risk

Two-way door: no state, schema, config or published contract changes, and a revert fully restores the npm lookup. Blast radius: ChatGPT subscription model listing for OpenAI OAuth and token profiles. API-key listing, Responses headers and Codex binary selection are unchanged.

@clawsweeper

clawsweeper Bot commented Nov 20, 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.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation scripts Repository scripts extensions: openai size: M labels Nov 20, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. 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. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 20, 2026
@clawsweeper

clawsweeper Bot commented Nov 20, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR lists ChatGPT subscription models using the numeric OpenClaw release version and treats empty subscription responses as failed discovery.

Example: OpenClaw 2026.11.5-beta.1 refreshes a ChatGPT subscription catalog while npm is unavailable.

  • Before: Discovery attempts npm and falls back to client_version=0.169.0, potentially hiding newer models.
  • After: Discovery requests ChatGPT directly with client_version=2026.11.5.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, useful patch supported by supplied real Gateway results and targeted regression evidence.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (live_output): The supplied branch-specific isolated Gateway results exercise real ChatGPT authentication, subscription discovery without npm traffic, catalog publication, and a successful model turn; controlled regressions cover fallback parsing and empty-response classification.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Registry delays or failures can make newly launched subscription models remain hidden despite a healthy ChatGPT model endpoint.
Reason: The maintainer-authored direction is supported by authenticated endpoint observations and removes a failure dependency while explicitly accepting discovery ahead of older runtime support.

Merge readiness

✅ Ready for maintainer review

Keep open: this maintainer-authored PR removes an unnecessary discovery dependency with a focused implementation and no actionable correctness findings; current-head CI is still finishing.

Priority: P2
Reviewed head: d16164c3685cccc62a18da3c5e8ff38e3b936e2c

Before merge

None.

Findings

None.

Agent review details

How this fits together

The OpenAI plugin converts authenticated ChatGPT model responses into account-scoped Gateway catalog rows; the existing publication owner retains previous rows after failed discovery.

flowchart TD
  A[OpenClaw version attribution] --> B[OpenAI endpoint resolver]
  B --> C[Authenticated ChatGPT model request]
  C --> D[Plugin catalog outcome]
  D --> E[Gateway catalog publication]
  E --> F[Model picker and agent turns]
Loading

Technical review

Best possible solution:

Use the existing attribution version owner for subscription discovery and the existing catalog publication owner for failed-list retention.

Do we have a high-confidence way to reproduce the issue?

Current-main source establishes the npm lookup and bundled-version fallback; the body reports red-on-main discovery tests, while acknowledging that no currently available model distinguishes the bundled floor from npm latest.

Is this the best way to solve the issue?

The patch is a small, complete cutover that removes the redundant resolver and reuses existing attribution and failure-publication contracts without adding state or configuration.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against a030cff0d8c3.

Provenance checked

  • Subscription discovery version selection changes intended behavior with a stated reason (b9d3c00: Report a version from the Codex release stream, with a bundled floor and bounded registry lookup.)
  • Empty subscription discovery outcome changes intended behavior with a stated reason (625945b: The provider catalog owner distinguishes authoritative discovery from unavailable discovery; successful empty results previously reached the ready outcome.)
  • Codex version contracts, fixtures, and documentation changes intended behavior with a stated reason (b9d3c00: Keep the bundled floor aligned with the dependency and isolate the npm request in catalog tests.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

  • Pinned introduction: The introduced diff replaces the npm resolver, removes its cache-specific tests and fixtures, updates documentation, and adds the empty-response failure classification. (extensions/openai/base-url.ts:12, d16164c3685c)
  • Current-main behavior: Fetched main still calls the npm-backed Codex client-version resolver, so the central change is not already implemented there. (extensions/openai/base-url.ts:8, a030cff0d8c3)
  • Existing retention owner: Failed provider outcomes retain previously accepted catalog entries when the credential and profile identity still match; the new empty-response check uses that existing mechanism. (src/agents/prepared-model-runtime.catalog-publication.ts:216, d16164c3685c)
  • Direction and supplied live results: The collaborator-authored body reports an isolated source Gateway with fresh ChatGPT authentication, successful models.list results, no npm request, and a real turn returning CXV_OK2; it explicitly accepts older-runtime and future-model compatibility tradeoffs. (d16164c3685c)
  • Prior implementation and credit: fix: keep ChatGPT model discovery independent of npm #201493 previously removed npm dependence and credits daniel-lxs; his discussion supplies authenticated Gateway output with npm blocked. fix: list ChatGPT models with a Codex client version #202284 intentionally restored Codex-version reporting, which this PR explicitly replaces with supporting live observations. (779c260b2e8a)
  • Personally inspected Codex contract: The sibling Codex source constructs the models request with client_version and strips prerelease components from its native version; it does not establish the backend's filtering implementation, for which the supplied authenticated probes provide evidence. (codex-rs/codex-api/src/endpoint/models.rs:37, d32063f96c2dff1dc96af839b3952abb6acfeda4)

Likely related people:

  • Ayaan Zaidi: Raw commit 1680f54 adds extensions/openai/base-url.ts:7 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 1680f5450480; files: extensions/openai/base-url.ts)
  • Josh Avant: Raw commit b9d3c00 adds extensions/openai/openai-provider.test.ts:1 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: b9d3c00e4f91; files: extensions/openai/openai-provider.test.ts)
  • Vincent Koc: Raw commit 625945b adds extensions/openai/openai-provider-catalog.ts:126 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 625945b7ae01; files: extensions/openai/openai-provider-catalog.ts)

PR surface

Source -55, Tests -160, Docs +1. Total -214 across 15 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 3 19 74 -55
Tests 9 38 198 -160
Docs 3 13 12 +1
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 15 70 284 -214

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Labels

Label changes:

  • add P2: This improves subscription model discovery availability and removes avoidable registry latency with a limited provider-specific scope.
  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P2: This improves subscription model discovery availability and removes avoidable registry latency with a limited provider-specific scope.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • 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 execution lanes are retired.

Reviewed November 20, 2026, 4:22 AM ET / 09:22 UTC.

@obviyus
obviyus merged commit 7d1d7d0 into main Nov 20, 2026
151 checks passed
@obviyus
obviyus deleted the fix/codex-client-version-persisted branch November 20, 2026 09:24
@obviyus

obviyus commented Nov 20, 2026

Copy link
Copy Markdown
Collaborator Author

Landed in 7d1d7d0.

  • Bug: ChatGPT subscription listing waited on an npm lookup, and fell back to the bundled Codex version when the lookup failed, which could hide newly launched models.
  • Fix: list with the numeric OpenClaw release that Responses turns already send (99.0.0 fallback), with no npm request. An empty subscription list now keeps the last good models.
  • Proof: tests fail on main and pass here. An isolated Gateway signed in with ChatGPT listed GPT-6.2, made no npm request, and ran a real gpt-6.2-sol turn. Local ClawSweeper review is ready and CI is green.

Thanks to @daniel-lxs for the #201493 design this restores.

obviyus added a commit that referenced this pull request Nov 20, 2026
… header (#202427)

Follow-up to #202380.

## What Problem This Solves

ChatGPT gates subscription models in two places: the `/codex/models?client_version=` listing and the `version` header on `/responses` turns. Since #202380 the listing sends the numeric OpenClaw release (`YYYY.M.P`, falling back to `99.0.0`), but OpenClaw-harness turns still send the raw runtime version. Prerelease and dev builds therefore send values the backend has never been probed with (`2026.11.5-beta.1`) or that likely fail the model gate (`unknown`, `0.0.0-dev`). Then a model can be listed but its turn rejected. On 2026-11-18, a turn with `version: 0.164.0` returned HTTP 400 for `gpt-6.2-sol`.

## Solution

- Provider attribution now owns the ChatGPT gate value. For the `openai` provider, the `version` header is the numeric release (year 2026 or later), or `99.0.0`.
- `User-Agent` keeps the full build (`openclaw/2026.11.5-beta.1`), so OpenAI still sees the real version. It is not a gate input.
- `extensions/openai/base-url.ts` reads that header for `client_version` instead of repeating the rule, so the list and the turn send the same value by construction.
- Other providers keep their headers unchanged, including xAI, which shares the OpenAI header shape.
- Codex-harness turns are unchanged: the Codex binary sends its own version.

## User Impact

- Stable releases: no change. `2026.11.5` was already numeric.
- Beta builds: turns send `2026.11.5` instead of `2026.11.5-beta.1`.
- Dev and source builds without a calendar version: turns send `99.0.0` instead of a placeholder. Turns on newly launched models then pass the same gate as the listing.

## Evidence

- **Red on main, green on the fix:** `src/agents/provider-attribution.test.ts` › "sends ChatGPT the numeric OpenClaw release …". On main, 4 of 5 cases fail (`2026.11.5-beta.1`, `2026.11.5-1+build.abc`, `unknown`, `0.0.0-dev`); the plain `2026.11.5` case passes on both. Each case also checks that `User-Agent` keeps the full build.
- **Consumers green:** `provider-attribution`, `agent-tools.prefix-stability`, `openai-transport-stream.base`, `stream-wrappers/openai`, `openai-codex-discovery`, `provider-live-listing.contract`, OpenAI TTS, realtime browser auth and device-code tests.
- **Gates:** `tsgo:core`, `tsgo:extensions` and `check:test-types` pass. `ocx build --dts` and the packed release smoke (`scripts/release-check.ts`) pass.
- **End to end** (isolated Gateway from source, fresh ChatGPT device-code login): `models.list` returned 11 subscription models with outcome `ready`, including `gpt-6.2-sol` and `gpt-6.2-astra`. A real turn on `openai/gpt-6.2-sol` returned `NVH_OK`.
- **Live values:** the 2026-11-18 probe with a real ChatGPT login returned HTTP 200 on `/responses` for `gpt-6.2-sol` with `version` set to `2026.11.5` and to `99.0.0`, the only two shapes this change sends.
- **Not proven live:** a beta or dev runtime version. The dev tooling strips `OPENCLAW_*` from the Gateway environment, so the source Gateway reported the stable `2026.11.5`. The attribution test covers those inputs.

## Merge Risk

Two-way door: no state, config or contract changes, and a revert restores the raw header. Blast radius: the `version` header on OpenAI-provider requests (ChatGPT and platform routes) for prerelease and dev builds. Stable builds send identical headers.

Co-authored-by: Ayaan Zaidi <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 21, 2026
…penclaw#202380)

Supersedes openclaw#202284. Restores the approach of openclaw#201493. Related: openclaw#201130.

## What Problem This Solves

ChatGPT subscription model discovery calls `/backend-api/codex/models?client_version=<X>`, and the backend hides every model whose `minimal_client_version` is above X. On main (openclaw#202284), X comes from a lookup of the latest `@openai/codex` on npm, cached in memory for six hours. That puts a registry request (1 s budget) on the model-listing path. A failed or slow lookup lists at the bundled 0.169.0 floor and can hide newly launched models. The in-memory cache also does not survive a restart or eviction.

## Solution

- List with the OpenClaw release that OpenClaw-harness Responses turns already send as the `version` header (provider attribution). The list and the turn use one value from one owner.
- Send only the numeric `YYYY.M.P` part (year 2026 or later). For example, `2026.11.5-beta.1` lists as `2026.11.5`. Anything else (`unknown`, `0.0.0-dev`, a bad `OPENCLAW_VERSION` override, or a proxy without attribution headers) lists as `99.0.0`.
- Treat an empty subscription list as a failed listing. A ChatGPT account always has models, so an empty 200 response keeps the last good rows instead of replacing them. API-key access-program discovery, where an empty list is valid, is unchanged.
- Delete the npm lookup, the six-hour cache, the 0.169.0 floor, the floor contract test, and the test mocks that existed only for them. Production: +19 / −74 lines.
- Keep the Responses `version` header unchanged. Keep Codex binary selection and update behavior unchanged.

Why this replaces the earlier designs:
- openclaw#201130 and openclaw#202284 needed a network request for a value the backend only compares numerically. Any version at or above a model's minimum shows the model.
- Peer clients hardcode a value for the same reason: Hermes `99.0.0`, Zed `0.999.0`, Crush `999.0.0`.
- openclaw#202284's concern was that an OpenClaw version goes into a Codex-version parameter. The same value already passes the same gate on every Responses turn, and an npm-latest value does not describe the binary that runs a turn either.
- A version starting with 2026 stays above every Codex 0.x release, so new models appear on launch day without a lookup.
- The version check is stricter than openclaw#201493's: suffixes are dropped instead of sent, because no live probe has tested a prerelease string.

Accepted edge cases (code comment in `base-url.ts`):
- A Codex-harness binary older than a listed model fails that turn with the existing update instructions and **Start a new session** (openclaw#201130). npm-latest had the same tradeoff.
- An old OpenClaw release can list a future model whose request shape it does not support yet. Every fixed-version and npm-latest approach has this.

I also considered an omp-style background npm refresh with persistence (oh-my-pi `codex-version.ts`). Plugin keyed state is unavailable in the catalog worker threads where discovery runs (`Shared-state admission requires the host broker`). An in-memory variant still needed a network request and reset to the floor on every restart.

## User Impact

- ChatGPT subscription users see newly launched models without an OpenClaw release, without a network lookup, and without depending on npm availability.
- Listing makes one request: the ChatGPT `/models` call.
- A transient empty model list from ChatGPT no longer clears the model picker.

## Evidence

- **Red on main, green on the fix** (`extensions/openai/openai-codex-discovery.test.ts`):
  - The version-table cases fail on main, which makes two requests (npm, then `/models`). The fix makes exactly one, to chatgpt.com, with the expected `client_version`.
  - The empty-list case fails on main (`expected ['ready'] to deeply equal ['unavailable']`) and passes on the fix.
  - Main result: 14 of 16 failed (the 2 GPT-6.1 Sol cases pass on both).
- **Focused suites green:** `openai-codex-discovery`, `openai-provider`, `openai-provider.codex-catalog`, `openai-api-key-catalog`, `platform-access-programs`, `base-url`, `src/plugins/contracts/provider-live-listing.contract.test.ts`, `test/openai-model-discovery-auth-order.test.ts`, `test/model-account-catalog-authority.integration.test.ts`.
- **Live, real ChatGPT Pro login (2026-11-18 probe):**
  - `client_version` 2026.11.5, 0.166.0, 0.169.0 and 99.0.0 return the same 13 models, including `gpt-6.2-sol` and `gpt-6.2-astra` (`minimal_client_version` 0.166.0).
  - 0.164.0 and 0.165.0 hide GPT-6.2. 0.0.0 returns a frozen legacy list of 7 models.
  - `/responses` with `version: 2026.11.5` on `gpt-6.2-sol` returns 200.
- **End to end on this branch** (isolated Gateway from source, fresh ChatGPT device-code login, nothing live touched):
  - `models.list` returned 11 subscription models with outcome `ready`, including `gpt-6.2-sol` (1.05M context) and `gpt-6.2-astra`.
  - The Gateway log shows no `registry.npmjs.org` request.
  - A real turn on `openai/gpt-6.2-sol` returned `CXV_OK2`.
  - The same account listed identical models at 0.169.0 and 0.171.0 earlier today. No live model is currently gated between the bundled pin and npm latest, so the "floor hides a model" case was proven in tests, not live.
- **Not proven live:** a Gateway with `OPENCLAW_VERSION=unknown` (the dev tooling strips `OPENCLAW_*`). The version table covers that fallback.

## Merge Risk

Two-way door: no state, schema, config or published contract changes, and a revert fully restores the npm lookup. Blast radius: ChatGPT subscription model listing for OpenAI OAuth and token profiles. API-key listing, Responses headers and Codex binary selection are unchanged.

Co-authored-by: Daniel <[email protected]>
Co-authored-by: Ayaan Zaidi <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 21, 2026
… header (openclaw#202427)

Follow-up to openclaw#202380.

## What Problem This Solves

ChatGPT gates subscription models in two places: the `/codex/models?client_version=` listing and the `version` header on `/responses` turns. Since openclaw#202380 the listing sends the numeric OpenClaw release (`YYYY.M.P`, falling back to `99.0.0`), but OpenClaw-harness turns still send the raw runtime version. Prerelease and dev builds therefore send values the backend has never been probed with (`2026.11.5-beta.1`) or that likely fail the model gate (`unknown`, `0.0.0-dev`). Then a model can be listed but its turn rejected. On 2026-11-18, a turn with `version: 0.164.0` returned HTTP 400 for `gpt-6.2-sol`.

## Solution

- Provider attribution now owns the ChatGPT gate value. For the `openai` provider, the `version` header is the numeric release (year 2026 or later), or `99.0.0`.
- `User-Agent` keeps the full build (`openclaw/2026.11.5-beta.1`), so OpenAI still sees the real version. It is not a gate input.
- `extensions/openai/base-url.ts` reads that header for `client_version` instead of repeating the rule, so the list and the turn send the same value by construction.
- Other providers keep their headers unchanged, including xAI, which shares the OpenAI header shape.
- Codex-harness turns are unchanged: the Codex binary sends its own version.

## User Impact

- Stable releases: no change. `2026.11.5` was already numeric.
- Beta builds: turns send `2026.11.5` instead of `2026.11.5-beta.1`.
- Dev and source builds without a calendar version: turns send `99.0.0` instead of a placeholder. Turns on newly launched models then pass the same gate as the listing.

## Evidence

- **Red on main, green on the fix:** `src/agents/provider-attribution.test.ts` › "sends ChatGPT the numeric OpenClaw release …". On main, 4 of 5 cases fail (`2026.11.5-beta.1`, `2026.11.5-1+build.abc`, `unknown`, `0.0.0-dev`); the plain `2026.11.5` case passes on both. Each case also checks that `User-Agent` keeps the full build.
- **Consumers green:** `provider-attribution`, `agent-tools.prefix-stability`, `openai-transport-stream.base`, `stream-wrappers/openai`, `openai-codex-discovery`, `provider-live-listing.contract`, OpenAI TTS, realtime browser auth and device-code tests.
- **Gates:** `tsgo:core`, `tsgo:extensions` and `check:test-types` pass. `ocx build --dts` and the packed release smoke (`scripts/release-check.ts`) pass.
- **End to end** (isolated Gateway from source, fresh ChatGPT device-code login): `models.list` returned 11 subscription models with outcome `ready`, including `gpt-6.2-sol` and `gpt-6.2-astra`. A real turn on `openai/gpt-6.2-sol` returned `NVH_OK`.
- **Live values:** the 2026-11-18 probe with a real ChatGPT login returned HTTP 200 on `/responses` for `gpt-6.2-sol` with `version` set to `2026.11.5` and to `99.0.0`, the only two shapes this change sends.
- **Not proven live:** a beta or dev runtime version. The dev tooling strips `OPENCLAW_*` from the Gateway environment, so the source Gateway reported the stable `2026.11.5`. The attribution test covers those inputs.

## Merge Risk

Two-way door: no state, config or contract changes, and a revert restores the raw header. Blast radius: the `version` header on OpenAI-provider requests (ChatGPT and platform routes) for prerelease and dev builds. Stable builds send identical headers.

Co-authored-by: Ayaan Zaidi <[email protected]>
tideclaw-bot pushed a commit that referenced this pull request Nov 23, 2026
… header (#202427)

Follow-up to #202380.

ChatGPT gates subscription models in two places: the `/codex/models?client_version=` listing and the `version` header on `/responses` turns. Since #202380 the listing sends the numeric OpenClaw release (`YYYY.M.P`, falling back to `99.0.0`), but OpenClaw-harness turns still send the raw runtime version. Prerelease and dev builds therefore send values the backend has never been probed with (`2026.11.5-beta.1`) or that likely fail the model gate (`unknown`, `0.0.0-dev`). Then a model can be listed but its turn rejected. On 2026-11-18, a turn with `version: 0.164.0` returned HTTP 400 for `gpt-6.2-sol`.

- Provider attribution now owns the ChatGPT gate value. For the `openai` provider, the `version` header is the numeric release (year 2026 or later), or `99.0.0`.
- `User-Agent` keeps the full build (`openclaw/2026.11.5-beta.1`), so OpenAI still sees the real version. It is not a gate input.
- `extensions/openai/base-url.ts` reads that header for `client_version` instead of repeating the rule, so the list and the turn send the same value by construction.
- Other providers keep their headers unchanged, including xAI, which shares the OpenAI header shape.
- Codex-harness turns are unchanged: the Codex binary sends its own version.

- Stable releases: no change. `2026.11.5` was already numeric.
- Beta builds: turns send `2026.11.5` instead of `2026.11.5-beta.1`.
- Dev and source builds without a calendar version: turns send `99.0.0` instead of a placeholder. Turns on newly launched models then pass the same gate as the listing.

- **Red on main, green on the fix:** `src/agents/provider-attribution.test.ts` › "sends ChatGPT the numeric OpenClaw release …". On main, 4 of 5 cases fail (`2026.11.5-beta.1`, `2026.11.5-1+build.abc`, `unknown`, `0.0.0-dev`); the plain `2026.11.5` case passes on both. Each case also checks that `User-Agent` keeps the full build.
- **Consumers green:** `provider-attribution`, `agent-tools.prefix-stability`, `openai-transport-stream.base`, `stream-wrappers/openai`, `openai-codex-discovery`, `provider-live-listing.contract`, OpenAI TTS, realtime browser auth and device-code tests.
- **Gates:** `tsgo:core`, `tsgo:extensions` and `check:test-types` pass. `ocx build --dts` and the packed release smoke (`scripts/release-check.ts`) pass.
- **End to end** (isolated Gateway from source, fresh ChatGPT device-code login): `models.list` returned 11 subscription models with outcome `ready`, including `gpt-6.2-sol` and `gpt-6.2-astra`. A real turn on `openai/gpt-6.2-sol` returned `NVH_OK`.
- **Live values:** the 2026-11-18 probe with a real ChatGPT login returned HTTP 200 on `/responses` for `gpt-6.2-sol` with `version` set to `2026.11.5` and to `99.0.0`, the only two shapes this change sends.
- **Not proven live:** a beta or dev runtime version. The dev tooling strips `OPENCLAW_*` from the Gateway environment, so the source Gateway reported the stable `2026.11.5`. The attribution test covers those inputs.

Two-way door: no state, config or contract changes, and a revert restores the raw header. Blast radius: the `version` header on OpenAI-provider requests (ChatGPT and platform routes) for prerelease and dev builds. Stable builds send identical headers.

Co-authored-by: Ayaan Zaidi <[email protected]>
(cherry picked from commit e4c17c5)
Co-authored-by: RomneyDa <[email protected]>
(cherry picked from commit 0269488deb840641bce094c2d300bb0816ac3ab1)
(cherry picked from commit 412b23ea0b62464ec3180fcd9d1ad094f5439dd5)
maplel pushed a commit to maplel/openclaw that referenced this pull request Nov 24, 2026
…02427)

Use provider attribution as the single numeric calendar-version owner while
preserving the complete runtime version in User-Agent and xAI headers.

Release adaptation: preserve the baseline's full-string invalid-version
fallback; update its existing discovery table for numeric beta/build versions.
The upstream parser accepted an otherwise invalid suffix. No dependencies,
configuration, schema, or native Codex behavior change.

The five-input header regression fails four cases before the production fix.
Retain the existing invalid-version discovery cases and transport/prefix checks.
The 26 test lines exercise previously untested prerelease/development headers.

Companion audit: no later source-path fixes at pinned 96304dd. The preceding
openclaw#202380 numeric-listing prerequisite is subsumed by the baseline's existing
release-validation/listing helper and this single-owner cutover.

(cherry picked from commit e4c17c5)

Co-authored-by: RomneyDa <[email protected]>
(cherry picked from commit 605ad3b6381e3897383d487ec218a493438a7389)
(cherry picked from commit fab91bd61333d998ec941c9d77d14d49b9a67e2f)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation extensions: openai 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. scripts Repository scripts 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