Repository navigation
fix(openclaw): preserve batch purge ID selectors - #340
loveRhythm1990 merged 2 commits into
Conversation
由 LW 授权的 ChatGPT Business 智能体提交。
|
The CSV request-body bug is real, and splitting/validating selectors at the HTTP boundary is appropriate. However, one caller of this shared adapter needs a corresponding fix before LGTM. [P2, bug] Invalidate all normalized IDs when this change is reached through deleteMemory. At I reproduced this through the actual MemoriaClient with synthetic HTTP responses: cache m1 and m2, call deleteMemory with m1,m2, verify that the request deletes both fixture records and reports purged=2, then read m1. It returns the stale cached record instead of null. The identical test using purgeMemory passes. The new tests cover purgeMemory but miss this second caller. Please use consistent selector normalization for deletion and cache invalidation in deleteMemory as well, or explicitly reject batch selectors at the single-memory boundary before sending anything. Add a regression covering cached records through this caller. Normalized whitespace IDs should follow the same rule. Validation at a610f07: the existing 171-test OpenClaw suite and test:pack passed locally on Node 25.9.0; the new PR suite against the baseline produced 11 failures and 2 passing controls. The additional caller/cache regression produced 1 failure and 1 passing control. Current upstream OpenClaw and Rust/DB CI are green, but do not cover this regression. All three changed files were reviewed (3/3, none skipped). No live database deletion was performed. |
Clear each deleted ID from the client cache after a successful purge. Cover batch and whitespace selectors through both public deletion methods, failed mutations, and unrelated user/ID cache preservation. Revert the optional tool description change to keep the PR to three files. 由 LW 授权的 ChatGPT Business 智能体提交。
|
由 LW 授权的 ChatGPT Business 智能体提交。 Addressed the cache-invalidation finding in commit 85bafa6. The expanded regression suite reproduces 4 failures / 19 passes on the prior PR head a610f07 (CSV, whitespace, empty segments, and padded single ID all return deleted data from cache); the same suite now passes 23/23. It also checks both callers, unrelated and other-user cache preservation, and failed mutations retaining cached entries. Full local suite 181/181, Fresh OpenClaw CI and title check are green; Rust/MatrixOne CI is still running. Extra TypeScript checking continues to show exactly the same 42 optional-host-peer diagnostics as the unchanged baseline; no new diagnostics. No local Rust/database integration test, merge, deployment, or package publication is claimed. |
|
LGTM on The original HTTP batch-purge bug is real: comma-separated IDs were sent as one literal ID. Splitting, trimming, and rejecting an empty ID selector correctly implements the MCP contract without allowing an invalid ID selector to fall through to topic deletion. The previously reported cache issue is also resolved: Validation: all 181 OpenClaw tests and package build/verification passed locally. Running the current batch-purge tests against the previous |
|
由 LW 授权的 MOI 智能体提交。 补记 CI 完成情况给 @loveRhythm1990(并同步 @XuPeng-SH):先前的 12:35 评论发布时 Rust/MatrixOne CI 还在运行,现在已在未再改动的 head
你在 deleteMemory 缓存失效 P2 意见 中指出的问题已在 commit 状态只以上述实际运行的 GitHub 输出为准;我这边没有做任何新的代码变更。请在方便时复审。 |
|
由 LW 授权的 MOI 智能体提交。 更正上一条评论(#issuecomment-6270090896)中的一处链接笔误:DB Tests 行误用了 Unit Tests 的 job ID |
由 LW 授权的 ChatGPT Business 智能体提交。
What type of PR is this?
Which issue(s) this PR fixes
New narrowly scoped OpenClaw HTTP adapter defect. Related #268 concerns cache invalidation, not this request-body mapping; this does not duplicate that fix. No automatic issue closure.
What this PR does / why we need it
The existing Rust MCP
memory_purgeschema and both embedded/remote implementations accept a single ID or comma-separated IDs. OpenClawpurgeMemoryalready splits that selector to invalidate caches, but its HTTP adapter sendsmemoryId: "m1,m2"as{"memory_ids":["m1,m2"]}, looking up one nonexistent combined ID rather than deleting the selected records. Depending on authorization path this can produce a not-found error or no matches; no production deletion outcome is asserted.deleteMemorysucceeds, just aspurgeMemorydoes. This also fixes whitespace-padded single-ID invalidation. Failed mutations preserve the cache; unrelated IDs and other users remain cached. The optional tool-description edit was reverted to keep the complete PR at three files.Comma remains a reserved batch separator, as in the existing Rust MCP contract; it is not treated as a literal character in one custom legacy ID. Normal generated memory IDs are UUID/hash identifiers.
Scope
Three files, +189/-2, based on main
c551911b308dff1d7c2f0d9458fe1b7aadd12311.Head
85bafa6c06a6e37404bfe76d38db360320ed7cb6; treeb894b722bc80e50f081a5b1441dcb892777710ffmatches the locally tested tree exactly.Own fork branch
MatrixAdventurer:fix/openclaw-batch-purge-20261019; upstream has no dev branch, so target is main.Verification
Node 24.19.0 / Vitest 4.1.11:
a610f079: 4 failed / 19 passed, all proving stale cache returns throughdeleteMemory(CSV, spaced CSV, empty segments, padded single ID).npm ci, fullnpm test: 181 passed across 10 files.npm run test:pack: passed (bundle build, package validation, packed-file check).git diff --check: passed.Tests exercise the real TypeScript client/transport and native Request serialization with synthetic fetch responses. The exact-ID matching fixture is not a real server/database, and its purged=0 result is not asserted as the only live-server behavior.
Remaining gates / limitations
85bafa6is green: OpenClaw test/package, Rust unit tests, Check/Clippy and MatrixOne DB/integration tests, and PR title check. The DB job includes the all-tests step plus restore transaction, branch capability cleanup, and offline restore cleanup regressions. No local Rust/database integration test is claimed.fda8bd3adds snapshot listing changes only, with no overlap in the OpenClaw plugin.npx tsc --noEmitis not clean: absent optional host peeropenclaw/plugin-sdkcauses 42 diagnostics, identically reproduced on the unchanged baseline; no new diagnostics in this patch. The repository's actual OpenClaw CI commands above pass locally. No types or gate configuration were weakened.Review follow-up
Addresses the cache-invalidation finding in commit
85bafa6. Cache IDs now use the same split/trim semantics as HTTP selection; the existing invalidation helper ignores empty segments and advances the cache generation. No force-push, merge, deployment or package publication.