Skip to content

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

Merged
Patrick-Erichsen merged 8 commits into
openclaw:mainfrom
ekinnee:codex/embedding-batch-runtime-contract
Sep 11, 2026
Merged

Patrick-Erichsen merged 8 commits into
openclaw:mainfrom
ekinnee:codex/embedding-batch-runtime-contract

Conversation

@ekinnee

@ekinnee ekinnee commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

External embedding-provider plugins need a public typed contract for provider-owned asynchronous batch jobs. The memory host already supports batchEmbed(...) and source-wide batching, but those capabilities are only described by internal memory types on current main.

This restores the work from #126772, which closed when its source fork was deleted. The refresh incorporates the contract unification from #130506; the private-local adapter introduced by #139911 does not provide this public typed batch surface.

Why This Change Was Made

Expose EmbeddingBatchChunk, EmbeddingBatchOptions, and EmbeddingProviderBatchRuntime through openclaw/plugin-sdk/embedding-provider-runtime-contract. The capability contains the batch callback and optional boolean sourceWideBatchEmbed; cache identity, aliases, and timeout metadata remain internal. Only true opts into source-wide batching, preserving existing false/omitted behavior and normal object inference.

The generic runtime composes the optional capability. Memory-specific options extend the same canonical text contract with their internal multimodal input. This removes duplicate option fields without reintroducing the adapters removed upstream. Package export maps and the SDK surface budget are regenerated for one public subpath and three type exports.

User Impact

Provider plugins, including OpenAI-compatible routing plugins, can type their asynchronous text-batch implementation without importing internal memory metadata. The host's batching algorithm, fallback behavior, configuration, and persisted state are unchanged.

Evidence

Full build, changed-file gates, and review validated 98050cee974ebb509bad3704799ea094fcf27158 on base 4032753c9e91af0c94b0bd83107d00a44d0887ee. Final candidate 9d509b65f7a88b17cd3c2e8c4ecc1d752b925ce8 rebases that patch onto 8184a1107dfd26c2a7003112cdafbad1571d182a. The sole conflict was the SDK export budget: preserve upstream's added export and regenerate the combined count (4,449). No batch-contract behavior changed. After rebase, all 17 focused runtime/surface tests, export synchronization, and whitespace checks passed. Broad gates were not repeated for this mechanical counter resolution.

  • pnpm build:plugin-sdk:strict-smoke passed: all 153 public SDK subpaths and the real external NodeNext consumer verified; 53 built control-plane modules checked.
  • node scripts/run-vitest.mjs src/plugins/memory-embedding-provider-runtime.test.ts passed.
  • node scripts/run-vitest.mjs test/scripts/plugin-sdk-surface-report.test.ts passed all 10 tests outside the execution sandbox; the initial sandbox run prevented four subprocess assertions from receiving output.
  • The original external-consumer import failed before the change (TS2307) and passed against the built candidate with tsgo.
  • Fresh isolated Codex autoreview: scoped-clean at P0–P2, no findings.
  • node scripts/check-changed.mjs -- <all 13 changed paths> passed, including format, SDK surface/boundary guards, all typecheck lanes, dead-export scans, lint, and zero runtime import cycles.
  • pnpm docs:list and git diff --check passed.

Production/export metadata: 8 files, +49/-12 (net +37). The growth creates the missing public capability and package entry while removing duplicate memory option fields. Tests/consumer proof: +44/-1; SDK budget guard: +4/-2; documentation: +7/-3. No runtime implementation paths were added.

Real Behavior Proof

The changed boundary is a public type/package export. The external NodeNext consumer fails with TS2307 before the public subpath exists. The built-package consumer verifies all three public types, true/false/omitted source-wide settings, and rejection of internal cache policy. The runtime regression verifies that the registered provider's batch callback reaches the host unchanged.

AI-assisted: Codex

@clawsweeper

clawsweeper Bot commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation scripts Repository scripts size: S labels Aug 25, 2026
@ekinnee
ekinnee marked this pull request as ready for review August 25, 2026 21:42
@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. 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. labels Aug 25, 2026
@clawsweeper

clawsweeper Bot commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 10, 2026, 4:00 PM ET / 20:00 UTC (Revision 17).

ClawSweeper review

What this changes

Adds public TypeScript contracts that let embedding plugins describe asynchronous batch jobs without importing private memory types.

Merge readiness

