Skip to content

fix(openai): align auth availability with effective routes - #104685

Merged
steipete merged 14 commits into
mainfrom
codex/openai-route-facts
Jul 11, 2026
Merged

steipete merged 14 commits into
mainfrom
codex/openai-route-facts

Conversation

@steipete

Copy link
Copy Markdown
Contributor

Closes #103150

What Problem This Solves

Fixes an issue where users configuring OpenAI, ChatGPT subscription, custom-endpoint, or routed provider models could see a model reported as available even though the selected credentials could not reach its effective backend, or reported unavailable despite valid route-specific credentials.

Why This Change Was Made

Provider-owned route facts now carry the effective API, endpoint, auth requirement, and prepared credential state through selection, model browsing, runtime execution, compaction, onboarding, doctor, and CLI status. Direct API-key and ChatGPT subscription routes remain distinct; custom endpoints fail closed against incompatible subscription credentials; runtime-only route details stay out of public model-list projections.

User Impact

OpenAI-family availability and execution now agree across the CLI, Gateway, model catalog, Android inventory consumer, and embedded-agent runtime. Valid resolved SecretRefs and AWS SDK-chain routes are recognized, while credentials for a different backend no longer make an incompatible route appear usable.

Evidence

  • Testbox-through-Crabbox tbx_01kx9cnxg0hj3p35zc4xfr2js9: 622 focused tests passed across route auth, catalog visibility, BTW/overflow compaction, Codex auth bridging, startup, shared-client, side-question, and run-attempt behavior.
  • Focused run: pnpm test over the seven agent routing suites and five Codex app-server suites; 38 unit-fast, 276 agent, and 308 extension tests passed.
  • Fresh autoreview: no accepted/actionable findings on the final rebase fixture adjustment; the full feature bundle had a clean autoreview before rebasing.
  • Source-blind behavior validation passed for direct, subscription, custom-endpoint, SecretRef, and routed-provider cases.
  • Exact-head GitHub CI and the repository-native hosted prepare gate are required before merge.

@steipete
steipete requested a review from a team as a code owner July 11, 2026 20:24
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui gateway Gateway runtime scripts Repository scripts commands Command implementations agents Agent runtime and tooling extensions: openai extensions: codex size: XL maintainer Maintainer-authored PR labels Jul 11, 2026
@clawsweeper

clawsweeper Bot commented Jul 11, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: stale review; fresh review needed.

Summary
The latest durable ClawSweeper review was for head c142c3684ca137aec365b2e44d2cfdc2f53df9e0, but the PR head is now 914ca2f439ba38351cf32c1098b22c0fbddb3f35. Its old verdict and PR readiness labels are no longer current.

Next step
Run or wait for a fresh ClawSweeper review on the current PR head.

Review history (5 earlier review cycles)
  • reviewed 2026-07-11T21:01:52.452Z sha ab5f53b :: needs real behavior proof before merge. :: [P1] Preserve external CLI auth for unmanaged providers
  • reviewed 2026-07-11T21:16:18.660Z sha c9cfe1cda9431204f0067dd6855265a991d5b08c :: needs maintainer review before merge. :: none
  • reviewed 2026-07-11T21:28:54.966Z sha aba21baee941d4522b3ae672ff5c6ab1cd3be400 :: found issues before merge. :: [P2] Type the compaction client factory before reading its arguments
  • reviewed 2026-07-11T21:42:36.681Z sha 73428ccc05d95ce27844a93565ef2c753783a87f :: needs changes before merge. :: [P1] Preserve external CLI auth for non-OpenAI route rows | [P1] Keep loopback models available under auth overrides | [P2] Restore provider-owned logical model identity | [P1] Reconcile implicit runtime selection with duplicate model config
  • reviewed 2026-07-11T21:51:00.827Z sha 73428ccc05d95ce27844a93565ef2c753783a87f :: found issues before merge. :: [P1] Preserve external CLI auth for non-OpenAI route rows | [P1] Keep loopback models available under auth overrides | [P2] Restore provider-owned logical model identity | [P1] Reconcile implicit runtime selection with duplicate model config

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1cea98595b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

params.allowPreparedRuntimeAuth === true ||
(params.discoverExternalCliAuth !== false && params.allowPluginSyntheticAuth !== false),
syntheticAuthProviderRefs: runtimeAuthLookup.syntheticAuthProviderRefs,
...(params.discoverExternalCliAuth === false ? {} : { externalCliProviderIds: ["openai"] }),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Include scoped external CLI providers in route auth checks

This hard-codes route-aware auth evaluation to overlay only OpenAI external CLI profiles. Because modelCatalogEntryHasProviderAuth now calls the checker with {modelId, api, baseUrl} for every catalog row, non-OpenAI entries no longer fall through to the legacy hasAuthForModelProvider path that used externalCliDiscoveryForProviderAuth({ provider }). With only a Claude CLI or Minimax CLI login, default/model-picker visibility evaluates against a store without those external profiles and hides or marks those models unauthenticated.

Useful? React with 👍 / 👎.

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. labels Jul 11, 2026
@steipete
steipete force-pushed the codex/openai-route-facts branch from ab5f53b to c9cfe1c Compare July 11, 2026 21:06
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Jul 11, 2026
@steipete
steipete force-pushed the codex/openai-route-facts branch from c9cfe1c to aba21ba Compare July 11, 2026 21:18

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: aba21baee9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +56 to +57
const available = authAvailabilityAuthoritative
? (authAvailability ?? null)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve local availability under auth overrides

When configured local-provider rows are marked auth-authoritative (for example, appendConfiguredProviderRows passes allowAuthAvailabilityOverride: true), this branch ignores modelIsAvailable, even though that already treats loopback/local baseUrl rows as runnable without registry auth. For a configured custom local provider with a local base URL and no API key, the auth resolver reports synthetic/unknown availability, so the row now renders available: null instead of available; preserve the local/baseUrl availability before applying route-auth overrides to remote rows.

Useful? React with 👍 / 👎.

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Jul 11, 2026
obviyus added a commit that referenced this pull request Oct 10, 2026
## What Problem This Solves

Fixes: the New Session device picker explains a missing Codex harness as an opaque node-command failure when an OpenAI model cannot run on a paired laptop.

## User Impact

The reason now explains the model/harness/device relationship first, then gives the node-side install, enable, restart, and approval steps. Users can also choose a model using the OpenClaw harness. It says **unavailable**, rather than incorrectly claiming every disabled or denied plugin is uninstalled.

There is no automatic installation, silent harness substitution, or change to node/Gateway approval policy.

## Why This Change Was Made

Codex is an official external plugin, not part of the stock npm node package. A source checkout can also contain the plugin without enabling it on the node. The existing node-local plugin loader already declares `codex.exec-server.stdio.v1` only when the plugin is present and enabled; the new integration coverage preserves missing, explicitly disabled, explicitly denied, and enabled cases. No second capability or availability owner is needed.

The shared required-command authority owns the explanation used by both device discovery and placement. Pending pairing approval and Gateway policy denial keep their existing, distinct remedies.

Provenance:
- [#88451](#88451) introduced the unified OpenAI implicit Codex default (`4c33aaa86c1`); [#104685](#104685) moved effective-route policy into the provider (`1b1cebfe421`). Both were located with `git log -S`.
- [#127202](#127202) introduced the approved paired-device exec-server command (`1353ce0995c`).
- [`d111676bcbf`](d111676) deliberately excluded Codex from the root npm package. This PR preserves that distribution decision.
- Inspected upstream Codex `codex-rs/cli/src/exec_server_command.rs` at `c248f6d48b97eb4a2aa56147a0b11b7d763278b9`: stdio execution is native; remote registration/auth is a separate branch. OpenClaw's plugin owns the pinned binary; the ordinary node does not need a separate Codex login to advertise the command.

No overlap with Pash/Sarah changes in the changed files.

## Evidence

- Regression through the real `environments.list` handler: the new harness explanation assertion fails on `e40606fdea9` with the old command-first message (1 failed / 5 passed), and passes after the fix.
- Focused checks: 33 tests passed across the real node plugin-loader integration, node-command policy, and environment-command authority suites. The node integration loads the actual Codex plugin, not a replacement registration fixture.
- Rebased cleanly onto `f3af0db8fce`, including main's repair for the earlier duplicate-import failure. Full CI is green on `bb4428fc20492b523f42d812987261c74d27c138`: 57 passed, 54 skipped, no failures or pending checks; [CI gate](https://github.com/openclaw/openclaw/actions/runs/38089723977/job/114324791021).
- Before the rebase, formatting, focused lint, core typecheck, and all core-test typecheck groups passed. The broad local changed-file gate stopped at repository-wide dead-export findings outside this patch; final verification is the green rebased CI run.
- Actual Control UI before/after captures with deterministic Gateway fixtures, inspected on macOS arm64. The device stays disabled in both images; the improvement is the truthful explanation and recovery choices. The after fixture obtains its message from the production authority function. These are visual reproduction captures, not a live-model execution claim.

### Before

![Before: opaque missing command explanation](https://github.com/user-attachments/assets/93c2cdbf-88b3-4357-9442-375f2223f494)

### After

![After: model harness and node-side recovery explanation](https://github.com/user-attachments/assets/ae4e0419-bb46-4401-b801-4acecc32d115)

## Bounded cost

No new imports, network calls, binary downloads, processes, polling, state, configuration, or protocol fields. The existing missing-command branch returns a different string. Production code: +4/-1 lines; tests: +50 lines; documentation: +16 lines.

## Merge danger

Two-way door: reverting restores the old explanation. The blast radius is the explanation for an undeclared command owned by the Codex plugin; eligibility, explicit disable/deny decisions, runtime choice, and execution remain unchanged.

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

## What Problem This Solves

Fixes: the New Session device picker explains a missing Codex harness as an opaque node-command failure when an OpenAI model cannot run on a paired laptop.

## User Impact

The reason now explains the model/harness/device relationship first, then gives the node-side install, enable, restart, and approval steps. Users can also choose a model using the OpenClaw harness. It says **unavailable**, rather than incorrectly claiming every disabled or denied plugin is uninstalled.

There is no automatic installation, silent harness substitution, or change to node/Gateway approval policy.

## Why This Change Was Made

Codex is an official external plugin, not part of the stock npm node package. A source checkout can also contain the plugin without enabling it on the node. The existing node-local plugin loader already declares `codex.exec-server.stdio.v1` only when the plugin is present and enabled; the new integration coverage preserves missing, explicitly disabled, explicitly denied, and enabled cases. No second capability or availability owner is needed.

The shared required-command authority owns the explanation used by both device discovery and placement. Pending pairing approval and Gateway policy denial keep their existing, distinct remedies.

Provenance:
- [openclaw#88451](openclaw#88451) introduced the unified OpenAI implicit Codex default (`d56b73b6126`); [openclaw#104685](openclaw#104685) moved effective-route policy into the provider (`e00b05b5f3c`). Both were located with `git log -S`.
- [openclaw#127202](openclaw#127202) introduced the approved paired-device exec-server command (`a3a58230b7f`).
- [`47375e78b00`](openclaw@47375e7) deliberately excluded Codex from the root npm package. This PR preserves that distribution decision.
- Inspected upstream Codex `codex-rs/cli/src/exec_server_command.rs` at `c248f6d48b97eb4a2aa56147a0b11b7d763278b9`: stdio execution is native; remote registration/auth is a separate branch. OpenClaw's plugin owns the pinned binary; the ordinary node does not need a separate Codex login to advertise the command.

No overlap with Pash/Sarah changes in the changed files.

## Evidence

- Regression through the real `environments.list` handler: the new harness explanation assertion fails on `d1abe907cb7` with the old command-first message (1 failed / 5 passed), and passes after the fix.
- Focused checks: 33 tests passed across the real node plugin-loader integration, node-command policy, and environment-command authority suites. The node integration loads the actual Codex plugin, not a replacement registration fixture.
- Rebased cleanly onto `bf08a7bc8c4`, including main's repair for the earlier duplicate-import failure. Full CI is green on `bb4428fc20492b523f42d812987261c74d27c138`: 57 passed, 54 skipped, no failures or pending checks; [CI gate](https://github.com/openclaw/openclaw/actions/runs/38089723977/job/114324791021).
- Before the rebase, formatting, focused lint, core typecheck, and all core-test typecheck groups passed. The broad local changed-file gate stopped at repository-wide dead-export findings outside this patch; final verification is the green rebased CI run.
- Actual Control UI before/after captures with deterministic Gateway fixtures, inspected on macOS arm64. The device stays disabled in both images; the improvement is the truthful explanation and recovery choices. The after fixture obtains its message from the production authority function. These are visual reproduction captures, not a live-model execution claim.

### Before

![Before: opaque missing command explanation](https://github.com/user-attachments/assets/93c2cdbf-88b3-4357-9442-375f2223f494)

### After

![After: model harness and node-side recovery explanation](https://github.com/user-attachments/assets/ae4e0419-bb46-4401-b801-4acecc32d115)

## Bounded cost

No new imports, network calls, binary downloads, processes, polling, state, configuration, or protocol fields. The existing missing-command branch returns a different string. Production code: +4/-1 lines; tests: +50 lines; documentation: +16 lines.

## Merge danger

Two-way door: reverting restores the old explanation. The blast radius is the explanation for an undeclared command owned by the Codex plugin; eligibility, explicit disable/deny decisions, runtime choice, and execution remain unchanged.

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

agents Agent runtime and tooling app: web-ui App: web-ui commands Command implementations docs Improvements or additions to documentation extensions: codex extensions: openai gateway Gateway runtime maintainer Maintainer-authored PR P1 High-priority user-facing bug, regression, or broken workflow. scripts Repository scripts size: XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OpenAI auth availability diverges from effective model routing

1 participant