Skip to content

fix: custom endpoint setup fails auth-less servers outside loopback, leaving half-applied provider config - #172152

Merged
steipete merged 14 commits into
openclaw:mainfrom
rubencu:fix/custom-endpoint-no-auth
Oct 16, 2026
Merged

steipete merged 14 commits into
openclaw:mainfrom
rubencu:fix/custom-endpoint-no-auth

Conversation

@rubencu

@rubencu rubencu commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

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-auth during 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 on 656b3635b94c9e0b4f99f9c34e4e1358313c566b is scoped-clean with no actionable P0–P2 findings; the only later change is the verified shrink-only baseline correction.

Full pnpm build passed on 9c63b3f47b673cc03a22c406831248111e31fcc0 in 922.70 seconds, including declarations and SDK export checks. Real macOS proof used pnpm openclaw with isolated profiles/state and a task-owned proxy at auth-none.127.0.0.1.nip.io:18782, a hostname outside the lexical local-provider classification. The isolated provider used the existing request.allowPrivateNetwork option for that deliberate private DNS result. Capture records only path and whether Authorization is absent.

Real CLI proof Wall time Result
Noninteractive setup --custom-no-auth 19.95s Persists no-auth, no key, despite an ambient synthetic key
Interactive setup with Ollama verification 135.71s Completes and persists no-auth; both requests omit Authorization
Inline/env, saved/pinned profile, activated SecretRef conflicts 22.01–29.99s each Successful fixture replies; Authorization absent
Normal keyed inference control 25.05s Authorization present
infer model run --local, Ollama llama3.2:latest 32.98s Real AUTH_NONE_LIVE_OK reply; Authorization absent
Same-session keyed → no-auth agent --local 59.15s + 71.59s Real AUTH_NONE_AGENT_OK reply; header present → absent, including retained profile, SecretRef and explicit Authorization header
Responses override / Azure rewrite with full reset 37.41s / 12.63s Reject before HTTP; Azure preserves exact config bytes and workspace marker
Responses provider with selected Completions override 30.27s + 16.76s Setup and turn pass through Chat Completions without Authorization
Real wizard receiving deliberate HTTP 400 142.17s Unverified model/auth selection is not persisted

The 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 --local failed 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-other graph 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 38794345432 completed: 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 base d0d0f86547285fee3eb8d861510d1878b9740deb. Its Apple build-cache test infers record-ios-build-cache-metadata.outcome as string instead of the required literal union. The exact-base test and matching helper/compiler inputs reproduce the same TS2345 at test/scripts/apple-build-cache.test.ts:232 locally 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 19c8b47143194d97baabb80e337416d23524b7e3 into the contributor branch without rebasing. SDK validation head: 6e4676b6a6b7a2a665a9a2f8539cd72b0e8a85ef. The sole content conflict was src/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, and model-registry.no-auth.test.ts passed (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.ts to .tsx while 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 9a9960d2ca52dc4510d97546eedea87b59f946d5 also merges 07afec7832b49097729956fecf38e42894cc9a5d. 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.

@clawsweeper

clawsweeper Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation cli CLI command changes commands Command implementations agents Agent runtime and tooling labels Oct 14, 2026
@github-actions

github-actions Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

✅ Maintainer security changes approved

A maintainer approved this revision with an explicit security approval comment.

A later push requires a fresh approval comment for an external contributor's PR.

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Oct 14, 2026
@clawsweeper

clawsweeper Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge.

What this changes

This 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.

  • Before: Setup accepts the blank key, but inference fails with “No API key found.”
  • After: Choosing no-auth persists auth: "none" and permits inference without an Authorization header, even when retained credentials exist.

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) Useful owner-supported repair with shipped-entry-point proof, credential-conflict controls, and no remaining actionable code finding; workflow blockers do not lower patch quality.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): Real macOS setup, infer, and agent CLI runs exercise remote-classified no-auth endpoints, retained inline/environment/profile/activated-SecretRef credentials, explicit Authorization headers, keyed controls, and unsupported-adapter reset rejection. Successful responses and server-side captures establish both permitted inference and forbidden credential egress. Live evidence is pinned to its recorded heads; source comparison shows the subsequent SDK integration preserves the same final-header policy, supported by fresh session regression evidence.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: A reachable custom endpoint that needs no key can pass blank-key setup input but fail its first useful inference request.
Reason: The central mismatch is established, and the existing auth/setup owner has adopted and implemented the explicit configuration direction.

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
Reviewed head: 6e4676b6a6b7a2a665a9a2f8539cd72b0e8a85ef

Before merge

  • Complete next step - Resolve the GitHub-reported conflict, validate the resulting candidate through the required checks, and obtain fresh security-sensitive approval for that revision.

Findings

None.

Agent review details

How this fits together

Custom-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]
Loading

Technical review

Best 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

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 5f98ffb adds src/agents/model-auth-provider.ts:83 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 5f98ffb44585; files: src/agents/model-auth-provider.ts)
  • Ayaan Zaidi: Raw commit e4cf6f5 adds src/agents/model-auth-provider-config.ts:263 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: e4cf6f59756c; files: src/agents/model-auth-provider-config.ts)

PR surface

Source +244, Tests +711, Docs +34, Generated 0, Other -1. Total +988 across 35 files. Added test files: 3.

View PR surface stats
Area Files Added Removed Net
Source 22 400 156 +244
Tests 9 723 12 +711
Docs 2 35 1 +34
Config 0 0 0 0
Generated 1 2 2 0
Other 1 0 1 -1
Total 35 1160 172 +988

Review metrics

Metric Value Why it matters
Production versus test delta Production +400/-156; tests and test support +723/-12 Growth implements the optional auth contract across setup, core resolution, registry requests, and final header merging, with distinct boundary regressions.
Public configuration additions One auth enum value and one CLI flag Adds auth: "none" and --custom-no-auth without changing the default or adding environment variables.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #172150
Summary: This PR implements the explicit no-auth remedy for the linked blank-key custom-provider report.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: Fixes a limited custom-endpoint setup path with an existing placeholder-key workaround.
  • merge-risk: 🚨 compatibility: Adds a public provider auth mode and changes credential precedence only when explicitly selected; owner-led repairs and compatibility evidence support this intentional contract.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (5 earlier review cycles)
  • reviewed 2026-10-14T13:39:39.105Z sha f3fab6d245654a9c486fe13d9fcd3f6b35092400 :: needs real behavior proof before merge. :: [P1] Reject conflicting custom flags before resetting user state | [P1] Make explicit no-auth mode outrank stored credentials | [P2] Restrict no-auth selection to supported adapters
  • reviewed 2026-10-14T14:13:57.701Z sha d9c09d521207184afe0dce49073ed98bb3e9c7aa :: needs real behavior proof before merge. :: [P1] Reject conflicting custom flags before resetting user state | [P1] Make explicit no-auth mode outrank stored credentials | [P2] Restrict no-auth selection to supported adapters | [P2] Skip credential replacement when no-auth was selected
  • reviewed 2026-10-14T14:51:06.676Z sha 59811c587cf0ece3112350aeeee538a5e2a9d74c :: needs real behavior proof before merge. :: [P1] Reject conflicting custom flags before resetting user state | [P1] Make explicit no-auth mode outrank stored credentials | [P2] Restrict no-auth selection to supported adapters | [P2] Skip credential replacement when no-auth was selected
  • reviewed 2026-10-14T15:47:37.603Z sha a1a93ffd5db74f14fc170284f666ac3f5d7e5603 :: needs real behavior proof before merge. :: [P1] Resolve explicit no-auth before managed credential preparation | [P2] Validate no-auth against the selected model adapter | [P2] Reject no-auth when Azure URL handling selects Responses
  • reviewed 2026-10-16T02:28:17.098Z sha 715947e :: needs changes before merge. :: none

Reviewed October 15, 2026, 10:56 PM ET / October 16, 2026, 02:56 UTC (Revision 6).

@rubencu
rubencu force-pushed the fix/custom-endpoint-no-auth branch 3 times, most recently from d9c09d5 to 59811c5 Compare October 14, 2026 14:41
@rubencu

rubencu commented Oct 14, 2026

Copy link
Copy Markdown
Contributor Author

Real behavior proof (authority chain, redacted)

