Repository navigation
feat: discover models during custom provider setup - #173300
Conversation
Extend the existing custom setup flow with guarded OpenAI-compatible model discovery, manual fallback, and prepared reset discovery. Keep explicit model IDs authoritative and retain authored model metadata. Refs #121584, #122042. Thanks @alexandre-leng for the reports and setup proposal.
Use the canonical plugin metadata snapshot for credential-bearing discovery and make bypass regressions hermetic. Remove two verified stale max-lines baseline entries.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: blocked before merge. What this changesThis PR adds model discovery and selection to custom-provider setup, including bulk catalog import during noninteractive onboarding. Example: An OpenAI-compatible endpoint at http://127.0.0.1:8000/v1 advertises local-small and local-large.
Review scores
ProductKind: Feature · Worth it: Yes · Fix scope: Partial Merge readiness⛔ Blocked before merge - 1 item remains Keep this PR open: it delivers a useful, maintainer-directed setup feature, resolves the previous findings, and has no newly identified code defect. Priority: P2 Before merge
FindingsNone. Tests
Agent review detailsHow this fits togetherOnboarding takes endpoint, credential, and model choices, uses guarded provider discovery, and passes the result to the existing provider-config and agent-model owners. flowchart TD
A[Interactive wizard] --> C[Custom provider setup]
B[Noninteractive CLI] --> C
C --> D[Credential resolution]
D --> E[Guarded model discovery]
E --> F[Provider catalog configuration]
F --> G[Agent model selection]
Technical reviewBest possible solution: Keep discovery within the existing setup and provider owners while preserving explicit choices, credential representation, and authored model metadata. Do we have a high-confidence way to reproduce the issue? This is a capability addition; source inspection confirms the manual-entry requirement on main, and the supplied real CLI evidence exercises discovery after the change. Is this the best way to solve the issue? Reusing guarded discovery and the existing configuration owner is appropriate; explicit IDs bypass discovery, and bulk imports avoid the previously reported quadratic copying. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 527f9d1a1306. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +213, Tests +974, Docs +26. Total +1213 across 18 files. Added test files: 2. View PR surface stats
Review metrics
LabelsLabel changes:
Label justifications:
Rating scale6/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. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (7 earlier review cycles)
Reviewed October 16, 2026, 6:36 AM ET / 10:36 UTC (Revision 8). |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e10ffce4ca
ℹ️ 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 result = applyCustomApiConfig({ | ||
| const modelIds = await resolveNonInteractiveCustomApiModelIds({ | ||
| ...customAuth, | ||
| apiKey: resolvedCustomApiKey?.key, |
There was a problem hiding this comment.
Reuse the configured key for model discovery
When non-interactive onboarding is rerun for an existing custom provider whose credential is stored only in models.providers[id].apiKey, omitting both --custom-api-key and --custom-model-id sends discovery without authentication because resolveNonInteractiveApiKey checks flags, environment variables, and profiles but not the provider configuration. Authenticated endpoints therefore return no models and onboarding rejects the configuration, even though applyCustomApiConfig otherwise preserves that existing key. Resolve the configured credential for the discovery request while retaining its existing storage representation.
Useful? React with 👍 / 👎.
|
Fixed the configured-credential P2 in 889cd9e. Both noninteractive setup and reset preflight now reuse a matching provider's inline key or SecretRef through the existing resolution owners, without rewriting or logging the resolved credential. Configured profile IDs retain the existing profile-binding checks, and different endpoints cannot inherit the old key. The five requested credential regressions fail before the repair. The follow-up also repairs the guided activation fixture's handling of the new bodyless catalog GET. All 149 focused discovery/setup unit tests pass, and the final full-branch independent review is clean through P2. Validation results and remaining platform/proof limits are recorded in the updated PR body. The existing stable-release Azure upgrade limitation remains documented. @clawsweeper re-review |
|
🦞👀 Re-review progress:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7b14274f72
ℹ️ 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".
| if (binding.kind === "profile-resolved") { | ||
| configuredKey = binding.auth.apiKey; | ||
| } else if (binding.kind === "profile-incompatible" || binding.kind === "profile-unresolved") { | ||
| throw credentialError(); | ||
| } |
There was a problem hiding this comment.
Resolve configured environment markers before discovery
When an existing custom provider stores a legacy environment marker such as OPENAI_API_KEY in apiKey and the model ID is omitted, resolveProviderEntryApiKeyBinding classifies the marker as none, so this branch leaves the marker string in configuredKey; materializeSecretInput then treats it as a literal and discovery sends Bearer OPENAI_API_KEY instead of the environment value. Normal inference explicitly resolves these backward-compatible markers, so an otherwise working provider now fails discovery and onboarding. Fresh evidence is the newly added binding path, which handles profiles and SecretRefs but not its none result for environment markers; resolve those through the existing model-auth owner before issuing the request.
AGENTS.md reference: AGENTS.md:L57-L57
Useful? React with 👍 / 👎.
|
Fixed the saved environment-marker finding in f68181c by reusing the existing runtime credential resolver, preserving profile precedence and the stored marker. The new regression fails before the fix and passes now. Real All 181 discovery/setup tests pass; types, lint, applicable ratchets, runtime build, and fresh full-branch Codex autoreview pass. Pre-PR main upgrade shapes are covered; a released-version Azure upgrade remains an explicitly documented proof limitation. @clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
…174191) Fill the missing Simplified and Traditional Chinese catalog entries for manual model-ID entry and unavailable endpoint discovery. The two keys were introduced in #173300 without translations, causing the wizard to fall back to English and breaking the existing locale parity check. The catalogs are maintained in-tree. Preserve runtime fallback and every parity assertion. No migration or update behavior changes. Proof: pnpm test src/wizard/i18n/index.test.ts --maxWorkers=1 reproduced 7 pass / 1 fail before and passes 8/8 after (3.50s Vitest, 5.56s runner). Core and commands/wizard test types, scoped oxlint, boundary lint, formatting, and P2 autoreview pass.
…74824) * fix(litellm): preserve mixed-case proxy URLs during reauthentication Resolve the authored provider row before choosing onboarding defaults, so unattended reauthentication keeps its proxy and catalog instead of staging localhost:4000. Reuse the same existing resolver for prompt and discovery reads. Related: #173300, #173164 * fix(setup): retain provider alias folding during activation * fix(setup): prefer canonical provider snapshots during activation * fix(litellm): keep discovery URL and path selection aligned
* feat: discover models during custom provider setup Extend the existing custom setup flow with guarded OpenAI-compatible model discovery, manual fallback, and prepared reset discovery. Keep explicit model IDs authoritative and retain authored model metadata. Refs openclaw#121584, openclaw#122042. Thanks @alexandre-leng for the reports and setup proposal. * test: complete custom discovery fixtures Use the canonical plugin metadata snapshot for credential-bearing discovery and make bypass regressions hermetic. Remove two verified stale max-lines baseline entries. * fix(onboarding): preserve Azure metadata during discovery * fix: reuse configured credentials during custom model discovery * fix: preserve custom provider credential authority during setup * fix: reject reset that discards discovery credentials * fix: preserve anonymous discovery policy and batch model imports * test: keep discovery catalog regression within suite limits * fix: resolve saved environment markers for model discovery
…penclaw#174191) Fill the missing Simplified and Traditional Chinese catalog entries for manual model-ID entry and unavailable endpoint discovery. The two keys were introduced in openclaw#173300 without translations, causing the wizard to fall back to English and breaking the existing locale parity check. The catalogs are maintained in-tree. Preserve runtime fallback and every parity assertion. No migration or update behavior changes. Proof: pnpm test src/wizard/i18n/index.test.ts --maxWorkers=1 reproduced 7 pass / 1 fail before and passes 8/8 after (3.50s Vitest, 5.56s runner). Core and commands/wizard test types, scoped oxlint, boundary lint, formatting, and P2 autoreview pass.
…enclaw#174824) * fix(litellm): preserve mixed-case proxy URLs during reauthentication Resolve the authored provider row before choosing onboarding defaults, so unattended reauthentication keeps its proxy and catalog instead of staging localhost:4000. Reuse the same existing resolver for prompt and discovery reads. Related: openclaw#173300, openclaw#173164 * fix(setup): retain provider alias folding during activation * fix(setup): prefer canonical provider snapshots during activation * fix(litellm): keep discovery URL and path selection aligned
Related: #121584, #122042
What Problem This Solves
Custom OpenAI-compatible setup required a manually entered model ID even when the endpoint advertised its models.
User Impact
The wizard offers discovered models and manual entry. Noninteractive setup can omit
--custom-model-idto import the advertised list and select its first model; an explicit ID skips discovery. Empty, invalid, unavailable, and unauthorized responses explain how to fall back to a manual ID. Anthropic-compatible setup still requires an explicit ID.Existing endpoint credentials, including saved environment-variable markers, can authenticate discovery without changing their stored representation. Saved
auth: noneremains authoritative unless a new key is supplied. Replacement endpoints never borrow old credentials. Reset rejects before HTTP or deletion if it would discard the only discovery credential; supply a key independently or rerun without reset.Why This Change Was Made
Both setup paths use the existing guarded self-hosted discovery owner, retaining network policy, deadlines, and the response-byte limit. Bulk catalog application now runs once instead of repeatedly copying growing catalogs and allowlists. It preserves authored metadata, model ordering, named-agent ownership, and explicit Azure normalization. No new command, catalog owner, dependency, or schema.
Thanks @alexandre-leng for the reports and setup proposal.
Evidence
Authority-matrix runtime:
f49bf32d046e1c1f7c87fbb6dc1ae8219c3c8801. Current head:f68181c46506308d18d6bf145946a129d3907ccc. The subsequent runtime change resolves saved environment-variable markers through the existing model-auth owner. It does not rewrite the stored marker. The earlier authority and reset matrix below remains separately attributed; the marker-specific before/after capture exercises the current head.Four configurations were originally created through
pnpm openclawon pre-PR main93e4b56350e492fa30f8bd75b4e47ab1413ecfc1. The run restored verified first-write backups and inactive profile stores; original hashes and profile-store timestamps were checked. All state was isolated. Recording relays A and B answered/v1/modelsand/v1/chat/completions; captures contain request method/path, auth-header presence, and SHA-256 prefixes only./v1/modelsa44370c1599f32camatches/v1/models512edf3258be833fmatches/v1/models2ff2e1ee540f7b02matches/v1/models6adf84f2e8be577bmatches/v1/chat/completions/v1/models/v1/models/v1/models/v1/modelsbe7cec3ff246064d; staged inactivebe7cec3ff246064d; staged inactiveSame-endpoint reset that would discard its only credential: rejected before HTTP, zero requests, config byte-for-byte unchanged (34.61s).
The upgrade/destination matrix passed in 202.03s. Allowed setups took 31.54–31.85s; existing/discovered model rows loaded in 18.17s, and an authenticated completion probe reached A in 23.81s. Every B request was anonymous, with no request to A after switching. The incompatible binding rejected before HTTP and left config unchanged.
The persisted-no-auth fixtures overlay that policy on the genuine pre-PR shapes. Inline and unresolved env-reference setup/reset all succeeded anonymously (21.96–32.17s). Independently supplied env keys reached A with matching digests, then followed the existing inactive-credential staging flow; the current no-auth config remained intact. The 10,000-model import preserved all IDs, the old row, and credential representation in 17.67s. Sixteen selected redacted requests cover these cases.
Before the reset fix, a real CLI run authenticated discovery and then deleted its only key (549.12s including startup rebuild). The repaired runtime rejects before any HTTP/reset, preserves the key, and leaves config byte-for-byte unchanged (34.61s).
The final saved-marker capture starts from the same pre-PR configuration with
apiKey: "OPENAI_API_KEY", a synthetic value in that variable, and noCUSTOM_API_KEYor credential/model flags. On7b14274, discovery sent an anonymous request and failed (115.62s including build); the configuration stayed unchanged. On the current head, discovery succeeds in 24.08s and preserves the marker plus the original model row; an authenticated completion probe succeeds in 29.18s. Both requests carry the matching SHA-256 prefix278e41968ce81021, and no raw credential appears in output./v1/models/v1/models278e41968ce81021matches/v1/chat/completionsValidation
8fcc7cdafcfd: actual local-agent responses through LM Studiogoogle/gemma-4-e4b(147.14s) and Ollamaqwen2.5:7b(187.63s). Those are prior-head inference controls; the recorded runtime proof exercises real CLI/config/auth/HTTP boundaries with deterministic responders.Platform limit: Apple Silicon macOS. Upgrade source is pre-PR main, not a released Azure installation. Operator state, Gateway, LaunchAgents, and shared models were untouched. Endpoints may advertise embedding models; use an explicit ID if the first model is unsuitable for chat.
Production +310/−97 (net +213), tests +1017/−43, docs +27/−1 against integrated main. Growth covers setup selection, existing credential policy/resolution, reset handoff, and batch catalog application; no second catalog owner or public surface was added.
External validation status
Exact-head CI run 38887661367 passed: 47 successful jobs, 26 skipped, zero failures. Both
openclaw/ci-gateandopenclaw/security-sensitive-reviewpassed.ClawSweeper reviewed
f68181c46506308d18d6bf145946a129d3907cccand reported no actionable findings. Its remaining hold requests a released-version Azure upgrade capture; that proof is not claimed here. Completed compatibility proof starts from pre-PR main, as documented above.An earlier head's CI failed an unchanged compaction assertion. Its full file passed 83/83 on the exact integrated base (399.42s), and the failing case passed locally on the previous head (278.05s). The original CI cause remains un-reproduced; unchanged source alone does not prove it inherited. The failure did not recur in this head's successful run. No merge requested.