Skip to content

fix: add OpenClaw 2026.5 compiled runtime compatibility#755

Open
choucheyu wants to merge 6 commits into
CortexReach:masterfrom
choucheyu:chore/openclaw-2026-5-runtime-build
Open

fix: add OpenClaw 2026.5 compiled runtime compatibility#755
choucheyu wants to merge 6 commits into
CortexReach:masterfrom
choucheyu:chore/openclaw-2026-5-runtime-build

Conversation

@choucheyu
Copy link
Copy Markdown

Summary

This PR is scoped to OpenClaw 2026.5 runtime/plugin-contract compatibility for memory-lancedb-pro.

It includes:

  • ship compiled runtime output under dist/
  • point package.json / openclaw.extensions at ./dist/index.js
  • bump package + manifest version to 1.1.0-beta.11
  • declare registered agent tools in openclaw.plugin.jsoncontracts.tools
  • guard registerMemoryCapability for hosts/test stubs that do not expose it
  • fix backup/admission audit path double-resolution with api.resolvePath
  • load LanceDB through ESM dynamic import() instead of require() so the compiled ESM runtime works under OpenClaw 2026.5
  • update changelog notes

What this fixes

Validated locally against OpenClaw 2026.5.4:

  • no TypeScript runtime-entry warning from openclaw doctor
  • no contracts.tools registration error for this plugin
  • no require is not defined during retrieval / auto-recall
  • runBackup no longer fails from double-resolving an already-absolute dbPath
  • runtime plugin loads with embedding: OK, retrieval: OK, FTS: enabled
  • memory_store / memory_recall write-read path works against the existing LanceDB database

Related upstream work

Related to / overlaps parts of:

This PR intentionally does not pull in the full broad changes from #743/#750. It only applies the minimal path-resolution fix needed for backup/admission audit paths.

It also does not claim to resolve all OpenClaw 2026.5 issues in the repo; other categories like broader backup workflows, locks/bulk-store, reflection/dreaming, retrieval-quality, and import-markdown remain separate work.

Validation

Local validation performed:

  • npx tsc -p tsconfig.json
  • node --test test/reflection-bypass-hook.test.mjs
  • node test/plugin-manifest-regression.mjs
  • node --test test/sync-plugin-version.test.mjs
  • openclaw doctor --non-interactive
  • runtime load test in OpenClaw 2026.5.4
  • memory_store + memory_recall write-read marker test
  • LanceDB transaction timestamp confirmed updated after write

Runtime result after installing/syncing this branch locally:

  • plugin source: ~/.openclaw/extensions/memory-lancedb-pro/dist/index.js
  • version: 1.1.0-beta.11
  • startup: embedding: OK, retrieval: OK, FTS: enabled
  • backup: completed successfully with existing DB entries

@choucheyu choucheyu force-pushed the chore/openclaw-2026-5-runtime-build branch from a04a2e1 to ab56da4 Compare May 6, 2026 09:02
@isaacsummers
Copy link
Copy Markdown

Heads up — the src/store.ts change in this PR (switching require() to import() for @lancedb/lancedb) regresses the Windows ESM URL scheme fix from #267. Same issue raised on #757; full cross-platform fix using createRequire(import.meta.url) is in the comment there.

@choucheyu
Copy link
Copy Markdown
Author

Thanks for catching this. I updated this PR to use the cross-platform ESM-safe CJS loader pattern instead of dynamic import():

  • added createRequire(import.meta.url)
  • use a renamed requireCJS("@lancedb/lancedb") binding so bundlers do not rewrite a bare require() call
  • kept the promise cache around the LanceDB module load
  • updated both src/store.ts and the compiled dist/src/store.js