⛔ Blocked before merge - 4 items remain

This remains a useful, distinct SDK addition: current main lacks the public contract, and the related merged refactors do not replace it. No actionable correctness defect was found; public API acceptance remains unresolved.

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

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, compatible type-surface addition with relevant package-consumer proof and no actionable correctness findings.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (terminal): The contributor's before/after external NodeNext consumer exercises the changed public package/type boundary against built artifacts, resolving the missing import and validating the narrowed contract; callback unit coverage is supplemental.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (terminal): The contributor's before/after external NodeNext consumer exercises the changed public package/type boundary against built artifacts, resolving the missing import and validating the narrowed contract; callback unit coverage is supplemental.
Evidence reviewed 7 items Public contract remains absent on main: Fetched main retains private embedding-provider exports without the proposed public runtime-contract subpath. Its generic runtime contains identity and timeout metadata but no typed asynchronous batch capability.
Latest release boundary: The v2026.9.3 package export map has the private embedding-providers and embedding-provider-adapter entries, but no embedding-provider-runtime-contract entry. The release file was inspected through GitHub after local historical blob retrieval failed.
Narrow capability with existing host semantics: The introduced contract exports text chunks, seven execution-option fields, and the batch capability; internal identity/cache metadata remains outside it. The existing memory host already supplies these options and tests sourceWideBatchEmbed strictly against true. These are OpenClaw-owned contracts with no dependency on the Codex harness or protocol.
Findings None None.
Security None None.

How this fits together

Memory indexing sends text chunks and execution options to registered embedding providers, which return vectors or request the existing fallback. The plugin SDK gives external providers a supported way to describe that batching capability.

flowchart LR
  A[Memory documents] --> B[Memory indexing host]
  C[Public batch contract] --> D[Registered embedding plugin]
  B --> E{Batch capability available}
  E -->|Yes| D
  E -->|No| F[Inline embedding fallback]
  D --> G[Embedding vectors]
  F --> G
Loading

Decision needed

Question Recommendation
Should these batch execution options become a supported public plugin SDK contract, with one new subpath and three exported types? Accept the narrow public contract: Approve this batch-only API and its budget increase while retaining private ownership of cache and identity metadata.

Why: The implementation is narrow and preserves runtime behavior, but supporting this API and expanding its budget requires maintainer intent that tests cannot establish.

Before merge

  • Resolve merge risk (P1) - Publishing host batch execution options creates a lasting third-party compatibility commitment; acceptance of that public shape and its SDK budget increase is not established.
  • Complete next step (P2) - Obtain SDK-owner acceptance of the public batch contract and its surface-budget increase.
  • Resolve maintainer decision - Resolve the maintainer decision shown above before merge.
  • Add data-model compatibility proof - Confirm migration or upgrade compatibility proof before merge.
Agent review details

Security

None.

PR surface

Source +28, Tests +21, Docs +4, Config +8, Other +25. Total +86 across 13 files.

View PR surface stats
Area Files Added Removed Net
Source 5 40 12 +28
Tests 1 22 1 +21
Docs 2 7 3 +4
Config 2 8 0 +8
Generated 0 0 0 0
Other 3 27 2 +25
Total 13 104 18 +86

Review metrics

Metric Value Why it matters
Public API expansion 1 subpath and 3 type exports; 0 new configuration options The lasting maintenance cost is the supported plugin contract, while runtime scheduling and stored settings remain unchanged.

Stored data model

Persistent data-model change detected: vector/embedding metadata: packages/plugin-sdk/src/embedding-provider-runtime-contract.ts, vector/embedding metadata: src/plugin-sdk/embedding-provider-runtime-contract.ts, vector/embedding metadata: src/plugins/embedding-provider-runtime-types.ts, vector/embedding metadata: src/plugins/embedding-provider-types.ts. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster

Relationship: canonical
Canonical: #129625
Summary: This is the active public batch-contract proposal; the predecessor is closed unmerged and the merged refactors address distinct internal boundaries.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge-risk options

Maintainer options:

  1. Accept the supported API boundary (recommended)
    Record SDK-owner acceptance of the batch options, optional source-wide flag, and associated surface-budget increase.
  2. Pause pending a narrower API
    Keep the proposal unmerged if maintainers want a different long-term batch execution contract.

Technical review

Best possible solution:

Adopt a supported batch-only contract shared by generic and memory providers, with SDK-owner acceptance and existing fallback and per-file defaults preserved.

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

Not applicable as a runtime bug: this adds a supported SDK capability. Current source confirms the missing public import, and contributor evidence records TS2307 before the addition.

Is this the best way to solve the issue?

Yes, technically: the shared batch-only type owner avoids duplicate options and keeps internal metadata private; accepting it as a supported public API remains a maintainer decision.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 7e1b9a63cf64.

Labels

Label justifications:

  • P2: This is a bounded improvement for external embedding-plugin authors without an established urgent runtime regression.
  • merge-risk: 🚨 compatibility: The new public plugin API commits the host to supporting execution-option semantics that were previously private.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit 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 contributor's before/after external NodeNext consumer exercises the changed public package/type boundary against built artifacts, resolving the missing import and validating the narrowed contract; callback unit coverage is supplemental.
  • proof: sufficient: Contributor real behavior proof is sufficient. The contributor's before/after external NodeNext consumer exercises the changed public package/type boundary against built artifacts, resolving the missing import and validating the narrowed contract; callback unit coverage is supplemental.

Evidence

What I checked:

  • Public contract remains absent on main: Fetched main retains private embedding-provider exports without the proposed public runtime-contract subpath. Its generic runtime contains identity and timeout metadata but no typed asynchronous batch capability. (src/plugins/embedding-provider-types.ts:24, 7e1b9a63cf64)
  • Latest release boundary: The v2026.9.3 package export map has the private embedding-providers and embedding-provider-adapter entries, but no embedding-provider-runtime-contract entry. The release file was inspected through GitHub after local historical blob retrieval failed. (package.json:725, 1391f7cd2d40)
  • Narrow capability with existing host semantics: The introduced contract exports text chunks, seven execution-option fields, and the batch capability; internal identity/cache metadata remains outside it. The existing memory host already supplies these options and tests sourceWideBatchEmbed strictly against true. These are OpenClaw-owned contracts with no dependency on the Codex harness or protocol. (src/plugins/embedding-provider-runtime-types.ts:7, d09c7cd45468)
  • Package-consumer proof matches the changed boundary: The captured PR body at sourceRevision 0d13e6967872f3a4ca5cad55232a136fc2df809ff7b55762011fcfcced136a33 reports an external NodeNext consumer failing with TS2307 before the addition and passing against built SDK artifacts afterward. The inspected verifier imports all three types, accepts true/false/omitted batching flags, and rejects internal cache metadata. This demonstrates the package/type boundary; the mocked callback regression is supplemental, not live provider-job evidence. (scripts/check-plugin-sdk-exports.mts:90, d09c7cd45468)
  • Review continuity: The preceding completed review reported no findings and left public API acceptance unresolved. Comparing its head with the current head showed no changes to the public capability, facade, or package-consumer verifier. Git tree records also show the three new contract/facade files are identical to the body-described validated candidate; some older test blobs were unavailable, so no full historical validation-equivalence claim is made. (src/plugin-sdk/embedding-provider-runtime-contract.ts:1, d09c7cd45468)
  • Related work and source history: fix(plugin-sdk): expose async embedding batch runtime #126772 closed unmerged and is the contributor's predecessor proposal. The merged refactor(embeddings): unify provider contract #130506 unified the private provider contract while preserving public shapes; its GitHub commit patch shows the direct memory-provider delegation now at line 23. fix(gateway): reduce cold model-runtime request stalls #139911 added private runtime plumbing, not this public batch contract. (src/plugins/memory-embedding-provider-runtime.ts:23, 67d22a58acad)

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)
  • Patrick-Erichsen: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

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 (16 earlier review cycles; latest 8 shown)
  • reviewed 2026-09-07T18:33:45.922Z sha 9d509b6 :: blocked before merge. :: none
  • reviewed 2026-09-07T19:24:54.782Z sha 1cb3571 :: blocked before merge. :: none
  • reviewed 2026-09-07T21:03:12.672Z sha 0fbe54b :: blocked before merge. :: none
  • reviewed 2026-09-07T21:13:47.446Z sha c2efb65 :: blocked before merge. :: none
  • reviewed 2026-09-07T21:23:15.975Z sha efda968 :: blocked before merge. :: none
  • reviewed 2026-09-08T17:51:32.949Z sha efda968 :: blocked before merge. :: none
  • reviewed 2026-09-10T19:10:29.793Z sha 7329fb3 :: blocked before merge. :: none
  • reviewed 2026-09-10T19:29:45.208Z sha 860637e :: blocked before merge. :: none

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed 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. labels Aug 25, 2026
@ekinnee

