fix(openai): new ChatGPT subscription models missing until an OpenClaw release (#201130) ## What Problem This Solves Fixes: new OpenAI models (for example GPT-6.2) do not appear in the picker for ChatGPT subscription logins until a new OpenClaw release ships. ## User Impact User impact: a newly launched OpenAI subscription model appears in the picker within six hours of OpenAI publishing the Codex release that supports it, without an OpenClaw update. The OpenClaw harness runs it at once. A Codex-harness turn on a model its Codex binary is too old for now fails with a clear message: `<model> needs a newer Codex than <version>. Update your global Codex with "npm i -g @openai/codex", then restart the Gateway. Or choose another model.` In Control UI, that failure offers **Start a new session**: a session on the OpenClaw harness, same agent and model, that asks the agent to run the update. OpenClaw itself never installs or updates Codex. Channels show the text instructions. ## Why This Change Was Made ChatGPT's subscription model list (`/backend-api/codex/models`) hides each model from clients whose `client_version` is below the model's minimum Codex version. OpenClaw reported its bundled or installed Codex version, so every new model waited for an OpenClaw release (or a manual Codex upgrade plus restart). The OpenAI plugin now lists as the newest stable `@openai/codex` on npm, cached for six hours and never below the bundled pin. If the registry read fails, it lists as the bundled pin and retries on the next listing. The Codex harness still runs only its own binary. When that binary is too old, the native `model_not_found` error becomes the actionable message above, at the one existing mapping point (`resolveCodexPromptError`). Compared with the reverted #200811 (`client_version=99.0.0`): this reports a real published Codex version, so it lists only models some released Codex can run, and the update instructions always resolve the failure. The shared tradeoff (a Codex harness older than npm latest can see a model it cannot run) is intentional; `src/plugins/AGENTS.md` and `src/agents/AGENTS.md` now state it. The Codex error is a host-owned `AgentHarnessRuntimeUpdateRequiredError` (code `harness_update_required`), which the run-failure notice keeps so Control UI can offer the new session. The update instruction names the Codex the turn ran: global npm (`npm i -g @openai/codex`), the ChatGPT desktop app's Codex (desktop-first), the path set by `plugins.entries.codex.config.appServer.command` or `OPENCLAW_CODEX_APP_SERVER_BIN`, or the remote app-server. A new session started from an incognito conversation is incognito too. This removes the earlier "report the selected Codex binary" path: the parent-to-worker version handoff, the private-local SDK facade `plugin-sdk/codex-client-version-runtime`, and `extensions/codex/client-version-api.ts`. Net: 60 files, +1205 / −936 against the merge base; about 350 of those lines are existing tests moved verbatim to a sibling file. Control UI chat boot: base `6ec27bd739c7` is already over the request ceiling (21 requests > 20, 1,331,855 B gzip); this change adds 198 B gzip and no request. The new session's creation code loads lazily through the existing `createSession` runtime import. ## Evidence - **Focused tests (green on the final head):** `extensions/openai/openai-codex-discovery.test.ts`, `extensions/openai/openai-provider.test.ts`, `extensions/openai/openai-provider.codex-catalog.test.ts` (ChatGPT OAuth catalog cases moved verbatim from `openai-provider.test.ts` for the line cap), `extensions/openai/base-url.test.ts`, `extensions/codex/src/app-server/event-projector.terminal-errors.test.ts` (also red on the merge base), `extensions/codex/src/app-server/managed-binary.test.ts`, `extensions/codex/src/app-server/bounded-turn.test.ts`, `extensions/codex/src/app-server/isolated-completion.native.test.ts`, `src/agents/prepared-model-catalog-worker.test.ts`, `test/scripts/codex-client-version-contract.test.ts`. `tsgo:core`, `tsgo:extensions`, `tsgo:extensions:test` pass. - **Red on base, green with fix:** `src/plugins/contracts/provider-live-listing.contract.test.ts` › "OpenAI subscription models list and run without a release" fails on the merge base (`expected [] to include 'contract-probe-chat-1'`) and passes on this branch. - **End to end, isolated Gateway from source with a real ChatGPT login:** - Model-list URL resolved to `…/models?client_version=0.170.0` (npm latest at test time; bundled pin is 0.169.0). - `models.list` showed `gpt-6.2-astra` and `gpt-6.2-sol` for an OpenClaw-harness agent and a Codex-harness agent. - A real `openai/gpt-6.2-sol` turn returned `ok` on each harness; session entries record `agentHarnessId` `openclaw` and `codex`. - With an explicit Codex 0.164.0 app-server binary, the Codex-harness turn failed with: `gpt-6.2-sol needs a newer Codex than 0.164.0. Update your global Codex with "npm i -g @openai/codex", then restart the Gateway. Or choose another model.` - **Start a new session, end to end** (same Gateway, Codex 0.164.0, real Control UI). The before shot is from the unchanged base UI `6ec27bd739c7`; after shots are from this branch's build: - Before: the update failure offers only Try again. - After: the same failure offers **Start a new session**. Clicking it opened a session on the OpenClaw harness with `gpt-6.2-sol`; the agent ran the update with its normal exec tool, reported `codex-cli 0.170.0`, and said the Gateway must restart to select it. - **Focused tests for the button and notice:** `ui/src/pages/chat/components/chat-run-failure-notice.test.ts` (10), `src/sessions/session-run-error.test.ts` (10), `extensions/codex/src/app-server/event-projector.terminal-errors.test.ts` (41), `src/gateway/server-chat.native-provider-error.test.ts` (7). `tsgo:core`, `tsgo:ui`, `tsgo:extensions`, `tsgo:extensions:test`, oxlint and the line-cap ratchet pass on `670e3c7a8e`. Co-authored-by: Ayaan Zaidi <hi@obviy.us>