Validation run locally:

  • direct loadLanceDB() smoke test passes on macOS arm64 / Node v25.6.0
  • full npm test passes
  • synced the same change into my installed OpenClaw extension and restarted Gateway
  • openclaw memory-pro stats succeeds
  • memory CRUD smoke passed: store / recall / update / forget
  • checked Gateway logs after the installed-extension smoke; no LanceDB loader errors observed (no require is not defined, no dynamic require error, no failed LanceDB load)

New commit: 8bece29

@Dylanzhang1128
Copy link
Copy Markdown

Tested locally on OpenClaw 2026.5.6.

Current memory-lancedb-pro@1.1.0-beta.9 from npm cannot be installed through:

openclaw plugins install memory-lancedb-pro@beta

because the package still points at index.ts and does not ship compiled runtime output (dist/index.js). Manual tarball install works, but OpenClaw reports:

installed plugin package requires compiled runtime output for TypeScript entry index.ts

Runtime after manual install:

  • plugin loads as 1.1.0-beta.9
  • embedding: OK
  • retrieval: OK
  • mode: hybrid
  • FTS: enabled
  • openclaw memory-pro stats --json works and reports the existing LanceDB contents

One additional OpenClaw 2026.5.6 compatibility issue: agent_end is blocked unless the plugin declares:

"hooks": {
  "allowConversationAccess": true
}

Without this, smart extraction / auto-capture hooks are blocked for non-bundled plugins. This overlaps with #727. It may be worth folding #727 into this PR so the compiled runtime compatibility PR fixes both installability and runtime hook behavior.

@choucheyu
Copy link
Copy Markdown
Author

choucheyu commented May 7, 2026

Thanks for testing this on OpenClaw 2026.5.6.

I pushed one more commit to address the conversation hook gate you pointed out:

  • 73c1911 adds hooks.allowConversationAccess: true to openclaw.plugin.json
  • added a manifest regression assertion so this field does not get dropped later

I also re-checked the packaging side on this PR branch. The currently published npm beta is still 1.1.0-beta.9, which explains why openclaw plugins install memory-lancedb-pro@beta still resolves to the old package metadata / TS entrypoint. This PR branch is now at 1.1.0-beta.11, has main: dist/index.js, openclaw.extensions: ["./dist/index.js"], and npm pack --dry-run includes both openclaw.plugin.json and the compiled dist/index.js runtime output.

So the fresh-install failure should be covered once a beta is published from this branch, and the OpenClaw 2026.5.6 hook access requirement should now be declared in the manifest.

@choucheyu choucheyu force-pushed the chore/openclaw-2026-5-runtime-build branch from 99cc8ca to 73c1911 Compare May 7, 2026 08:33
@choucheyu
Copy link
Copy Markdown
Author

choucheyu commented May 8, 2026

9ffcbb4 addresses the two failing PR checks:

Local verification passed on the PR branch:

  • node test/issue606_sdk-migration.test.mjs
  • npx -y node@22 test/issue606_sdk-migration.test.mjs
  • npm run test:packaging-and-workflow
  • npm run test:core-regression
  • git diff --check

Installed extension verification on OpenClaw 2026.5.7 also passed after syncing the same patch into /Users/choucheyu/.openclaw/extensions/memory-lancedb-pro:

  • OpenClaw version: 2026.5.7 (eeef486)
  • openclaw config validate passed
  • node test/issue606_sdk-migration.test.mjs passed
  • npm run test:packaging-and-workflow passed
  • npm run test:core-regression passed
  • Gateway probe passed after restart
  • memory-lancedb-pro is loaded from the installed extension path
  • OpenClaw health reports plugin errors as empty ([])

GitHub Actions for the new head currently show action_required, so the workflow may need maintainer approval before checks rerun.

Copy link
Copy Markdown

@app3apps app3apps left a comment

Choose a reason for hiding this comment

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

Reviewing current head 9ffcbb4. Requesting changes because the compiled-runtime compatibility direction is valuable, but the current branch still has build/runtime blockers.

  1. ./node_modules/.bin/tsc -p tsconfig.json --noEmit --pretty false still exits with code 2 on this PR branch. Representative errors include index.ts:2285 (parseReflectionMetadata is not defined), index.ts:2286 (isReflectionMetadataType / isOwnedByAgent are not defined), multiple config.declaredAgents errors against PluginConfig, and retrieval-context object literals passing source where the type does not allow it. Since tsconfig.json:18 has noEmitOnError: false, dist can be generated even while these errors remain, which is risky for a PR whose purpose is to ship compiled runtime output.

  2. The generated dist/index.js still contains undefined runtime references in the legacy reflection fallback path: dist/index.js:1735-1736 calls parseReflectionMetadata(...), isReflectionMetadataType(...), and isOwnedByAgent(...), but those symbols are not imported or defined in dist/index.js. A top-level import('./dist/index.js') succeeds, but this fallback branch will throw ReferenceError when executed. The source has the same unresolved calls at index.ts:2285-2286; src/reflection-store.ts exports isOwnedByAgent, but isReflectionMetadataType is currently local-only.

  3. npm pack --dry-run --json confirms the important runtime files are included (dist/index.js, dist/src/*, openclaw.plugin.json), but the package also includes .github, tests, examples, and commit_msg.txt. This is not a blocker for runtime correctness, but for the published plugin package I would add a package.json files whitelist so npm only ships the runtime, manifest, docs that are intended for users, and required metadata.

Checks I ran against this head: git diff --check origin/master...origin/pr/755 passed, node test/plugin-manifest-regression.mjs passed, and node -e "import('./dist/index.js')..." passed. The TypeScript failures and the undefined reflection fallback symbols above are the blockers.

@choucheyu
Copy link
Copy Markdown
Author

choucheyu commented May 8, 2026

Thanks for the review. I confirmed the three issues you called out were real and pushed a follow-up fix in 10bd3b1.

What changed:

  • Resolved the upstream/master conflicts in src/store.ts and scripts/verify-ci-test-manifest.mjs; the PR is now mergeable again.
  • Fixed the TypeScript blockers exposed by the new compiled-runtime gate:
    • imported/exported the reflection helpers used by the legacy fallback path (parseReflectionMetadata, isReflectionMetadataType, isOwnedByAgent)
    • added the missing PluginConfig.declaredAgents shape
    • tightened the retrieval source typing and a few existing metadata/store type mismatches
  • Rebuilt dist/ after the TypeScript fixes, so dist/index.js now imports the reflection helpers instead of leaving undefined runtime references in the fallback branch.
  • Added a package.json files whitelist so the published package includes runtime/docs assets but excludes .github/, test/, examples/, and commit_msg.txt.

Validation run locally:

  • npm install --ignore-scripts passed
  • ./node_modules/.bin/tsc -p tsconfig.json --noEmit --pretty false passed
  • ./node_modules/.bin/tsc -p tsconfig.json --pretty false passed and regenerated dist/
  • node -e "import('./dist/index.js').then(() => console.log('dist import ok'))" passed
  • npm pack --dry-run --json now reports entryCount: 68, badCount: 0, and includes dist/index.js, dist/src/*, and openclaw.plugin.json
  • node scripts/verify-ci-test-manifest.mjs passed
  • node test/issue606_sdk-migration.test.mjs passed
  • npm run test:packaging-and-workflow passed
  • full npm test passed
  • git diff --check / git diff --cached --check passed

Local runtime verification:

  • OpenClaw runtime verification was done on OpenClaw 2026.5.7.
  • The built package was synced to a local OpenClaw installed extension directory and loaded from dist/index.js.
  • After restarting the Gateway, openclaw status --deep reported Gateway reachable, memory-lancedb-pro loaded, and plugin errors 0.

Current PR status:

  • The PR is currently MERGEABLE.
  • GitHub currently reports no checks for this branch.

@choucheyu choucheyu requested a review from app3apps May 8, 2026 08:00
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.

4 participants