Repository navigation
fix(ai): require explicit endpoints for compatible providers - #130453
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 26, 2026, 6:17 PM ET / 22:17 UTC. ClawSweeper reviewWhat this changesThe PR rejects non-OpenAI Responses or Completions models with a blank endpoint before creating an OpenAI SDK client, while preserving OpenAI’s SDK-default endpoint behavior. Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readinessKeep this maintainer-authored, maintainer-labeled PR open for normal merge review. The shared guard covers the four OpenAI-compatible client constructors and the PR supplies focused terminal proof, but fail-closed endpoint behavior is upgrade-sensitive and needs exact-head current-main/SDK confirmation. Priority: P2 Review scores
Verification
Live VerificationCommand: Result: FAIL (partial) — step 2 Assertions:
How this fits togetherOpenClaw’s AI package converts provider model metadata into OpenAI SDK clients for Responses and Completions requests. Those clients carry provider credentials to the configured HTTP endpoint. flowchart LR
A[Provider model metadata] --> B[OpenAI-compatible transport]
B --> C[Endpoint validation]
C -->|OpenAI| D[SDK default endpoint]
C -->|Other provider with URL| E[Configured SDK client]
C -->|Other provider without URL| F[Actionable configuration error]
E --> G[Provider HTTP endpoint]
Decision needed
Why: The patch deliberately changes provider routing from SDK fallback to a hard configuration error, so current user configuration and upgrade intent cannot be inferred from the branch alone. Before merge
Agent review detailsSecurityNone. PR surfaceSource +30, Tests +57. Total +87 across 8 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Copy recommended automerge instructionTechnical reviewBest possible solution: Keep one shared endpoint rule, verify the installed OpenAI SDK and current catalog/config upgrade paths on the exact head, then land only if blank non-OpenAI endpoints are confirmed invalid or have a supported repair path. Do we have a high-confidence way to reproduce the issue? No live current-main reproduction was run in this read-only checkout; source shows that an absent endpoint reached each OpenAI SDK constructor before this patch, and the PR body records an after-fix local-server probe. Is this the best way to solve the issue? Likely yes: a single shared guard at the client-construction boundary avoids provider-specific bypasses, subject to upgrade-path and installed-SDK confirmation. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 86e208310ff2. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
* origin/main: (275 commits) fix(ai): require explicit compatible-provider endpoints (#130453) test(control-ui): guard the hand-mirrored theme --bg copies (#130444) fix(onboard): preserve the saved skills package manager (#130438) improve(worker): diagnose admission-deadline failures and widen daemon revalidation budget (#130435) fix(plugins): align diffs external install metadata (#130362) refactor(models): consolidate config normalization (#130439) fix(browser): accept common keyboard aliases (#130401) fix(release): refresh IMAP plugin baselines (#130351) fix(tests): type sticky model agent fixtures (#130441) fix(qa): track current Slack progress cards (#130354) feat(ui): refine the mobile composer (#130308) fix(ui): clarify gateway disconnect status in tab title (#130364) test(qa): await gateway startup before network probes (#130353) fix(qa): run Buzz profile scenarios with pooled credentials (#130316) fix(crabbox): keep the setup failure reason and name its phase (#130425) fix: dashboard tools target the wrong Gateway after admission (#130112) fix(ui): distinguish inherited model defaults from session pins (#120805) feat(feishu): let agents resend received stickers (#130374) refactor(models): prepare selection policy once (#130413) fix(ui): make dashboard side panels enter split view (#130426) ... # Conflicts: # test/scripts/docker-build-helper.test.ts
What Problem This Solves
Fixes an issue where an OpenAI-compatible provider with incomplete endpoint metadata could inherit the OpenAI SDK's default endpoint instead of failing closed.
Why This Change Was Made
OpenAI remains allowed to use its SDK default. Every other provider must now supply an explicit base URL before an OpenAI Responses or Completions client is constructed.
The check lives at the shared OpenAI-compatible transport boundary and covers both package and managed Responses/Completions clients. This avoids a provider-specific exception and keeps Azure on its existing dedicated client path.
Alternatives considered:
User Impact
OpenAI-compatible providers with valid configured endpoints continue to work normally. If provider metadata is incomplete, the request now stops with an actionable configuration error before an SDK client or request is created.
Production LOC: +36/-6 (net +30) | Tests: +58/-1
The production growth establishes one explicit endpoint invariant across four existing client constructors.
Evidence
Real behavior proof
Claim: a non-OpenAI provider without an endpoint is rejected before SDK client construction, while the same provider with an explicit endpoint sends only to that configured origin.
Exercised surface: the production
createOpenAIResponsesClientboundary using the real installed OpenAI SDK and a local HTTP server. The probe used a sentinel credential; no live provider or real credential was involved.Environment: local Node runtime, exact commit
b48a1d3003456412bdd9a4da6aa11b80c7b9688f.Command:
node --import tsx --input-type=modulewith an inline production-boundary probe.Observed terminal output:
{ "head": "b48a1d3003456412bdd9a4da6aa11b80c7b9688f", "missingEndpoint": "blocked before SDK client construction", "configuredEndpoint": "request reached only the configured loopback origin", "requestPath": "/v1/responses", "credential": "sentinel bearer observed only at configured loopback origin" }Limits: this proves real SDK construction and HTTP destination binding without contacting an external provider. Model-resolution fallback reachability is covered by source tracing and the regression tests below.
Regression and sibling coverage
git diff --checkpassed.