You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(plugin): filter reserved Cloud info keys - #2486
The OpenClaw plugin passed user-configured info fields directly to the MemOS Cloud /add/message endpoint. Cloud Hub rejects the reserved keys local_state, state, and localStats, regardless of their values, causing the add request to fail.
This change filters those three reserved keys when building the request payload. Other custom info fields and plugin-generated metadata are preserved. The plugin README files in English and Chinese have been updated, and a regression test verifies the filtering behavior.
This PR fixes the client-side payload issue only. Cloud Hub server-side delete schema and behavior, and long synchronous request timeouts, are outside this repository’s implementation scope.
Hardcoded platform-specific value. MEMOS_SOURCE in index.js is derived from process.platform (win32 → openclaw_win, darwin → openclaw_mac, linux → openclaw_linux, otherwise openclaw), so this assertion fails on macOS/Linux CI — which is exactly how the existing test at line 124 already avoids the problem by computing expectedSource dynamically. Derive the expected value the same way here.
local_state, state and localStats are magic strings with no indication of why they are reserved, and this Set is rebuilt on every buildAddMessagePayload call. Consider hoisting it to a module-level constant next to MEMOS_SOURCE and adding a one-line comment, so the reason these keys must never reach the Cloud API is documented in one place (the keys originate from the OpenClaw host config, which the plugin does not control).
💡 Suggested Change
Before:
const reservedInfoKeys = new Set(["local_state", "state", "localStats"]);
After:
// Keys injected by the OpenClaw host config; forwarding them to the Cloud API is not intended.
const reservedInfoKeys = new Set(["local_state", "state", "localStats"]);
Because customInfo is spread last, keys the plugin sets itself (source, sessionKey, agentId) can still be silently overwritten by user config — e.g. info: { source: "other" } replaces the platform tag openclaw_win/openclaw_mac. That is the same class of collision this change is guarding against. If those three fields are meant to be authoritative, extend the reserved list to cover them (or spread customInfo before them); if user override is intentional, a short comment noting that would help future readers.
Generated by cloud-assistant via Open Code Review.
All tests passed (6/6 executed). common/smoke: 6/6. Duration: 2s [advisory, non-gating] AI-generated tests on branch test/auto-gen-85e56e4106eb57a4-20261012204343: 41/44 passed, 3 failed — these do NOT affect the PR verdict; review the branch manually.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
area:pluginOpenClaw & Hermesstatus:readyReady for implementation; waiting for assignee or AI dispatch | 可进入实现,等待认领或派发
3 participants
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The OpenClaw plugin passed user-configured
infofields directly to the MemOS Cloud/add/messageendpoint. Cloud Hub rejects the reserved keyslocal_state,state, andlocalStats, regardless of their values, causing the add request to fail.This change filters those three reserved keys when building the request payload. Other custom
infofields and plugin-generated metadata are preserved. The plugin README files in English and Chinese have been updated, and a regression test verifies the filtering behavior.This PR fixes the client-side payload issue only. Cloud Hub server-side delete schema and behavior, and long synchronous request timeouts, are outside this repository’s implementation scope.
Dependencies: None.
Related Issue (Required): Fixes #2423
Type of change
How Has This Been Tested?
node --test apps/MemOS-Cloud-OpenClaw-Plugin/test/direct-session-user-id.test.mjs node --test apps/MemOS-Cloud-OpenClaw-Plugin/test/*.test.mjs git diff --checkResults: focused tests passed (9/9); full plugin suite passed (64/64);
git diff --checkpassed.Checklist
Reviewer Checklist