Repository navigation
fix(openclaw): preserve mutation content whitespace - #345
loveRhythm1990 merged 1 commit into
Conversation
Keep authoritative response indentation and trailing whitespace in stored and corrected records and their cache entries. Preserve trimming for other tools and consume only the mutation formatter's delimiter space. Cover store and both correction paths with native HTTP regressions. 由 LW 授权的 ChatGPT Business 智能体提交。
|
LGTM on The reported defect is real: trimming the mutation response and consuming arbitrary whitespace after the separator removes meaningful indentation and trailing whitespace from returned/cached content, while the stored record remains unchanged. Preserving the raw mutation text and consuming only the formatter's separator correctly fixes this. I checked the HTTP adapter and Rust MCP formatters; both emit that single separator space. Other tools retain their previous trimming behavior. The tests exercise store, correction by ID, and correction by query through real loopback HTTP fixtures, checking request semantics, server-provided content, cache hits, and fresh GET consistency. Locally, all 203 OpenClaw tests and package build/verification passed. With the baseline client and the same regression tests, 12 failed and 3 passed, confirming the original bug. Current CI is green, including the MatrixOne DB tests and explicit restore/cleanup regression steps; no local database integration run is claimed. Coverage: 2/2 changed files reviewed (100%), 0 skipped. No actionable issues found. |
由 LW 授权的 ChatGPT Business 智能体提交。
What type of PR is this?
Which issue(s) this PR fixes
New narrowly scoped OpenClaw content-fidelity defect. Searches for whitespace/indentation/cache found no matching issue or existing fix PR; no automatic issue closure.
What this PR does / why we need it
The HTTP adapter returns stored/corrected server content in a text envelope, but the client trims that envelope and then consumes arbitrary whitespace after the colon. For example, the server response content
" return value\n"becomes"return value"in the returned record and cache. A subsequent cache hit therefore differs from a fresh GET. This loses significant indentation/newlines in code and formatted text; it does not change the stored database record.memory_storeandmemory_correct, retaining existing trimming for other tools.Scope
2 files, +82/-6, based on main
ed63438362280c5a1bb4c802c641236929a7f821.Head
5022a6c6f2c44ae9c78bbb282d1f7bb853aaa1f3; tree821ec62832ed5ed170f8dae8585b16187e2a865eexactly matches the locally tested tree.Own fork:
MatrixAdventurer:fix/openclaw-mutation-whitespace-20261020. No upstream dev branch exists, so target is main.Verification
Node 24.19.0 / Vitest 4.1.11, working directory
plugins/openclaw:npm ci, fullnpm test: 203 passed / 12 files.npm run test:pack: passed, including bundle build, package validation and all 6 packed files.git diff --check: passed.Tests use native fetch against real loopback HTTP fixtures and the real client/adapter. They verify request semantics, returned content, actual cache hits and fresh-client GET consistency. This is not a live Memoria/MatrixOne integration test.
Remaining gates / limitations
5022a6c6f2c44ae9c78bbb282d1f7bb853aaa1f3: OpenClaw tests and packaging, Rust Check & Clippy, Unit Tests and MatrixOne DB Tests, and PR title check. No local Rust/database integration test is claimed.npx tsc --noEmitstill reports 42 pre-existing optional-host-peer diagnostics (openclaw/plugin-sdkabsent and downstream type errors), with identical baseline/fixed output; no new diagnostics or weakened gate.