Repository navigation
fix(embeddings): reject malformed and empty provider vectors - #117200
Conversation
|
Codex review: needs maintainer review before merge. Reviewed July 31, 2026, 11:58 PM ET / August 1, 2026, 03:58 UTC. ClawSweeper reviewWhat this changesThis PR rejects empty, non-array, and non-finite embedding vectors returned by direct OpenAI-compatible requests and OpenAI/Voyage batch output before they reach the memory embedding engine. Merge readinessThis is a focused repair for a source-proven current-main defect: direct responses accept empty vectors and batch output accepts malformed values based only on Priority: P2 Review scores
Verification
How this fits togetherOpenClaw’s memory host obtains vectors from direct OpenAI-compatible embedding endpoints and from asynchronous provider batch files. The shared parsers validate those responses before the memory engine associates vectors with requests and uses them for indexing or retrieval. flowchart LR
A[Embedding request] --> B[Direct provider response]
A --> C[OpenAI or Voyage batch output]
B --> D[Direct vector validation]
C --> E[Batch vector validation]
D --> F[Memory embedding engine]
E --> F
D --> G[Visible embedding error]
E --> G
Before merge
Agent review detailsSecurityNone. PR surfaceSource 0, Tests +66. Total +66 across 4 files. View PR surface stats
Review metricsNone. Stored data modelPersistent data-model change detected: Technical reviewBest possible solution: Merge the shared validation repair after the exact head completes required checks, preserving the regressions that distinguish invalid vectors from valid zero-valued coordinates and an intentionally empty input batch. Do we have a high-confidence way to reproduce the issue? Yes. Current main plainly permits empty direct arrays and stores batch values after only a Is this the best way to solve the issue? Yes. Validating at the existing shared direct-response and batch-output producers is the narrowest maintainable fix, protecting both OpenAI and Voyage without provider-specific fallback behavior. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 9dfbf6a8a06c. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
…nclaw#117200) Co-authored-by: Peter Steinberger <[email protected]>
Summary
Root causes
readEmbeddingVectoraccepted empty arrays for nonempty requests, allowing direct embedding calls to return zero-dimensional vectors successfully.applyEmbeddingBatchOutputLinetrusted.lengthwithout checking array shape or finite numeric coordinates, allowing both OpenAI and Voyage batch output to store malformed values as embedding vectors.Verification
[[]]; full OpenAI and Voyage multipart-upload/batch/output pipelines each accepted["poison"].[email protected]SDK returns a valid[0.25], valid[[0]]is preserved, and zero-input batches still return[].pnpm tsgo:core,pnpm tsgo:test:packages, exact-four-path type-aware lint, 98/98 owner/OpenAI/Voyage/plugin tests across five shards, and the 11-request official-SDK localhost proof all passed.gpt-5.6-solhigh-reasoning structured autoreview through P3: zero findings, confidence 0.99.982add961804097f5a6b0b94255c5c855e8ad863all passed.