Skip to content

fix: avoid blocking OpenClaw plugin registration#2044

Draft
RerankerGuo wants to merge 2 commits into
MemTensor:mainfrom
RerankerGuo:fix/openclaw-registration-rebuild-block
Draft

fix: avoid blocking OpenClaw plugin registration#2044
RerankerGuo wants to merge 2 commits into
MemTensor:mainfrom
RerankerGuo:fix/openclaw-registration-rebuild-block

Conversation

@RerankerGuo

Copy link
Copy Markdown

Description

Related Issue (Required): Fixes #1778

Removes the synchronous better-sqlite3 auto-rebuild path from OpenClaw plugin registration.

The plugin already has ensureSqliteBinding(ctx.log) as the central native binding preparation step. The removed registration-time fallback could run npm rebuild better-sqlite3 with a 120 second timeout before the service lifecycle was registered, which can make the plugin appear to fail loading during OpenClaw startup. Keeping binding preparation in one path avoids blocking registration and preserves the existing prebuild/rebuild handling.

A regression test guards against reintroducing a registration-time spawnSync/npm rebuild path.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

  • Unit Test
  • Test Script Or Test Steps (please provide)
  • Pipeline Automated API Test (please provide)

Commands run:

node - <<'NODE'
const fs = require('fs');
const source = fs.readFileSync('apps/memos-local-openclaw/index.ts', 'utf8');
const test = fs.readFileSync('apps/memos-local-openclaw/tests/startup-registration.test.ts', 'utf8');
const prelude = source.slice(0, source.indexOf('const ctx = buildContext'));
if (prelude.includes('spawnSync')) throw new Error('spawnSync still appears before buildContext');
if (prelude.includes('npm rebuild better-sqlite3')) throw new Error('npm rebuild command still appears before buildContext');
if (prelude.includes('rebuild", "better-sqlite3')) throw new Error('rebuild args still appear before buildContext');
if (!test.includes('does not run npm rebuild during plugin registration')) throw new Error('startup registration regression test missing');
console.log('startup registration static check passed');
NODE

Result: startup registration static check passed.

Also attempted:

cd apps/memos-local-openclaw
npm test -- --run tests/startup-registration.test.ts
npm run build
make format

npm test is blocked because vitest is not installed. npm run build is blocked because tsc is not installed. make format is blocked because poetry is not installed.

Checklist

  • I have performed a self-review of my own code | 我已自行检查了自己的代码
  • I have commented my code in hard-to-understand areas | 我已在难以理解的地方对代码进行了注释
  • I have added tests that prove my fix is effective or that my feature works | 我已添加测试以证明我的修复有效或功能正常
  • I have created related documentation issue/PR in MemOS-Docs (if applicable) | 我已在 MemOS-Docs 中创建了相关的文档 issue/PR(如果适用)
  • I have linked the issue to this PR (if applicable) | 我已将 issue 链接到此 PR(如果适用)
  • I have mentioned the person who will review this PR | 我已提及将审查此 PR 的人

@Memtensor-AI Memtensor-AI changed the base branch from main to dev-v2.0.22 July 2, 2026 10:57
# Conflicts:
#	apps/memos-local-openclaw/index.ts
@Memtensor-AI

Copy link
Copy Markdown
Collaborator

Automated Test Results: QUEUED

Conflict with dev-v2.0.22 was resolved by merging the base branch into this PR head. Cloud test-engine rerun has been queued.

  • Run: tr-aed9bf13-d88 on cloud test-engine 10012
  • Branch tested: refs/pull/2044/head

I will post the final pass/fail result when the run completes.

@Memtensor-AI

Copy link
Copy Markdown
Collaborator

Automated Test Results: PASSED

Cloud test-engine rerun against dev-v2.0.22 completed successfully.

  • Run: tr-aed9bf13-d88 on cloud test-engine 10012
  • memos_local_openclaw/unit: 9 passed, 0 failed, 0 skipped

Manual code review is still required before merge.

@CarltonXiang CarltonXiang deleted the branch MemTensor:main July 3, 2026 07:25
@syzsunshine219 syzsunshine219 reopened this Jul 3, 2026
@syzsunshine219 syzsunshine219 added the needs-audit Requires manual audit before merge label Jul 3, 2026
@syzsunshine219 syzsunshine219 changed the base branch from dev-v2.0.22 to main July 3, 2026 08:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-audit Requires manual audit before merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: Openclaw启动时memos-local-plugin插件概率性不启动

4 participants