Repository navigation
fix(openai): align auth availability with effective routes - #104685
Conversation
|
Codex review: stale review; fresh review needed. Summary Next step Review history (5 earlier review cycles)
|
There was a problem hiding this comment.
💡 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"] }), |
There was a problem hiding this comment.
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 👍 / 👎.
ab5f53b to
c9cfe1c
Compare
c9cfe1c to
aba21ba
Compare
There was a problem hiding this comment.
💡 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".
| const available = authAvailabilityAuthoritative | ||
| ? (authAvailability ?? null) |
There was a problem hiding this comment.
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 👍 / 👎.
## 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  ### After  ## 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]>
…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  ### After  ## 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]>
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
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.pnpm testover the seven agent routing suites and five Codex app-server suites; 38 unit-fast, 276 agent, and 308 extension tests passed.