Repository navigation
fix: LiteLLM model discovery fails with 404 when baseUrl ends in /v1 - #149472
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. |
|
Codex review: needs maintainer review before merge. Reviewed September 15, 2026, 10:45 PM ET / September 16, 2026, 02:45 UTC (Revision 2). ClawSweeper reviewWhat this changesThe LiteLLM plugin selects the model-discovery path according to whether the configured proxy URL already ends in /v1, with regression coverage for supported URL forms. Merge readiness✅ Ready for maintainer review Keep open: the endpoint defect remains on current main and in v2026.9.4. This focused repair has relevant HTTP proof and no actionable correctness findings. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw’s LiteLLM plugin supplies model discovery with the configured proxy URL and credentials. The shared catalog transport requests model rows and returns discovery outcomes to the catalog dispatcher. flowchart LR
A[Configured proxy URL] --> B[LiteLLM discovery hook]
B --> C{Base ends in v1?}
C -->|Yes| D[Append models]
C -->|No| E[Append v1/models]
D --> F[Shared HTTP catalog transport]
E --> F
F --> G[Model rows and discovery outcome]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +9, Tests +66. Total +75 across 2 files. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep endpoint selection in the LiteLLM plugin while preserving configured inference URLs and the shared transport, authentication, and cache owners. Do we have a high-confidence way to reproduce the issue? Yes: current source deterministically appends v1/models to a configured /v1 base, and the supplied HTTP capture corroborates that failure. This review did not execute a current-main reproduction. Is this the best way to solve the issue? Yes: the existing plugin hook can choose the correct relative endpoint without changing shared URL semantics, public APIs, or stored configuration. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against e853a4b9012d. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
landpr-approve-admin-merge |
|
Thanks @masatohoshino! Proof: A proxy base ending in
|
…penclaw#149472) Closes openclaw#149471 ## What Problem This Solves LiteLLM discovery appends `/v1/v1/models` when the proxy base already ends in `/v1`, as documented for remote onboarding. ## Why This Change Was Made The LiteLLM catalog hook alone selects the relative endpoint: `models` for versioned bases, `v1/models` otherwise. The shared URL join stays unchanged; no state writer is added. `index.ts` grows by 9 lines for this selection. Growth accepted under the owner's standing acceptance (2026-09-15). ## User Impact Versioned proxy URLs reach the supported model-list endpoint without changing inference URLs. ## Evidence After non-interactive onboarding, with an explicit synthetic provider key and empty configured rows: `openclaw models list --provider litellm --refresh --json` - Before: one `GET /v1/v1/models` → 404. - After: one `GET /v1/models` → 200. - Registered discovery returns the proxy row and reports `ready` to the shared dispatcher. - Unversioned, trailing-slash, prefixed and mixed-case-key controls pass. Inference request URLs remain unchanged. These captures use a disposable HTTP proxy. Follow-up: onboarding alone made no discovery request; the request comparison uses the explicit-key setup above. Successful discovery still displayed zero CLI rows, and the reported warning did not reproduce. These separate setup and display problems remain unresolved. ## Compatibility No configuration, SDK or shared transport contract changes. ## Consumers LiteLLM live discovery uses the existing shared catalog dispatcher. ## Invalidation Existing endpoint and credential cache keys and refresh behavior remain in use. ## Tests 20 LiteLLM tests and 4 MiniMax sibling tests pass on the merged source. Registered-hook HTTP captures confirm returned rows and outcomes. Co-authored-by: Ayaan Zaidi <[email protected]>
) Related: #149472 ## What Problem This Solves Without a Gateway, `models list --refresh` could exit with no discovered rows after a successful proxy response. ## Why This Change Was Made The decision `whether refresh can outlive its caller` is made by exactly one mechanism at `src/agents/prepared-model-runtime.catalog-access.ts:658`; this state has one writer. Gateway refresh keeps its bounded wait. `catalog-access.ts` +5 lines; `build.ts` -1. Growth accepted under the owner's standing acceptance (2026-09-15). ## User Impact The command prints completed discovery instead of silently returning an earlier catalog. ## Evidence `openclaw models list --provider litellm --refresh --json`: before, one GET `/v1/models` returned 200 but JSON had zero rows; after, one GET returned 200 and JSON listed the returned row. Twenty CLI tests and the Gateway pending control pass after merging main. Authored and unrelated provider JSON is byte-identical; failures warn. ## Compatibility No JSON, SDK, or configuration change. The separate onboarding seed restriction needs its follow-up fix. ## Consumers Standalone catalog refresh callers wait for completion. Gateway and ordinary reads keep existing behavior. ## Invalidation Existing refresh, discovery deadlines, and owner replacement rules remain in place. ## Tests Held discovery fails with the old behavior and passes with the fix. The existing Gateway control still returns pending before discovery completes. Co-authored-by: Ayaan Zaidi <[email protected]>
…claw#149752) Related: openclaw#149472 ## What Problem This Solves Without a Gateway, `models list --refresh` could exit with no discovered rows after a successful proxy response. ## Why This Change Was Made The decision `whether refresh can outlive its caller` is made by exactly one mechanism at `src/agents/prepared-model-runtime.catalog-access.ts:658`; this state has one writer. Gateway refresh keeps its bounded wait. `catalog-access.ts` +5 lines; `build.ts` -1. Growth accepted under the owner's standing acceptance (2026-09-15). ## User Impact The command prints completed discovery instead of silently returning an earlier catalog. ## Evidence `openclaw models list --provider litellm --refresh --json`: before, one GET `/v1/models` returned 200 but JSON had zero rows; after, one GET returned 200 and JSON listed the returned row. Twenty CLI tests and the Gateway pending control pass after merging main. Authored and unrelated provider JSON is byte-identical; failures warn. ## Compatibility No JSON, SDK, or configuration change. The separate onboarding seed restriction needs its follow-up fix. ## Consumers Standalone catalog refresh callers wait for completion. Gateway and ordinary reads keep existing behavior. ## Invalidation Existing refresh, discovery deadlines, and owner replacement rules remain in place. ## Tests Held discovery fails with the old behavior and passes with the fix. The existing Gateway control still returns pending before discovery completes. Co-authored-by: Ayaan Zaidi <[email protected]>
Closes #149471
What Problem This Solves
LiteLLM discovery appends
/v1/v1/modelswhen the proxy base already ends in/v1, as documented for remote onboarding.Why This Change Was Made
The LiteLLM catalog hook alone selects the relative endpoint:
modelsfor versioned bases,v1/modelsotherwise. The shared URL join stays unchanged; no state writer is added.index.tsgrows by 9 lines for this selection.Growth accepted under the owner's standing acceptance (2026-09-15).
User Impact
Versioned proxy URLs reach the supported model-list endpoint without changing inference URLs.
Evidence
After non-interactive onboarding, with an explicit synthetic provider key and empty configured rows:
openclaw models list --provider litellm --refresh --jsonGET /v1/v1/models→ 404.GET /v1/models→ 200.readyto the shared dispatcher.These captures use a disposable HTTP proxy. Follow-up: onboarding alone made no discovery request; the request comparison uses the explicit-key setup above. Successful discovery still displayed zero CLI rows, and the reported warning did not reproduce. These separate setup and display problems remain unresolved.
Compatibility
No configuration, SDK or shared transport contract changes.
Consumers
LiteLLM live discovery uses the existing shared catalog dispatcher.
Invalidation
Existing endpoint and credential cache keys and refresh behavior remain in use.
Tests
20 LiteLLM tests and 4 MiniMax sibling tests pass on the merged source. Registered-hook HTTP captures confirm returned rows and outcomes.