Repository navigation
refactor(embeddings): unify provider contract - #130506
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Resolved the attributable exact-head plugin-contract failure on child commit The canonical contract consolidation intentionally makes The repair adds that exact type-only alias to Updated full PR metrics: 68 paths; production +225/-530 (net -305), tests +435/-372 (net +63), docs +1/-1, tooling +0/-2; total +661/-905 (net -244). The prior exact-head lint cancellation was an infrastructure shutdown (exit 143, no diagnostic). This child head is receiving fresh exact-head CI; the failed old-head run will not be rerun. |
|
Codex review: needs maintainer review before merge. Reviewed August 26, 2026, 8:48 PM ET / August 27, 2026, 00:48 UTC. ClawSweeper reviewWhat this changesThis refactor lets provider plugins pass the shared embedding contract directly to memory, Gateway, and the CLI, deleting memory-specific contract translations. Merge readinessKeep open. Current main still translates generic embedding providers through the memory-specific adapter, while this PR makes the generic contract direct; the central cleanup is therefore not already implemented. The maintainer label and incomplete exact-head checks require normal maintainer handling. Priority: P2 Review scores
Verification
Live VerificationCommand: Result: PASS (completed) Assertions:
How this fits togetherProvider plugins turn query or document inputs into vectors used by Memory Core indexing and search, plus Gateway and CLI embedding requests. The change consolidates the private contract that carries input type, batching, and provider lifecycle across those callers. flowchart LR
A[Memory indexing and search] --> C[Shared embedding contract]
B[Gateway and CLI requests] --> C
D[Provider plugins] --> C
C --> E[Query or document handling]
E --> F[Local or remote provider]
F --> G[Embedding vectors]
Before merge
Agent review detailsSecurityNone. PR surfaceSource -304, Tests +39, Docs 0, Other -2. Total -267 across 73 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Land one canonical generic embedding contract only after exact-head provider, memory, Gateway, CLI, package-boundary, and build validation confirms existing query/document and lifecycle behavior remains intact. Do we have a high-confidence way to reproduce the issue? Not applicable: this is a behavior-preserving refactor rather than a reported defect. The relevant preservation paths are source-visible, but this read-only review did not execute them. Is this the best way to solve the issue? Yes, subject to exact-head validation: current main has two adapter translations, while the PR uses the already-established generic contract directly and preserves provider-specific query/document handling at each provider owner. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 42112dd86ec3. 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
HistoryReview history (1 earlier review cycle)
|
|
Resolved the remaining attributable changed-extension failure on child commit The broad memory shard correctly found five test fixtures that still modeled the deleted private The repair migrates only those test fixtures to the canonical methods and lets the shared provider type infer the input shape. It preserves counters, thrown errors, return vectors, and assertions. No production fallback, compatibility shim, public API change, or runtime behavior was added. Proof: genuine FTS, search, and LanceDB failures before the repair; changed suites 220/220 green; wider retry/lifecycle coverage 237/237 green; extension test types, format, lint, and diff checks green; fresh autoreview clean at 0.98 confidence. Updated full PR metrics: 73 paths; production +225/-530 (net -305), tests +455/-415 (net +40), docs +1/-1, tooling +0/-2; total +681/-948 (net -267). |
|
Final exact-head merge gates are satisfied on
Native preparation will refresh the current-main merge snapshot and fail closed on drift. No rebase, compatibility shim, or CI bypass is being used. |
|
Merged via squash.
|
* refactor(embeddings): unify provider contract * test(plugins): declare embedding type bridge * test(memory): migrate embedding fixtures
What Problem This Solves
Embedding providers were forced through a private memory-specific adapter layer even though they already implemented the generic embedding operations consumed by memory, Gateway, CLI, and plugin registration. That round trip duplicated provider metadata, request-shape conversion, and lifecycle plumbing across the registry and memory runtime.
Why This Change Was Made
This refactor makes the existing generic embedding provider contract canonical across the private runtime. Provider plugins register that contract directly, memory consumes it directly, and the obsolete memory adapter and registry projection layers are removed.
Remote-provider request grouping is now an explicit provider capability rather than an adapter-side inference. Provider-specific query/document behavior remains owned by each provider, including Ollama's existing option handling and LM Studio's lifecycle lease behavior.
The five public generic embedding API paths and their exported shapes are unchanged. There is no SQLite, protocol, ownership, or public API migration.
User Impact
This is intended to preserve embedding behavior while removing a large internal translation layer. Memory search, Gateway embedding calls, CLI capability reporting, provider lifecycle handling, and provider-specific batching continue through one typed contract.
Evidence
provider-adapters.tsand duplicate registry projection are deleted.src/plugins/embedding-provider-types.ts,src/plugins/embedding-providers.ts,src/plugins/embedding-provider-runtime.ts,src/plugin-sdk/embedding-providers.ts, andsrc/plugins/types.ts. Private memory facade types are migrated to the canonical contract.memory-host-sdktype-only alias to the canonical embedding provider contract; its focused RED 8/9 becomes GREEN 9/9, with 28/28 sibling guardrail tests green.embed/embedBatchmethods instead of the deleted privateembedQueryshape. Their focused failures become 220/220 green, with 237/237 wider retry and lifecycle coverage green.Follow-up
The existing Ollama dimension-option hook remains intentionally unchanged. A separate provider-owner follow-up can evaluate that pre-existing behavior without coupling a semantic change to this contract consolidation.