All runs below executed on macOS 27 / Apple silicon. Endpoint hostnames/IPs are redacted (https://studio.example.ts.net = a Tailscale Serve HTTPS endpoint; 100.x.x.x = its tailnet CGNAT address, which OpenClaw classifies as remote — not loopback, not RFC1918). The capture server bound 0.0.0.0:18790 and logged every inbound request header; sentinel strings stand in for credentials.

1. Boundary execution — stable base fails, PR head passes (same endpoint, same model, same keyless state)

Base = the released openclaw 2026.10.3 build; head = a1a93ff from this PR.

$ OPENCLAW_STATE_DIR=<base-state> openclaw infer model run --local   # 2026.10.3, provider persisted without a key
No API key found for provider "custom-studio-example-ts-net"         # ← the exact user-visible failure from #172153
$ OPENCLAW_STATE_DIR=<head-state> node openclaw.mjs infer model run --local   # this PR, same endpoint
outputs: 1
olmx-no-auth-ok                                                       # ← live completion returned, keyless

2. CLI setup persists the choice (shipped openclaw onboard this PR adds the flag for)

$ openclaw onboard --non-interactive --accept-risk --flow quickstart --skip-daemon ... \
    --auth-choice custom-api-key \
    --custom-base-url https://studio.example.ts.net/v1 \
    --custom-model-id Qwen3.8-Flash-Next-oQ8e-mtp \
    --custom-no-auth
Updated config: <state>/openclaw.json

persisted: {'baseUrl': 'https://studio.example.ts.net/v1', 'api': 'openai-completions', 'auth': 'none'}
default model: {"primary": "custom-studio-example-ts-net/Qwen3.8-Flash-Next-oQ8e-mtp"}
inline apiKey present: False

(First live turn against an idle second model even returned the server's real
507 Cannot load ...would exceed the dynamic memory ceiling error — the request
was keyless yet processed server-side, i.e. auth never blocked the path.)

3. Conflicting credentials never egress (wire capture, PR head)

Provider entry with both auth: "none" and a stale apiKey, plus an ambient CUSTOM_API_KEY in the environment:

$ CUSTOM_API_KEY=ENVKEY-DO-NOT-EGRESS-7b2c openclaw infer model run --local   # baseUrl: http://127.0.0.1:18790/v1, auth:"none", inline apiKey set
proof-pong                                                                     # server replied; capture below is server-side

POST /v1/chat/completions -> authorization: <ABSENT>
wire contains 'INLINEKEY-DO-NOT-EGRESS-4d8e': False
wire contains 'ENVKEY-DO-NOT-EGRESS-7b2c': False
wire contains 'custom-local': False                                            # marker placeholder never hits the wire either

The loopback host here is only about where the capture socket lives; the
remote-classification question is covered by §1/§2 (tailnet host) plus unit tests
keeps auth none authoritative over stored profiles,
keeps auth none authoritative over retained inline provider keys, and
does not synthesize no-auth for auth none providers on non-openai-completions adapters.

4. Stored-data compatibility

openclaw models status from this branch against a copy of a live 2026.10.3 state
(openclaw.json + state/openclaw.sqlite produced by the released app, containing a
provider with a stored api-key profile):

Default       : custom-studio-example-ts-net/Qwen3.8-Flash-Next-oQ8e-mtp
Auth store    : <state>/state/openclaw.sqlite
  profiles=1 (0 oauth, 0 token, 1 api-key)
(no config or store load errors; existing keyed provider resolves as before)

The config-surface change is purely additive (one enum value), and the release
baseline hash is regenerated in-repo (docs/.generated/config-baseline.sha256).

5. Findings addressed in 84a4a0d / a1a93ff

  • [P1] reset preflight — the reset-preflight parse now receives the supplied --custom-api-key, so the --custom-no-auth conflict rejects before handleReset touches state; covered by rejects no-auth combined with a custom API key before reset (src/commands/onboard.test.ts).
  • [P1] precedence / credential egress — auth: "none" is now enforced at the top of resolveApiKeyForProviderCore, ahead of stored profiles, pinned profileId selection, env keys, and inline keys (§3 shows the wire proof; three new resolver tests pin the behavior).
  • [P2] adapter scope — no-auth synthesis is restricted to openai-completions; --custom-no-auth + non-openai compatibility is rejected in parse and apply; the wizard re-prompts for a key when a blank-key no-auth choice meets a later non-openai compatibility selection (requires a key when no-auth is chosen but a non-openai compatibility is selected).
  • [P2] credential replacement crash — non-interactive no-auth skips ambient credential resolution entirely (skips credential resolution when custom no-auth is selected); the replacement branch can no longer receive an empty profile set.

All touched suites green locally: model-auth (44), onboard-custom (12), onboard-custom-config (29), auth-choice (24), onboard (54), plus the guided custom-provider e2e run out-of-tree (17) and pnpm tsgo:core:test, docs-baseline and ratchet checks.

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).
@rubencu
rubencu force-pushed the fix/custom-endpoint-no-auth branch from a1a93ff to 658e724 Compare October 15, 2026 11:23
@steipete

Copy link
Copy Markdown
Contributor

/allow-security-sensitive-change

@steipete

Copy link
Copy Markdown
Contributor

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@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: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Oct 16, 2026
@steipete

Copy link
Copy Markdown
Contributor

/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.
@steipete

Copy link
Copy Markdown
Contributor

/allow-security-sensitive-change

@steipete

Copy link
Copy Markdown
Contributor

/allow-security-sensitive-change

@steipete
steipete merged commit 574479a into openclaw:main Oct 16, 2026
138 checks passed
@steipete

Copy link
Copy Markdown
Contributor

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 17, 2026
…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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling cli CLI command changes commands Command implementations docs Improvements or additions to documentation merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. security-sensitive-changed size: XL status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Custom endpoint setup: blank API key produces a broken provider for auth-less servers outside loopback/RFC1918

2 participants