ekinnee commented Aug 26, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

The P1 rank-up move is complete: the public facade now exports the batch-only EmbeddingProviderBatchRuntime, while identity and timeout metadata remain internal. The updated external-consumer fixture rejects internal-field leakage, and pnpm run build:plugin-sdk:strict-smoke passed all 11 build invocations with OK: All 148 public plugin-sdk subpaths verified.

Exact pushed head: a6f391aa4901440ee7175d875c75e3a4fc9f1835 (parent 394e79e1631bb2ae3b2a250343e283af95becede).

@clawsweeper

clawsweeper Bot commented Aug 26, 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 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: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 26, 2026
@ekinnee

ekinnee commented Aug 27, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown
Contributor

Codex Review: Didn't find any major issues. You're on a roll.

Reviewed commit: a6f391aa49

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@ekinnee
ekinnee marked this pull request as draft August 28, 2026 14:19
@ekinnee
ekinnee force-pushed the codex/embedding-batch-runtime-contract branch from a6f391a to 98050ce Compare September 7, 2026 18:00
@ekinnee
ekinnee force-pushed the codex/embedding-batch-runtime-contract branch from 98050ce to 9d509b6 Compare September 7, 2026 18:03
@ekinnee
ekinnee marked this pull request as ready for review September 7, 2026 18:04
@ekinnee

ekinnee commented Sep 7, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Sep 7, 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:

@roboclaw-bot roboclaw-bot added the clawtributor-review Clawtributor pull request awaiting prioritized maintainer review label Sep 8, 2026
@Patrick-Erichsen

Copy link
Copy Markdown
Contributor

Landing review complete for d09c7cd4546826c774dda25d8e79cfe66520a66d.

Maintainer decision: accept the narrow public batch contract and its increase of one SDK subpath and three type exports. The public surface contains text chunks, execution options, and the provider batch callback; cache identity and other host metadata stay internal. This resolves the API-acceptance/next-step items in the latest ClawSweeper review. Its data-model migration item is inapplicable: this patch changes types and package exports, with no persisted-data, schema, provider-job, scheduling, or fallback implementation change.

Before/after proof: the contributor recorded TS2307 when an external NodeNext consumer imported the absent subpath. Current main still lacks that export. On the exact candidate head, CI build-artifacts job 103024464525 ran check-plugin-sdk-exports successfully and reported all 153 public SDK subpaths verified. Its real package consumer imports all three types, accepts true/false/omitted source-wide settings, and rejects internal cache policy. Direct host/provider inspection confirms the existing per-file default and source-wide opt-in semantics remain unchanged.

Validation:

  • Fresh Codex autoreview: autoreview --mode branch --base efefa622e2dfdacf6ecd64e8af4f24a57b3db827, scoped-clean at default P0, exit 0.
  • git diff --check efefa622e2dfdacf6ecd64e8af4f24a57b3db827 pr-129625 passed.
  • Native review artifacts validated via scripts/pr review-init 129625, review-checkout-main, review-checkout-pr, review-artifacts-init, and review-validate-artifacts.
  • OPENCLAW_TESTBOX=1 scripts/pr prepare-run 129625 passed using exact-head CI 34522784111 and Workflow Sanity 34522784230. Dedicated Blacksmith Testbox workflows were classified as not applicable by the repository verifier.

Production/export metadata: +49/-12 (net +37); tests/consumer proof: +44/-1; SDK budget guard: +4/-2; docs: +7/-3. The new shared contract removes duplicate memory option fields. No additional adapter or runtime path is needed.

Proof limit: no live embedding-provider job was submitted; the changed boundary is the compiled public package/type contract. The original failing consumer evidence is contributor-supplied, while the current-head passing package build was independently verified. Thanks @ekinnee.

@Patrick-Erichsen
Patrick-Erichsen merged commit 99a3f51 into openclaw:main Sep 11, 2026
226 checks passed
@Patrick-Erichsen

Copy link
Copy Markdown
Contributor

Merged via squash.

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

Labels

clawtributor-review Clawtributor pull request awaiting prioritized maintainer review 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.

3 participants