Repository navigation
fix: custom endpoint setup fails auth-less servers outside loopback, leaving half-applied provider config - #172152
Conversation
|
🦞👀 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. |
✅ Maintainer security changes approvedA maintainer approved this revision with an explicit security approval comment.
A later push requires a fresh approval comment for an external contributor's PR. |
|
Codex review: needs changes before merge. What this changesThis PR adds explicit no-auth setup and request handling for custom OpenAI Chat Completions providers. Example: Configure https://studio.example.ts.net/v1 with model qwen3.8 and no API key.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Needs changes before merge - 1 item remains Keep this PR open: it addresses a current custom-provider setup bug, and no introduced correctness defect remains evident; GitHub still reports a conflict and requires security approval for the current revision. Priority: P2 Before merge
FindingsNone. Agent review detailsHow this fits togetherCustom-provider setup produces model configuration consumed by core auth resolution and the session registry, which prepare credentials and headers for outbound model requests. flowchart TD
A[Wizard or CLI setup] --> B[Provider configuration]
B --> C[Core auth resolver]
B --> D[Session model registry]
C --> E[Shared no-auth header policy]
D --> E
E --> F[OpenAI transport]
F --> G[Configured inference endpoint]
Technical reviewBest possible solution: Land the explicit no-auth contract with shared credential suppression and final-header enforcement after resolving the current workflow blockers. Do we have a high-confidence way to reproduce the issue? Current-main source establishes the blank-key versus remote-host mismatch, and the supplied released-build CLI trace demonstrates the corresponding missing-key failure; this review executed no target code. Is this the best way to solve the issue? Explicit operator intent is appropriate here: it preserves hostname trust rules, suppresses retained credentials, and rejects unsupported effective adapters rather than broadening implicit no-auth detection. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 5462f7f14643. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +244, Tests +711, Docs +34, Generated 0, Other -1. Total +988 across 35 files. Added test files: 3. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. LabelsLabel changes: No label 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 (5 earlier review cycles)
Reviewed October 15, 2026, 10:56 PM ET / October 16, 2026, 02:56 UTC (Revision 6). |
d9c09d5 to
59811c5
Compare
Real behavior proof (authority chain, redacted)All runs below executed on macOS 27 / Apple silicon. Endpoint hostnames/IPs are redacted ( 1. Boundary execution — stable base fails, PR head passes (same endpoint, same model, same keyless state)Base = the released 2. CLI setup persists the choice (shipped
|
The custom endpoint wizard promises "API Key (leave blank if not required)", but a blank key only works for loopback/RFC1918 base URLs: synthetic no-auth credentials are gated on local host classification, so auth-less servers on tailnet/VPN hosts (e.g. Tailscale Serve) fail the setup live check and leave a half-applied state - an auth profile for a provider whose `models.providers` registration was reverted. Add an explicit `auth: "none"` provider mode as an operator declaration: - config: accept `auth: "none"` on `models.providers.<id>` and widen the model-registry provider auth schema - auth resolution: mint the no-auth marker for `auth: "none"` routes with any reachable host, bypassing only the locality heuristic - wizard: a blank API key now confirms no-auth mode and persists `auth: "none"` instead of silently producing a broken provider - non-interactive: `--custom-no-auth` (rejects `--custom-api-key` conflicts) and applyCustomApiConfig key/auth-mode clearing on re-onboard between keyed and no-auth setups - docs: document `auth: "none"` for auth-less custom endpoints
…tions Review follow-ups (ClawSweeper openclaw#172152): - auth resolution: `auth: "none"` is now an authoritative operator declaration enforced at the top of the provider credential selection, so stored profiles, pinned credentials, env keys, and inline keys are never handed to a host explicitly marked keyless - adapter scope: no-auth synthesis and setup (wizard, parse, and apply) are restricted to openai-completions, the only transport that suppresses the Authorization header for the synthetic marker; the wizard re-prompts for a key when a non-openai compatibility was selected after a blank-key no-auth confirmation - reset preflight: --custom-no-auth + --custom-api-key conflicts are detected before --reset moves existing state to Trash - non-interactive no-auth no longer resolves or serializes ambient CUSTOM_API_KEY credentials (previously crashed the replacement branch with an empty profile set) - tests: resolver precedence over stored profiles, adapter restriction, reset preflight conflict, env-skip, wizard compat fallback
…keys A provider entry hand-authored with both auth: "none" and a stale apiKey previously fell through to inline-key selection, egressing the key to a host declared keyless. The no-auth declaration now outranks inline keys the same way it outranks stored profiles and env credentials; verified wire-level (capture server saw no Authorization header and no key material with both inline and env keys present).
a1a93ff to
658e724
Compare
|
/allow-security-sensitive-change |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
/allow-security-sensitive-change |
Resolve only the generated config fingerprint conflict through pnpm config:docs:gen. Preserve the reviewed auth-none sources and contributor history.
|
/allow-security-sensitive-change |
|
/allow-security-sensitive-change |
|
Merged via squash.
|
…leaving half-applied provider config (openclaw#172152) * fix(models): support explicit no-auth custom endpoints The custom endpoint wizard promises "API Key (leave blank if not required)", but a blank key only works for loopback/RFC1918 base URLs: synthetic no-auth credentials are gated on local host classification, so auth-less servers on tailnet/VPN hosts (e.g. Tailscale Serve) fail the setup live check and leave a half-applied state - an auth profile for a provider whose `models.providers` registration was reverted. Add an explicit `auth: "none"` provider mode as an operator declaration: - config: accept `auth: "none"` on `models.providers.<id>` and widen the model-registry provider auth schema - auth resolution: mint the no-auth marker for `auth: "none"` routes with any reachable host, bypassing only the locality heuristic - wizard: a blank API key now confirms no-auth mode and persists `auth: "none"` instead of silently producing a broken provider - non-interactive: `--custom-no-auth` (rejects `--custom-api-key` conflicts) and applyCustomApiConfig key/auth-mode clearing on re-onboard between keyed and no-auth setups - docs: document `auth: "none"` for auth-less custom endpoints * fix(models): make no-auth authoritative and scope it to openai-completions Review follow-ups (ClawSweeper openclaw#172152): - auth resolution: `auth: "none"` is now an authoritative operator declaration enforced at the top of the provider credential selection, so stored profiles, pinned credentials, env keys, and inline keys are never handed to a host explicitly marked keyless - adapter scope: no-auth synthesis and setup (wizard, parse, and apply) are restricted to openai-completions, the only transport that suppresses the Authorization header for the synthetic marker; the wizard re-prompts for a key when a non-openai compatibility was selected after a blank-key no-auth confirmation - reset preflight: --custom-no-auth + --custom-api-key conflicts are detected before --reset moves existing state to Trash - non-interactive no-auth no longer resolves or serializes ambient CUSTOM_API_KEY credentials (previously crashed the replacement branch with an empty profile set) - tests: resolver precedence over stored profiles, adapter restriction, reset preflight conflict, env-skip, wizard compat fallback * fix(models): let explicit auth none outrank retained inline provider keys A provider entry hand-authored with both auth: "none" and a stale apiKey previously fell through to inline-key selection, egressing the key to a host declared keyless. The no-auth declaration now outranks inline keys the same way it outranks stored profiles and env credentials; verified wire-level (capture server saw no Authorization header and no key material with both inline and env keys present). * test: move explicit no-auth coverage into focused suite * fix: enforce no-auth at final request and setup boundaries * fix: preserve no-auth adapter types and reset validation * chore: shrink stale environment variable count budget --------- Co-authored-by: Peter Steinberger <[email protected]>
Closes #172150.
What Problem This Solves
Custom model endpoints that do not require authentication can pass setup with a blank key but then fail on the first turn when their hostname is not classified as local.
User Impact
Custom OpenAI Chat Completions providers can explicitly set
auth: "none", choose no-auth in the wizard, or pass--custom-no-authduring noninteractive setup. Requests omit Authorization even when inline, environment, stored/pinned, or activated SecretRef credentials remain configured. The optional value needs no Doctor migration.The effective model adapter controls support. Responses, Azure OpenAI, and Anthropic adapters still require a key or placeholder; unsupported no-auth choices fail before reset or persistence. Hostname-locality rules are unchanged.
Why This Change Was Made
No-auth is terminal before core credential preparation, provider plugin exchange, and session-registry credential lookup. The shared header override also survives SDK header merging. Setup validates model-level API overrides and Azure URL rewriting, while an explicit replacement key can switch an existing no-auth provider back to keyed mode.
Builds on @rubencu's original contribution and preserves their commits (original tailnet proof). Config schema, generated help, CLI help, and docs describe the new option.
Evidence
Evidence below records the tested source heads: the full build and live matrix ran on
9c63b3f47b673cc03a22c406831248111e31fcc0. The final main integration leaves all authored production owners unchanged and narrows only erased types in one test fixture.The 279 focused owner cases have passing evidence on the pre-merge candidate (14 files; full run 2,220.38 seconds, followed by a corrected 57-case reset-test rerun in 324.58 seconds). After merging main for a generated-config conflict, the SDK no-auth/keyed request cases and one-shot completion/profile-failover suite passed all 21 cases in 600.25 seconds. Feature-owner sources were unchanged by the merge. Long local durations are dominated by compilation/import preparation (95% transform in the SDK shard); the plugin credential-preparation regression exercises the real lazy runtime boundary, whose first import took 110.64 seconds on this shared Mac.
On
9c63b3f, core, agents-root and agents-sessions type checks passed in 44.00, 29.57 and 28.76 seconds. Scoped type-aware lint passed in 57.34 seconds on the unchanged feature sources. All seven ratchets passed on that head (0.53–133.47 seconds each), including generated config docs. Codex autoreview on656b3635b94c9e0b4f99f9c34e4e1358313c566bis scoped-clean with no actionable P0–P2 findings; the only later change is the verified shrink-only baseline correction.Full
pnpm buildpassed on9c63b3f47b673cc03a22c406831248111e31fcc0in 922.70 seconds, including declarations and SDK export checks. Real macOS proof usedpnpm openclawwith isolated profiles/state and a task-owned proxy atauth-none.127.0.0.1.nip.io:18782, a hostname outside the lexical local-provider classification. The isolated provider used the existingrequest.allowPrivateNetworkoption for that deliberate private DNS result. Capture records only path and whether Authorization is absent.setup --custom-no-authinfer model run --local, Ollamallama3.2:latestAUTH_NONE_LIVE_OKreply; Authorization absentagent --localAUTH_NONE_AGENT_OKreply; header present → absent, including retained profile, SecretRef and explicit Authorization headerThe final agent proof disables Tool Search and Code Mode and completes one assistant turn with zero tools. An initial small-model attempt looped on malformed tool-discovery calls; all 19 requests still omitted Authorization. A separate existing-primary wizard case failed before HTTP with a runtime-config-preparation error and preserved its old selection; it is retained as an unclassified setup follow-up, not claimed as the HTTP-400 proof.
Before the fix, isolated macOS setup succeeded but
infer model run --localfailed with “No API key found” before any request reached the endpoint. The original PR also returned an activated SecretRef credential despite explicit no-auth. New regression assertions failed against the original owner: five failures, four passes (489.10 seconds including compiler preparation).Production: +400/-156 lines (net +244). Tests: +723/-12 (net +711). Growth implements the new optional public contract and terminal request policy; nearby cleanup shares the header policy, removes a duplicate test shape, and extracts registry request auth from the oversized registry file. Docs: +35/-1; generated fingerprint: +2/-2; maintenance baselines: +1/-2 against the final base. The inherited environment-variable budget was narrowed from 453 to the source count of 452; the feature changes no counted environment names.
The initial CI run found broad generic types in the new auth test fixture. Its specific Completions model and profile-map annotations are now corrected; the affected
core-test-agents-othergraph passes (14.7 seconds compiler time, 67.13 seconds including lock wait), and scoped type-aware lint passes (70.73 seconds). Test behavior is unchanged.Prior-head publication checks: all seven required ratchets had passing evidence; the corrected max-lines/environment-budget check passes in 100.31 seconds. Other refreshed ratchets took 0.79–62.12 seconds. Prior head:
715947e196e19cfa9ff1638f3a72c302be618bb1.CI run
38794345432completed: build, UI E2E, test jobs, and the repaired auth type stripe passed. CI attribution: the sole code-check failure,check-test-types-core-3, is inherited from the newer CI merge based0d0f86547285fee3eb8d861510d1878b9740deb. Its Apple build-cache test infersrecord-ios-build-cache-metadata.outcomeasstringinstead of the required literal union. The exact-base test and matching helper/compiler inputs reproduce the same TS2345 attest/scripts/apple-build-cache.test.ts:232locally in 17.41 seconds. The candidate file was restored byte-for-byte; the auth fixture type stripe now passes.Limits: local live proof is macOS/Apple silicon only. Security-sensitive approval remains pending.
SDK merge follow-up
Merged main
19c8b47143194d97baabb80e337416d23524b7e3into the contributor branch without rebasing. SDK validation head:6e4676b6a6b7a2a665a9a2f8539cd72b0e8a85ef. The sole content conflict wassrc/agents/sessions/sdk.ts. Resolution keeps main's extracted stream function and narrow captures, preserving its disposed-parent/fork-replay fix, and applies the existing no-auth policy after final header merging. Relative to main, the SDK change is one import and the header-policy call (+5/-1).Fresh focused validation: all 30 cases across
sdk.no-auth.test.ts,sdk.test.ts, andmodel-registry.no-auth.test.tspassed (799.98 seconds total, including fixture compilation and source verification). Main's disposed-parent collection/replay regression passed. Core types, session test types, and scoped SDK lint passed (53.31, 61.09, and 41.68 seconds). Fresh Codex autoreview of the resolved candidate is scoped-clean with no actionable P0–P2 findings.Assertion-safety, environment budget, line-cap, timeout, mock-export, config-doc and inventory checks passed. Max-lines reports inherited UI baseline debt: main renamed
chat-message.test.tsto.tsxwhile its baseline still names.ts. The source and baseline blobs are identical to the integrated main; no unrelated allowance or policy change was made. Prior live proof remains attributed to its original head. Fresh CI is requested for this merge; the lead will re-post security approval on the new revision.Main advanced during publication, so the final head
9a9960d2ca52dc4510d97546eedea87b59f946d5also merges07afec7832b49097729956fecf38e42894cc9a5d. Its only conflict was the generated config fingerprint, regenerated canonically. Config-doc validation passed in 48.47 seconds and plugin inventory in 3.41 seconds. SDK/auth sources remain identical to the validated head above; the clean review and focused proof are reused with that attribution.