feat(embeddings): add OpenAI-compatible core provider#85269
Conversation
|
Codex review: found issues before merge. Reviewed May 27, 2026, 8:32 AM ET / 12:32 UTC. Summary PR surface: Source +620, Tests +1759, Docs -27. Total +2352 across 37 files. Reproducibility: yes. Source inspection shows current main keeps Review metrics: 1 noteworthy metric.
Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge Security Review findings
Review detailsBest possible solution: Land the provider and bridge only after preserving existing auto-selection for omitted/legacy provider configs, or after an explicit maintainer-approved migration plan; remove the release-owned changelog edit before merge. Do we have a high-confidence way to reproduce the issue? Yes. Source inspection shows current main keeps Is this the best way to solve the issue? No, not as written. The OpenAI-compatible provider is a useful direction, but it should be added without changing existing default/auto provider selection unless maintainers explicitly approve that migration. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model gpt-5.5, reasoning high; reviewed against 3e351b718e28. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +620, Tests +1759, Docs -27. Total +2352 across 37 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
|
ClawSweeper PR egg 🔥 Warming up: real-behavior proof passed; findings, security review, or rank-up moves are still in progress. Hatch commandComment Hatchability rules:
What is this egg doing here?
|
a697230 to
94187b6
Compare
94187b6 to
5fb22f3
Compare
9c7c026 to
03c021c
Compare
Co-authored-by: Soham Patankar <102520430+yaanfpv@users.noreply.github.com>
|
Merged via squash.
Thanks @dutifulbob! |
Summary
This replaces the earlier OpenAI-plugin-owned placement with the maintainer-requested shape:
openai-compatibleembeddings now live in core as a reusable generic embedding provider.openai-compatibleembedding provider for OpenAI-style/v1/embeddingsendpoints.api.registerEmbeddingProvider(...)/contracts.embeddingProvidersas the generic embedding-provider seam for external plugins, while the built-in OpenAI-compatible provider is available from core.memorySearch.provider: "openai-compatible"and compatiblemodels.providers.<id>aliases work.memorySearch.provider: "auto"and omitted provider config to OpenAI by default instead of priority-based provider auto-selection./v1/embeddingsendpoint through the same explicit memory/generic provider resolution path.Credit: Soham Patankar / @yaanfpv receives explicit credit in this PR body and via a
Co-authored-by: Soham Patankar <102520430+yaanfpv@users.noreply.github.com>trailer on the OpenAI-compatible provider implementation commit. Lineage starts with #80476 and #80479, continues through #84930 and #84947, and then through Mariano Belinky PRs #84991 and #84998.Verification
Rebased onto current
origin/main(4dfc2cf14a) and verified head051732d943:node scripts/run-vitest.mjs src/plugins/embedding-provider-runtime.test.ts src/plugins/embedding-providers.test.ts src/plugins/openai-compatible-embedding-provider.test.ts extensions/memory-core/src/memory/embeddings.test.ts extensions/memory-core/src/memory/generic-embedding-provider.bridge.test.ts extensions/memory-core/src/memory/generic-embedding-provider.integration.test.ts src/gateway/embeddings-http.test.ts src/agents/memory-search.test.ts src/cli/capability-cli.test.ts src/commands/doctor-memory-search.test.ts src/plugins/loader.test.ts-> passed, 12 files / 367 tests.node scripts/run-oxlint.mjs src/plugins/embedding-provider-runtime.ts src/plugins/embedding-provider-runtime.test.ts src/plugins/embedding-providers.ts src/plugins/embedding-providers.test.ts src/plugins/openai-compatible-embedding-provider.ts src/plugins/openai-compatible-embedding-provider.test.ts extensions/memory-core/src/memory/embeddings.ts extensions/memory-core/src/memory/embeddings.test.ts extensions/memory-core/src/memory/generic-embedding-provider.bridge.test.ts extensions/memory-core/src/memory/generic-embedding-provider.integration.test.ts src/gateway/embeddings-http.ts src/gateway/embeddings-http.test.ts src/agents/memory-search.ts src/agents/memory-search.test.ts src/cli/capability-cli.ts src/cli/capability-cli.test.ts src/commands/doctor-memory-search.ts src/commands/doctor-memory-search.test.ts src/config/schema.help.ts src/plugins/loader.test.ts-> passed.node --max-old-space-size=8192 --import tsx scripts/generate-plugin-sdk-api-baseline.ts --check-> passed.node scripts/sync-plugin-sdk-exports.mjs --check-> passed.node scripts/check-plugin-sdk-subpath-exports.mjs-> passed.node scripts/check-docs-mdx.mjs docs/concepts/active-memory.md docs/concepts/memory-builtin.md docs/concepts/memory-search.md docs/concepts/memory.md docs/gateway/doctor.md docs/help/faq.md docs/plugins/adding-capabilities.md docs/plugins/manifest.md docs/plugins/plugin-inventory.md docs/plugins/reference.md docs/plugins/reference/openai.md docs/plugins/sdk-overview.md docs/providers/bedrock.md docs/providers/github-copilot.md docs/reference/memory-config.md-> passed.pnpm format:docs:check docs/concepts/active-memory.md docs/concepts/memory-builtin.md docs/concepts/memory-search.md docs/concepts/memory.md docs/gateway/doctor.md docs/help/faq.md docs/plugins/adding-capabilities.md docs/plugins/manifest.md docs/plugins/plugin-inventory.md docs/plugins/reference.md docs/plugins/reference/openai.md docs/plugins/sdk-overview.md docs/providers/bedrock.md docs/providers/github-copilot.md docs/reference/memory-config.md-> passed.node scripts/run-tsgo.mjs -p tsconfig.core.json --incremental --tsBuildInfoFile .artifacts/tsgo-cache/core-openai-compatible-core-embeddings-rebased.tsbuildinfo-> passed.node scripts/run-tsgo.mjs -p test/tsconfig/tsconfig.extensions.test.json --incremental --tsBuildInfoFile .artifacts/tsgo-cache/extensions-test-openai-compatible-core-embeddings-rebased.tsbuildinfo-> passed.pnpm exec oxfmt --check --threads=1 ...on touched TS files -> passed.git diff --check-> passed.pnpm build-> passed.qwen2.5:3breturned real 2048-dimensional embeddings through the raw endpoint, direct provider adapter, and memory-core bridge.Real behavior proof
Behavior addressed: OpenClaw now has a core OpenAI-compatible embedding provider for
/v1/embeddingsendpoints; memory-core and the gateway can use it through explicit provider config without registering it as an OpenAI plugin memory adapter or keeping priority-based memory provider auto-selection.Real environment tested: local OpenClaw source checkout, plus earlier local Ollama 0.24.0 proof with already-installed model
qwen2.5:3b. No model was downloaded for the live proof.Exact steps or command run after this patch: rebased onto current
origin/main; ran the focused Vitest, tsgo, oxlint, SDK, docs, formatting, whitespace, and build commands listed above; earlier called local OllamaPOST /v1/embeddings, the OpenAI-compatible provider adapter, and the memory-core bridge against the same local endpoint.Evidence after fix: focused tests cover core provider registration, configured OpenAI-compatible aliases, SecretRef/env API key handling, gateway
/v1/embeddings, memory explicit-provider fallback to generic providers, legacyautonormalization to OpenAI, docs/doctor/CLI behavior, and rejection of unsupported multimodal generic providers. Earlier live proof returned this copied output from local Ollama through the raw endpoint, direct provider adapter, and memory bridge:{ "rawOllama": { "ok": true, "count": 1, "dimensions": 2048, "model": "qwen2.5:3b", "error": null }, "providerProof": { "provider": "openai-compatible", "model": "qwen2.5:3b", "queryDimensions": 2048, "batchCount": 2, "batchDimensions": [2048, 2048] }, "memoryBridgeProof": { "registered": [{ "ownerPluginId": "core", "id": "openai-compatible" }], "requestedProvider": "openai-compatible", "provider": "openai-compatible", "model": "qwen2.5:3b", "queryDimensions": 2048, "batchCount": 2, "batchDimensions": [2048, 2048] }, "gatewayBridgeProof": { "explicitProvider": "openai-compatible", "aliasProvider": "ollama-local", "httpEndpoint": "/v1/embeddings", "coveredBy": "src/gateway/embeddings-http.test.ts" }, "singleRegistrationCheck": { "newProvider": "openai-compatible", "registeredWith": "core embedding provider registry", "notRegisteredWith": "api.registerMemoryEmbeddingProvider" }, "aliasPrefixCheck": { "providerAlias": "ollama-local", "configuredModel": "ollama-local/qwen2.5:3b", "requestModel": "qwen2.5:3b" }, "secretRefCheck": { "missingEnvTemplate": "throws unresolved SecretRef instead of sending literal template" } }Observed result after fix: explicit
memorySearch.provider: "openai-compatible"resolves to the core generic provider, compatiblemodels.providers.<id>aliases reuse configured base URL/auth/headers/model prefix handling, unresolved env-template secrets fail closed, gateway embeddings use the same explicit provider path, generic text-only providers are rejected for multimodal memory configs, and omitted/legacyautomemory provider config resolves to OpenAI by default.What was not tested: hosted OpenAI-compatible services beyond local Ollama were not called after this patch.