Skip to content

feat(memos-local-openclaw): hub embedding & parallel recall, auto-update reliability fix#1341

Merged
tangbotony merged 18 commits intoMemTensor:openclaw-local-plugin-20260324from
tangbotony:native_memos
Mar 24, 2026
Merged

feat(memos-local-openclaw): hub embedding & parallel recall, auto-update reliability fix#1341
tangbotony merged 18 commits intoMemTensor:openclaw-local-plugin-20260324from
tangbotony:native_memos

Conversation

@tangbotony
Copy link
Copy Markdown
Contributor

Description

This PR brings several improvements to the memos-local-openclaw plugin, focusing on Hub search infrastructure, parallel recall performance, and auto-update reliability.

Hub Embedding & Search Infrastructure

  • Hub server now performs its own embedding on ingest (shared memories, skills, tasks), instead of accepting client-side embeddings — ensuring model consistency across different OpenClaw instances
  • Added vector + FTS (Full-Text Search) fusion search with RRF (Reciprocal Rank Fusion) ranking on Hub side
  • LLM-based deduplication for merged local + remote results before returning to the agent

Parallel Local + Hub Search

  • Refactored recall engine to run local search and remote Hub search in parallel instead of sequentially
  • Unified 3-phase recall pipeline: initial retrieval → remote recall → LLM filtering
  • Added separate logging for remote recall results (remote recall: N items) for better observability

Sharing State Isolation

  • Scoped sharing state by hubInstanceId to prevent cross-instance state leakage when switching between multiple Hubs
  • Fixed owner isolation edge cases in shared memory queries

Auto-Update Reliability (Critical Fix)

  • Root cause: npm pack @scope/pkg@beta resolved the @beta dist-tag using npm's local cache, downloading stale versions instead of the latest
  • Fix 1 — Source: update-check.ts now returns exact version (e.g., @1.0.6-beta.11) instead of dist-tag (@beta) in installCommand
  • Fix 2 — Frontend: checkForUpdate() always constructs packageName@exactVersion, never parses dist-tags from installCommand
  • Fix 3 — Backend: handleUpdateInstall() accepts targetVersion from frontend, verifies downloaded package version matches, and rolls back on mismatch
  • Fix 4 — Belt & suspenders: Added --prefer-online to npm pack command
  • Fix 5 — Response flush: jsonResponseAndRestart() ensures HTTP response is fully flushed to client before triggering SIGUSR1 restart
  • Fix 6 — Cache headers: Added no-store cache headers on /api/update-check endpoint (server + client)
  • Fix 7 — Native binding: Refactored postinstall.cjs to delegate native validation to native-binding.cjs, triggering rebuild on any dlopen failure

Related Issue: N/A (production bug reports from beta users)

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Refactor (does not change functionality, e.g. code style improvements, linting)

How Has This Been Tested?

  • Unit Test
    • tests/update-install.test.ts — covers version mismatch detection, rollback on wrong version, success path
    • tests/postinstall-native-binding.test.ts — covers native binding validation and rebuild triggers
  • Test Script Or Test Steps
    1. Published 1.0.6-beta.5 through beta.11 sequentially
    2. Verified auto-update from beta.5 → beta.7 succeeds (UI refreshes correctly)
    3. Confirmed beta.7 → beta.8 failure was caused by npm cache (log shows downloaded beta.7.tgz when expecting beta.8)
    4. After fix, verified exact version is used in npm pack command and version mismatch triggers rollback
    5. Verified Hub embedding on ingest by sharing memories from client and confirming server-side embedding vectors are generated
    6. Verified parallel local + remote search returns merged results with correct logging

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

hijzy and others added 18 commits March 19, 2026 16:32
## Description

Please include a summary of the change, the problem it solves, the
implementation approach, and relevant context. List any dependencies
required for this change.

Related Issue (Required):  Fixes @issue_number

## Type of change

Please delete options that are not relevant.

- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- [ ] Refactor (does not change functionality, e.g. code style
improvements, linting)
- [ ] Documentation update

## How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide
instructions so we can reproduce. Please also list any relevant details
for your test configuration

- [ ] Unit Test
- [ ] Test Script Or Test Steps (please provide)
- [ ] Pipeline Automated API Test (please provide)

## 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](https://github.com/MemTensor/MemOS-Docs) (if applicable) |
我已在 [MemOS-Docs](https://github.com/MemTensor/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
的人

## Reviewer Checklist
- [ ] closes #xxxx (Replace xxxx with the GitHub issue number)
- [ ] Made sure Checks passed
- [ ] Tests have been provided
## Description

Please include a summary of the change, the problem it solves, the
implementation approach, and relevant context. List any dependencies
required for this change.

Related Issue (Required):  Fixes @issue_number

## Type of change

Please delete options that are not relevant.

- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- [ ] Refactor (does not change functionality, e.g. code style
improvements, linting)
- [ ] Documentation update

## How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide
instructions so we can reproduce. Please also list any relevant details
for your test configuration

- [ ] Unit Test
- [ ] Test Script Or Test Steps (please provide)
- [ ] Pipeline Automated API Test (please provide)

## 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](https://github.com/MemTensor/MemOS-Docs) (if applicable) |
我已在 [MemOS-Docs](https://github.com/MemTensor/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
的人

## Reviewer Checklist
- [ ] closes #xxxx (Replace xxxx with the GitHub issue number)
- [ ] Made sure Checks passed
- [ ] Tests have been provided
## Description

Please include a summary of the change, the problem it solves, the
implementation approach, and relevant context. List any dependencies
required for this change.

Related Issue (Required):  Fixes #issue_number

## Type of change

Please delete options that are not relevant.

- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- [ ] Refactor (does not change functionality, e.g. code style
improvements, linting)
- [ ] Documentation update

## How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide
instructions so we can reproduce. Please also list any relevant details
for your test configuration

- [ ] Unit Test
- [ ] Test Script Or Test Steps (please provide)
- [ ] Pipeline Automated API Test (please provide)

## 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](https://github.com/MemTensor/MemOS-Docs) (if applicable) |
我已在 [MemOS-Docs](https://github.com/MemTensor/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
的人

## Reviewer Checklist
- [ ] closes #xxxx (Replace xxxx with the GitHub issue number)
- [ ] Made sure Checks passed
- [ ] Tests have been provided
### ## Description

Please include a summary of the change, the problem it solves, the
implementation approach, and relevant context. List any dependencies
required for this change.

Related Issue (Required):  Fixes #issue_number

## Type of change

Please delete options that are not relevant.

- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- [ ] Refactor (does not change functionality, e.g. code style
improvements, linting)
- [ ] Documentation update

## How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide
instructions so we can reproduce. Please also list any relevant details
for your test configuration

- [ ] Unit Test
- [ ] Test Script Or Test Steps (please provide)
- [ ] Pipeline Automated API Test (please provide)

## 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](https://github.com/MemTensor/MemOS-Docs) (if applicable) |
我已在 [MemOS-Docs](https://github.com/MemTensor/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
的人

## Reviewer Checklist
- [ ] closes #xxxx (Replace xxxx with the GitHub issue number)
- [ ] Made sure Checks passed
- [ ] Tests have been provided
…isolation

- Add hubInstanceId to team_shared_chunks, local_shared_tasks, and
  client_hub_connection to prevent stale sharing state when switching
  between Hub instances
- Fix memory_search/timeline/get owner isolation by accepting agentId
  from tool execution context
- Fix viewer sharing queries to use role-appropriate tables (hub_memories
  vs team_shared_chunks)
- Apply maxChars truncation in memory_get handler
- Fix 11 failing tests: accuracy thresholds, integration env isolation,
  plugin-impl join flow, and task-processor topic judge flakiness

Made-with: Cursor
…n search, LLM dedup

- Compute embeddings on Hub when memories are shared (same as task/skill),
  instead of on-the-fly at search time; auto-backfill missing vectors on startup
- Hub search now reads pre-computed vectors from hub_memory_embeddings + FTS + RRF
  (unified retrieval strategy across memory/chunk/skill)
- Add deduplication rule to LLM filterRelevant prompt so merged local+remote
  results automatically drop near-duplicate snippets
- Add LLM filtering to skill_search hub merge path (consistent with memory_search)
- Persist latest Hub username/role during client 401 recovery
- Add admin rename notification + fix client nickname consistency
- Fix Hub join dryRun logic, normalizeTimestamp compile error
- Define missing OpenClaw provider prompt constants
…d 3-phase recall

- Refactor both memory_search tool and auto-recall to a 3-phase pipeline:
  Phase 1: local engine.search() ∥ hubSearchMemories() via Promise.all
  Phase 2: merge all candidates → single LLM filterRelevant() call
  Phase 3: build response with unified { candidates, hubCandidates, filtered } structure
- Remove redundant double LLM filtering (was: local filter → hub fallback → merge filter)
- Separate hub-memory origin hits from local candidates in RecallEngine results
- Simplify trackTool serialization to a single branch matching the unified details shape
- Add dedicated "远程召回" (Hub Remote) display section in Viewer between initial retrieval and LLM filtered results
… npm cache

- update-check: installCommand now uses exact version (e.g. @1.0.6-beta.11) instead of dist-tag (@beta)
- frontend: always construct pkgSpec as packageName@exactVersion, pass targetVersion to backend
- backend: verify downloaded version matches targetVersion, rollback on mismatch
- npm pack: add --prefer-online flag as extra safety
- postinstall: fix native binding validation, delegate to native-binding.cjs
- update-install: flush HTTP response before SIGUSR1 restart, add no-cache headers
@tangbotony tangbotony merged commit 38188b5 into MemTensor:openclaw-local-plugin-20260324 Mar 24, 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.

4 participants