Skip to content

fix: register memory runtime for OpenClaw 2026.4.1#449

Closed
ChaoYang78 wants to merge 1 commit intoCortexReach:masterfrom
ChaoYang78:fix/openclaw-2026.4.1-memory-runtime
Closed

fix: register memory runtime for OpenClaw 2026.4.1#449
ChaoYang78 wants to merge 1 commit intoCortexReach:masterfrom
ChaoYang78:fix/openclaw-2026.4.1-memory-runtime

Conversation

@ChaoYang78
Copy link
Copy Markdown
Contributor

Summary

Register a memory runtime adapter so memory-lancedb-pro is recognized as the active memory backend by OpenClaw 2026.4.1+.

Problem

After upgrading OpenClaw to 2026.4.1, the plugin still appeared to load successfully:

  • memory-lancedb-pro@1.1.0-beta.10: plugin registered
  • memory tools remained available

But OpenClaw system-level diagnostics still reported that no active memory plugin/runtime was available, for example:

  • No active memory plugin is registered for the current config.
  • memory status showed as unavailable even though the slot pointed to memory-lancedb-pro

This created a half-working state where the plugin looked loaded, but OpenClaw's runtime-facing memory integration could not treat it as an active backend.

Root cause

OpenClaw 2026.4.1 expects memory plugins to explicitly register a memory runtime via:

  • api.registerMemoryRuntime(...)

memory-lancedb-pro was not doing that yet.

What this PR changes

This PR adds a minimal runtime adapter that wires the existing plugin internals into OpenClaw's memory runtime contract:

  • getMemorySearchManager(...)
  • search(...)
  • readFile(...)
  • status()
  • probeEmbeddingAvailability()
  • probeVectorAvailability()
  • resolveMemoryBackendConfig()

The implementation intentionally reuses the plugin's existing store / retriever / embedder / scope resolution logic rather than introducing a second backend path.

Validation

Validated locally against OpenClaw 2026.4.1 by:

  1. loading the patched plugin
  2. restarting/reloading the gateway
  3. confirming the previous active-memory diagnostic disappeared
  4. verifying recall worked again through the memory toolchain
  5. verifying write -> recall -> delete roundtrip succeeded
  6. running openclaw doctor --non-interactive successfully with plugin errors = 0

Notes

This PR only includes the runtime-registration fix needed for OpenClaw 2026.4.1 compatibility. It intentionally excludes unrelated working-tree changes.

Copy link
Copy Markdown
Collaborator

@AliceLJY AliceLJY left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review: LGTM

Summary: Registers a memory runtime adapter via api.registerMemoryRuntime() so OpenClaw 2026.4.1+ recognizes memory-lancedb-pro as an active backend. Single file, single commit, focused change.

Verified:

  • All referenced internals exist and signatures match: resolveScopeFilter, scopeManager, retriever.retrieve, store.getById, store.stats, embedder.embedQuery, clampInt, basename, vectorDim, resolvedDbPath, getDefaultWorkspaceDir, config.embedding.model.
  • source: "manual" is a valid enum value for RetrievalContext.source.
  • store.getById(id, scopeFilter) and store.stats(scopeFilter) accept the correct parameter shapes.
  • Insertion point is correct (after tool registrations, before CLI commands section).

Observations:

  1. Reuses existing plugin internals rather than introducing a parallel backend path -- correct design choice.
  2. Lifecycle management is sound: close() and closeAllMemorySearchManagers() are intentional no-ops because the plugin owns the store lifecycle. Good.
  3. Input validation in readFile and search is defensive (clampInt, Math.max, Math.floor, type checks with fallbacks). Good.
  4. getById lookup by basename in readFile strips .md suffix before querying -- matches the synthetic path format from syntheticPathForId. Consistent.
  5. Minor note: scopeFilter is captured once at getMemorySearchManager call time. If scope resolution is meant to be dynamic per-call, this would need to move inside each method. However, given that OpenClaw creates managers per-agent and the existing plugin scope model is per-session, capturing at creation time is correct.

No bugs, no security issues, no unnecessary changes. Approved.


Reviewed by: AliceLJY (via Claude Code)

ChaoYang78 added a commit to ChaoYang78/memory-lancedb-pro that referenced this pull request Apr 2, 2026
@rwmjhb
Copy link
Copy Markdown
Collaborator

rwmjhb commented Apr 3, 2026

Review: register memory runtime for OpenClaw 2026.4.1

Verdict: request-changes | Confidence: 0.90 | Value: 45%

Important compatibility fix — without registerMemoryRuntime(), the plugin is invisible to OpenClaw 2026.4.1's backend discovery. One issue blocks merge:

Must Fix

api.registerMemoryRuntime() called unconditionally — crashes on older hosts and all test harnesses

index.ts:2099 calls api.registerMemoryRuntime(...) without checking if the method exists. This crashes:

  • plugin-manifest-regression.mjs:146 — TypeError at registration
  • reflection-bypass-hook.test.mjs — all 4 tests fail
  • Any mock API that doesn't stub this method (recall-text-cleanup.test.mjs, resolve-env-vars-array.test.mjs, etc.)

The OpenClaw SDK type definition (plugins/types.ts) also doesn't declare this method yet, so it's not guaranteed on all host versions.

Fix:

if (typeof api.registerMemoryRuntime === 'function') {
  api.registerMemoryRuntime({ ... });
}

This makes it backward-compatible with pre-2026.4.1 hosts and fixes all test failures. Update test mocks to include registerMemoryRuntime: () => {} for coverage of the new path.

Also

  • Rebase onto main (stale base)

Auto-reviewed by auto-pr-review-orchestrator | 6 rounds | Claude + Codex adversarial

@ChaoYang78
Copy link
Copy Markdown
Contributor Author

ChaoYang78 commented Apr 3, 2026 via email

@rwmjhb rwmjhb closed this Apr 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants