Repository navigation
fix(gateway): allow slash model ids in embeddings overrides - #161170
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. What this changesThe Gateway embeddings endpoint, which converts text into numeric vectors, accepts slash-containing model IDs without treating unknown prefixes as providers. Example: A client requests embeddings with x-openclaw-model: library/bge-m3.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR remains useful: current main still has the defect, the repair preserves the existing provider boundary, and no actionable patch findings remain. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe Gateway exposes an authenticated OpenAI-compatible embeddings endpoint. It selects an agent’s configured embedding provider, forwards input text and the selected model, and returns vectors. flowchart TD
A[Client text and model override] --> B[Gateway authentication and agent selection]
B --> C[Configured embedding provider]
C --> D{Recognized provider prefix?}
D -->|Unknown prefix| E[Preserve complete model ID]
D -->|Matching provider| F[Use model after prefix]
D -->|Different provider| G[HTTP 400]
E --> H[Configured provider returns vectors]
F --> H
Technical reviewBest possible solution: Keep model parsing in the Gateway handler and reuse the existing provider resolver while preserving configured-provider selection. Do we have a high-confidence way to reproduce the issue? Yes. Current-main source deterministically rejects library/bge-m3 for a configured Ollama provider, and the supplied baseline live run observes HTTP 400; this read-only review did not execute target code. Is this the best way to solve the issue? Yes. Consulting the existing provider resolver repairs the parsing error at its owner without adding another routing path or changing provider selection. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against a3cb823779cb. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource 0, Tests +16, Docs +2. Total +18 across 3 files. Added test files: 0. View PR surface stats
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 (4 earlier review cycles)
Reviewed October 9, 2026, 7:04 PM ET / 23:04 UTC (Revision 5). |
Ayushdevo
left a comment
There was a problem hiding this comment.
Reviewed the slash-model disambiguation. The new lookup keeps provider/model semantics for prefixes that resolve to a known embedding provider, while preserving slash-containing model IDs such as BAAI/bge-m3 for the configured provider. The tests cover both the configured-model path and the request-header override, plus the rejection of a different known provider. I don't see a blocker in this patch.
Merge current main while preserving the contributor commits. Keep provider selection constrained to the configured provider, forward opaque model IDs intact, and reuse memory config normalization. Co-authored-by: xialonglee <[email protected]>
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
…#161170) * fix(gateway): allow slash model ids in embeddings overrides * test(gateway): set explicit slash model in embeddings regression Co-authored-by: xialonglee <[email protected]>
What Problem This Solves
Fixes HTTP 400 responses from
/v1/embeddingswhen an explicitly configured model orx-openclaw-modeloverride contains a slash, such as Ollama'slibrary/bge-m3orhf:org/model.User Impact
Clients can use the complete embedding model ID with the agent's configured provider. A recognized prefix selecting a different provider still returns HTTP 400. The OpenAI
modelfield remains an OpenClaw agent target.Why This Change Was Made
The Gateway previously interpreted every slash as a provider separator. It now asks the existing embedding provider resolver whether the prefix names a provider; otherwise it forwards the full model ID. Redundant
autohandling is removed from this consumer because memory configuration already owns that normalization.Merged current main into the contributor branch and simplified the regressions into the existing HTTP fixture. Thanks @xialonglee for the original fix and regression; all contributor commits are preserved.
Compatibility: this changes request-time routing only. It does not write memory indexes or alter stored vectors, embedding metadata, schemas, migrations, configuration formats, or authentication. The after-proof reuses the isolated state/config created by main.
Evidence
Baseline: main
ea6022cae60c509d8c0e8029ad8030557a917617. Candidate:80c9550d4ec6ca86db2283d8521fcde245d5974b.pnpm buildpasses (20m 44.4s on the shared host). The matchingollama/bge-m3override also returns 200 with 1024 dimensions.openclaw/ci-gatepassed. Thechecks-node-changedjob took 254 s (whole-job duration, not isolated test-file timing); baseline ratchets took 94 s.Live proof uses the real built Gateway on port 19232 and real local Ollama and LM Studio models, with input
["alpha","beta"]:library/bge-m3library/nomic-embed-text/v1,library/bge-m3/v1,library/nomic-embed-texttext-embedding-nomic-embed-text-v1.5openaiprovider overrideThe native/compatible agents use
memory.search.providervaluesollamaandopenai-compatible, with remote URLshttp://127.0.0.1:11434andhttp://127.0.0.1:11434/v1; LM Studio uses port 1234. Representative request:The Gateway was started through
pnpm openclaw --profile gateway-embeddings gateway run --port 19232 --bind loopback, with isolatedOPENCLAW_STATE_DIRandOPENCLAW_CONFIG_PATH. Provider token usage is a separate PR; this routing change retains the existing usage response.