Skip to content

Fix #1559: fix: registerMemoryCapability API not found in OpenClaw 2026.3.31 - #1991

Merged
syzsunshine219 merged 1 commit into
dev-v2.0.22from
bugfix/autodev-1559
Jul 2, 2026
Merged

Fix #1559: fix: registerMemoryCapability API not found in OpenClaw 2026.3.31#1991
syzsunshine219 merged 1 commit into
dev-v2.0.22from
bugfix/autodev-1559

Conversation

@Memtensor-AI

Copy link
Copy Markdown
Collaborator

Description

Fixes issue #1559: OpenClaw 2026.3.31 removed api.registerMemoryCapability and split it into three single-purpose methods (registerMemoryPromptSection, registerMemoryFlushPlan, registerMemoryRuntime). The MemOS Local OpenClaw plugin previously made an unconditional call to the removed method, crashing during plugin registration with TypeError: api.registerMemoryCapability is not a function, which prevented the plugin from loading.

The fix in apps/memos-local-openclaw/index.ts migrates the call to prefer api.registerMemoryPromptSection(buildMemoryPromptSection) when the host SDK exposes it (OpenClaw 2026.3.31+), with a fallback to the legacy api.registerMemoryCapability({ promptBuilder }) for older hosts. When neither method is exposed, the plugin emits a non-fatal warning via the host logger and continues to load, eliminating the hard-crash failure mode entirely.

A new regression suite tests/issue-1559-memory-api-migration.test.ts covers all three branches: (1) new API preferred when both are present, (2) legacy fallback when only the legacy method exists, (3) no-op + warn when neither is exposed. Verification: npx vitest run on impacted suites (issue-1559-memory-api-migration, plugin-openclaw-wiring, integration, plugin-impl-access, shutdown-lifecycle, incremental-sharing, hub-eager-connect) — 44/44 passed. The 5 unrelated pre-existing failures (model loading, timing-sensitive task processor, viewer update-install) reproduce on the baseline branch without this change and are out of scope.

Branch bugfix/autodev-1559 pushed to origin; commit dfe260e. opsp artifacts archived to memos-autodev-specs repo.

Related Issue (Required): Fixes #1559

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?

Automated tests are pending.

  • 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 (if applicable)
  • I have linked the issue to this PR (if applicable)
  • I have mentioned the person who will review this PR

@MatthewZhuang, @CarltonXiang, @syzsunshine219, @World-controller please review this PR.

Reviewer Checklist

…26.3.31 split API

OpenClaw 2026.3.31 removed the omnibus `api.registerMemoryCapability(...)`
facade and split it into three single-purpose methods. The
`@memtensor/memos-local-openclaw-plugin` entry called the removed method
directly (no optional chaining), so the plugin crashed during
`register()` with `TypeError: api.registerMemoryCapability is not a
function` and failed to load on every gateway start.

Migrate to the new API surface:
- Prefer `api.registerMemoryPromptSection(builder)` when present
  (OpenClaw 2026.3.31+).
- Fall back to `api.registerMemoryCapability({ promptBuilder })` for
  hosts that still expose the legacy facade.
- Emit a logger warning (non-fatal) when neither method is exposed, so
  the plugin always finishes loading even on unexpected host versions.

Adds regression test `tests/issue-1559-memory-api-migration.test.ts`
covering all three branches (new API preferred, legacy fallback,
neither present). All impacted suites pass (44/44). Closes #1559.
@Memtensor-AI

Copy link
Copy Markdown
Collaborator Author

❌ Automated Test Results: FAILED

Auto-fix retry 1/2 triggered.

Failed tests:

  • test_out_of_range_rejected_or_clamped_to_valid[negative_1]
  • test_out_of_range_rejected_or_clamped_to_valid[negative_60s]
  • test_out_of_range_rejected_or_clamped_to_valid[negative_one_day]
  • test_out_of_range_rejected_or_clamped_to_valid[max_plus_1]
  • test_out_of_range_rejected_or_clamped_to_valid[max_plus_one_day]
  • test_out_of_range_rejected_or_clamped_to_valid[hundred_x_max]
  • test_invalid_type_does_not_crash_or_corrupt[string_number]
  • test_invalid_type_does_not_crash_or_corrupt[string_text]
  • test_invalid_type_does_not_crash_or_corrupt[none_value]
  • test_invalid_type_does_not_crash_or_corrupt[dict_value]
Error details
The vector_scan max_age field accepts and persists invalid values (negative numbers, values exceeding max, non-numeric types like strings/None/dicts) without validation or clamping, violating the schema contract.

Branch: bugfix/autodev-1559

@Memtensor-AI
Memtensor-AI changed the base branch from dev-20260624-v2.0.22 to dev-v2.0.22 June 30, 2026 12:23
@Memtensor-AI

Copy link
Copy Markdown
Collaborator Author

Cloud verification update (test-engine v2): PASSED.

Run tr-3c987695-2c2 executed focused memos_local_openclaw/unit: 5/5 passed. GitHub checks are green; remaining gates are update branch if required, human review, and branch protection.

@syzsunshine219
syzsunshine219 merged commit 609ded4 into dev-v2.0.22 Jul 2, 2026
16 checks passed
@syzsunshine219
syzsunshine219 deleted the bugfix/autodev-1559 branch July 2, 2026 06:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai:generated Generated or modified by AI | 由 AI 生成或修改 types:bug Something isn't working | 功能异常

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants