Skip to content

refactor(embeddings): share configured local-service contract - #188357

Merged
vincentkoc merged 4 commits into
mainfrom
refactor/embedding-e03-local-service-contract
Oct 30, 2026
Merged

vincentkoc merged 4 commits into
mainfrom
refactor/embedding-e03-local-service-contract

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Oct 30, 2026 •

Copy link
Copy Markdown
Member

Related: #188252

What Problem This Solves

Embedding providers and Memory Core duplicate the host’s configured local-service acquisition contract.

User Impact

Embedding behavior stays unchanged. Strict runtime callers retain explicit undefined reconciler support; process configuration remains host-owned.

Why This Change Was Made

Reuse the existing acquisition contract across bundled consumers and remove copied shapes and assertions. Preserve hook identity, lazy forwarding, readiness, cancellation and lease settlement. The bundled-only type export remains private.

Evidence

Scoped formatting, syntax, whitespace and commit checks passed. Fresh independent full-range review found no actionable findings. The strict consumer regression checks undefined acceptance, invalid reconciler rejection and forbidden process configuration.

The actual strict public SDK consumer passed in a qualified private native PR workspace: one test, 1.15 seconds. The final native declaration/API comparison of bffe87c..5b1a95f completed successfully: all 171 tracked exports remain reachable, with no entrypoint or export removals. Emitted declarations retain explicit undefined reconciliation; process configuration remains excluded from the acquisition target. This is compiler/declaration proof, not a substitute for runtime tests. Affected tests, type/lint and exact-head CI passed for this replacement head; see the run below.

The original-head CI had a separate PostgreSQL archive/config-alias conflict in unchanged backup/config files. Its failure remains investigated evidence, not a passing result or a claimed fix by this type repair.

Native landing evidence: required CI run 41072058147 passed for reviewed head 5b1a95f. Root inspected the full source cutover and fresh independent full-range review with no actionable findings. Personal dependency-backed execution remains unrun; exact-head CI supplies executable tests, types and lint proof. Observable production behavior and shipped contracts remain unchanged.

@vincentkoc vincentkoc self-assigned this Oct 30, 2026
@clawsweeper

clawsweeper Bot commented Oct 30, 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.

@vincentkoc
vincentkoc marked this pull request as ready for review October 30, 2026 13:19
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Oct 30, 2026
@clawsweeper

clawsweeper Bot commented Oct 30, 2026

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge.

What this changes

This PR gives embedding providers and Memory Core one shared type for acquiring configured local services.

Example: An SDK plugin creates embeddings through an Ollama service at http://127.0.0.1:11434.

  • Before: The injected acquisition hook required copied declarations or type assertions.
  • After: The creation options expose the existing hook directly, with unchanged service behavior.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) A focused, coherent consolidation supported by source inspection and passing targeted CI checks, with SDK qualification and one CI failure still unresolved.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored, behavior-preserving refactor is outside the ordinary contributor proof gate; no live runtime result is claimed.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Refactor · Worth it: Yes · Fix scope: Complete
User problem: No intentional user-visible change; duplicated hook contracts make embedding integrations harder to maintain accurately.
Reason: The maintainer-authored direction is established, the consolidation removes real duplication, and the shared type preserves existing optionality and ownership.

Merge readiness

⛔ Blocked before merge - 2 items remain

Keep this PR open: it is a useful, maintainer-directed consolidation, and no introduced correctness or security defect was found.

Priority: P3
Reviewed head: 6d3de347e76c357901f5e622905ad88d09780f5c

Before merge

  • Resolve merge risk - The PR owner must establish emitted SDK compatibility with the required frozen-base/head declaration comparison before merge.
  • Resolve merge risk - The CI owner must classify the PostgreSQL backup/config-write failure before landing; no diff-caused repair is established.

Findings

None.

Agent review details

How this fits together

Memory Core passes a host-injected acquisition hook to embedding adapters; the host leases the configured service, adapters perform requests, and leases are released after settlement.

flowchart LR
  A[Memory tools and CLI] --> B[Memory Core]
  B --> C[Embedding adapter]
  C --> D[Configured service host]
  D --> E[Managed local process]
  C --> F[Embedding HTTP request]
  F --> B
Loading

Technical review

Best possible solution:

Use the existing configured-service contract throughout the complete caller chain while retaining host lifecycle ownership.

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

This PR addresses source duplication rather than a reported runtime bug; inspection confirms the copied declarations and assertions on main.

Is this the best way to solve the issue?

The smallest complete refactor promotes the existing hook into creation options and replaces private copies across all affected callers, without introducing another lifecycle owner.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 03ba6b472028.

Merge-risk options

Maintainer options:

  1. Complete SDK qualification (recommended)
    Run the native SDK API comparison between bffe87c and 6d3de34 and verify that changes are compatible optional/type additions.
  2. Resolve CI attribution
    Compare the PostgreSQL failure with base evidence and route any demonstrated defect to its owning change.

Provenance checked

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Vincent Koc: Raw commit 52f8847 adds extensions/memory-core/src/memory/embedding-local-service.ts:17 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 52f88473d98e; files: extensions/memory-core/src/memory/embedding-local-service.ts)
  • wangmiao0668000666: Raw commit 6dd7b2e adds extensions/lmstudio/src/embedding-provider.ts:232 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 6dd7b2e00b3e; files: extensions/lmstudio/src/embedding-provider.ts)
  • Peter Steinberger: Raw commit 46fe514 adds extensions/lmstudio/src/embedding-provider.ts:40 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 46fe51413407; files: extensions/lmstudio/src/embedding-provider.ts)

PR surface

Source -47, Tests -4, Docs +11, Other -1. Total -41 across 23 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 17 40 87 -47
Tests 3 9 13 -4
Docs 2 11 0 +11
Config 0 0 0 0
Generated 0 0 0 0
Other 1 0 1 -1
Total 23 60 101 -41

Review metrics

Metric Value Why it matters
Production versus tests Production +40/-87; tests +9/-13 The net reduction removes duplicated declarations and assertions without adding runtime machinery.

Labels

Label changes:

  • add P3: This is behavior-preserving contract cleanup without an established user-facing failure.
  • add merge-risk: 🚨 compatibility: The public SDK gains an optional creation field and named type export; emitted declaration compatibility remains to be qualified.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.

Label justifications:

  • P3: This is behavior-preserving contract cleanup without an established user-facing failure.
  • merge-risk: 🚨 compatibility: The public SDK gains an optional creation field and named type export; emitted declaration compatibility remains to be qualified.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed October 30, 2026, 9:37 AM ET / 13:37 UTC.

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: M and removed size: S labels Oct 30, 2026
@vincentkoc
vincentkoc merged commit 82f046e into main Oct 30, 2026
160 of 161 checks passed
@vincentkoc
vincentkoc deleted the refactor/embedding-e03-local-service-contract branch October 30, 2026 15:15
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 31, 2026
…aw#188357)

* refactor(embeddings): share configured local-service contract

* docs(embeddings): scope service hook guidance to bundled providers

* fix(plugins): preserve explicit undefined local service reconciler

* test(plugins): guard strict local service reconciler typing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling docs Improvements or additions to documentation extensions: llama-cpp extensions: lmstudio extensions: memory-core Extension: memory-core extensions: ollama merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. plugin: file-transfer rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant