Skip to content

fix(plugin-sdk): expose async embedding batch runtime - #126772

Closed
ekinnee wants to merge 3 commits into
openclaw:mainfrom
ekinnee:codex/embedding-batch-runtime-contract
Closed

ekinnee wants to merge 3 commits into
openclaw:mainfrom
ekinnee:codex/embedding-batch-runtime-contract

Conversation

@ekinnee

@ekinnee ekinnee commented Aug 20, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Third-party embedding-provider plugins could not type-safely opt into OpenClaw's documented asynchronous batching lifecycle. That blocked an OmniRoute provider plugin from owning its OpenAI-compatible /v1/files and /v1/batches lifecycle for large memory-index embedding jobs.

Why This Change Was Made

Add a narrow public SDK subpath, openclaw/plugin-sdk/embedding-provider-runtime-contract, containing only the text-batch runtime contract: EmbeddingBatchChunk, EmbeddingBatchOptions, and EmbeddingProviderRuntime. The broader embedding-providers facade remains private-local. The memory host retains its structured-input extension, scheduling, timeouts, fallback, and circuit-breaking. This does not add a generic file-store or raw provider HTTP API.

User Impact

Provider-plugin authors can implement batchEmbed and opt into source-wide batching through the new runtime-contract import. Existing providers remain compatible.

Evidence

  • pnpm tsgo:prod
  • node scripts/run-vitest.mjs run src/plugins/memory-embedding-provider-runtime.test.ts — 7 passed
  • node scripts/run-vitest.mjs run test/release-check.test.ts — 61 passed
  • pnpm plugin-sdk:check-exports — external package consumer compiles the new subpath
  • pnpm plugin-sdk:api:diff --base origin/main --head HEAD — one new entrypoint with three exports
  • pnpm build — all 147 public plugin-SDK subpaths verified
  • pnpm format:check
  • Structured autoreview: clean; no accepted/actionable findings

After-fix terminal proof

Executed at reviewed head 04df14279d4dde96b9a7cebe803b02a8d32b76ef.

pnpm build completed in 4m 48.4s and reached the public SDK artifact verifier:

[build-all] check-plugin-sdk-exports
Public plugin SDK declaration graph: 3097768/5315536 bytes (5250000-byte ratchet + 65536-byte output variance).
OK: All 147 public plugin-sdk subpaths verified.

The verifier was then run directly against that built output. It creates a temporary external consumer, imports openclaw/plugin-sdk/embedding-provider-runtime-contract, and runs its TypeScript compiler:

$ node --import tsx scripts/check-plugin-sdk-exports.mts
Public plugin SDK declaration graph: 3097768/5315536 bytes (5250000-byte ratchet + 65536-byte output variance).
OK: All 147 public plugin-sdk subpaths verified.

AI-assisted: Codex

@clawsweeper

clawsweeper Bot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added the docs Improvements or additions to documentation label Aug 20, 2026
@ekinnee
ekinnee marked this pull request as ready for review August 20, 2026 18:00
@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Aug 20, 2026
@clawsweeper

clawsweeper Bot commented Aug 20, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 24, 2026, 8:20 AM ET / 12:20 UTC.

ClawSweeper review

What this changes

The PR adds a public Plugin SDK subpath that lets embedding-provider plugins type provider-owned asynchronous text batching.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

Keep open for SDK-owner product acceptance. The implementation is a narrow, type-only public facade and the supplied terminal proof directly exercises external consumption, but merging makes batch controls and ordered-vector semantics a supported Plugin SDK contract without visible owner confirmation.

Priority: P2
Reviewed head: 04df14279d4dde96b9a7cebe803b02a8d32b76ef
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The patch is narrowly implemented and well-proven for a type-only surface; product acceptance of the resulting public contract remains separate.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): The PR body shows reviewed-head build output and a temporary external consumer compiling the new public subpath, directly proving the type-only package surface after the change.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The PR body shows reviewed-head build output and a temporary external consumer compiling the new public subpath, directly proving the type-only package surface after the change.
Evidence reviewed 5 items Narrow public contract: The new facade exports only batch chunk/options/runtime types, rather than exposing the broader private embedding-provider facade.
Runtime owner and caller: The memory host reads the runtime batch callback and invokes it with host-controlled batching parameters; the generic-to-memory bridge preserves the returned runtime object.
External-consumer proof path: The export checker creates a temporary external consumer and type-checks imports of the new public subpath; the PR body supplies reviewed-head successful output for that path.
Findings None None.
Security None None.

Live Verification

Command: pnpm build

Result: FAIL (partial) — step 2 expect_output All 147 public plugin-sdk subpaths verified.: expected terminal output was not visible within 30 seconds: "All 147 public plugin-sdk subpaths verified."

pnpm build
runner@runnervm76f27:/tmp/clawsweeper-live-proof-126772-9lcr3B/target$ pnpm build
$ node --import tsx scripts/build-all.mts
[build-all] plugins:assets:build
pnpm build
$ node --import tsx scripts/bundled-plugin-assets.mts --phase build
[canvas] build: node scripts/bundle-a2ui.mjs
[log] ‹DIR›/a2ui.bundle.js  chunk │ size: 399.96 kB
[log] ‹DIR›/a2ui-v0.9.bundle.js  chunk │ size: 615.66 kB
[log]
[success] rolldown v1.2.0 Finished in 103.31 ms
[diffs] build: node --import tsx ../../scripts/build-diffs-viewer-runtime.mts curated
[diffs-language-pack] build: node --import tsx ../../scripts/build-diffs-viewer-runtime.mts full
[discord] build: node --import tsx ../../scripts/build-discord-activity-sdk.mts
[build-all] plugins:assets:build done in 1.76s
[build-all] tsdown-ai
[PLUGIN_TIMINGS] Your build spent significant time in plugins. Here is a breakdown:
  - tsdown:deps (47%)
  - rolldown-plugin-dts:fake-js (22%)
  - rolldown-plugin-dts:generate (20%)
See https://rolldown.rs/reference/InputOptions.checks#plugintimings for more details.

[tsdown-build] invocation 1/1 finished in 4.6s
[build-all] tsdown-ai done in 5.21s
[build-all] tsdown-packages
[tsdown-build] invocation 1/1 finished in 19.5s
[build-all] tsdown-packages done in 20s
[build-all] tsdown-unified























Assertions:

  • FAIL expect_output: All 147 public plugin-sdk subpaths verified.

How this fits together

Embedding plugins register provider adapters, whose runtime metadata is adapted for the memory-index host. The host uses an optional batch callback to submit text chunks and receives ordered vectors for indexing.

flowchart LR
  A[Provider plugin] --> B[Public batch contract]
  B --> C[Embedding provider adapter]
  C --> D[Memory provider bridge]
  D --> E[Memory index host]
  E --> F[Ordered embedding vectors]
Loading

Decision needed

Question Recommendation
Should OpenClaw support this batch-runtime contract as a permanent public Plugin SDK subpath for third-party embedding providers? Approve the supported contract: Accept this narrow text-batch API and its ordering semantics as a supported Plugin SDK commitment.

Why: This is a new external API surface rather than a repair to an established public contract, so code review cannot determine its intended support and compatibility lifetime.

Before merge

  • Resolve merge risk (P2) - Merging publishes host-controlled batch fields, null fallback behavior, source-wide opt-in, and output-order expectations as a long-lived external Plugin SDK compatibility contract without visible SDK-owner acceptance.
Agent review details

Security

None.

PR surface

Source +33, Tests +34, Docs +3, Config +8, Other +11. Total +89 across 15 files.

View PR surface stats
Area Files Added Removed Net
Source 7 57 24 +33
Tests 2 35 1 +34
Docs 2 6 3 +3
Config 2 8 0 +8
Generated 0 0 0 0
Other 2 11 0 +11
Total 15 117 28 +89

Review metrics

Metric Value Why it matters
Production versus test delta production +76/-24, tests +35/-1, docs +6/-3 The production growth adds one public SDK entrypoint, type boundary, packaging metadata, and export verification for a new external contract.

Stored data model

Persistent data-model change detected: serialized state: test/release-check.test.ts, vector/embedding metadata: docs/plugins/sdk-overview.md, vector/embedding metadata: docs/plugins/sdk-subpaths.md, vector/embedding metadata: package.json, vector/embedding metadata: packages/plugin-sdk/package.json, vector/embedding metadata: packages/plugin-sdk/src/embedding-provider-runtime-contract.ts, and 6 more. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Approve the supported contract (recommended)
    Merge after an SDK owner explicitly accepts the public text-batch fields, ordered output requirement, and compatibility commitment.
  2. Keep the seam private-local
    Pause or close the PR if maintainers do not want third-party providers to depend on this lifecycle yet.

Technical review

Best possible solution:

Publish the narrow facade only after an SDK owner explicitly accepts the text-only batch scope, ordering guarantee, and compatibility commitment; otherwise retain the existing private-local seam.

Do we have a high-confidence way to reproduce the issue?

Not applicable: this PR adds a public SDK capability rather than repairing a reported runtime failure; its reviewed-head terminal proof does type-check an external consumer.

Is this the best way to solve the issue?

Unclear: the type-only facade is the narrowest technical shape, but only an SDK owner can decide whether this lifecycle should become a permanent public contract.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 03658a99a950.

Labels

Label justifications:

  • P2: This is a bounded provider-plugin capability decision rather than an urgent runtime regression.
  • merge-risk: 🚨 compatibility: The new public SDK subpath commits OpenClaw to externally consumed provider batching types and semantics.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR body shows reviewed-head build output and a temporary external consumer compiling the new public subpath, directly proving the type-only package surface after the change.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body shows reviewed-head build output and a temporary external consumer compiling the new public subpath, directly proving the type-only package surface after the change.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Current-main blame attributes the memory batching call site and its runtime contract snapshot to this commit; shallow history prevents a stronger introduction trail. (role: recent area contributor; confidence: medium; commits: 1f1d0e9d8f2b; files: extensions/memory-core/src/memory/manager-embedding-ops.ts, src/plugins/registry-contribution-types.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Obtain explicit SDK-owner acceptance for the permanent public contract before merge.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
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.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (7 earlier review cycles)
  • reviewed 2026-08-20T18:08:23.036Z sha 25243d771b171436c9ab2813afc211b701594972 :: needs real behavior proof before merge. :: [P1] Publish the typed embedding-provider contract
  • reviewed 2026-08-20T18:57:58.638Z sha 04df142 :: needs real behavior proof before merge. :: none
  • reviewed 2026-08-20T19:46:16.236Z sha 04df142 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-22T06:04:32.123Z sha 04df142 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-22T06:17:28.917Z sha 04df142 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-24T11:54:17.967Z sha 04df142 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-24T12:06:50.637Z sha 04df142 :: needs maintainer review before merge. :: none

@openclaw-barnacle openclaw-barnacle Bot added the scripts Repository scripts label Aug 20, 2026
@ekinnee

ekinnee commented Aug 20, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 20, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Aug 20, 2026
@ekinnee ekinnee closed this by deleting the head repository Aug 25, 2026
@ekinnee

ekinnee commented Aug 25, 2026

Copy link
Copy Markdown
Contributor Author

Recovery note: GitHub closed this PR when its source fork was deleted. Its exact-head continuation is #129625 at 0b8da8c, with no code or history changes during recovery. Please use #129625 for current review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. scripts Repository scripts size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant