fix(memory-core): skip markdown placeholder snippets in short-term promotion (#80582) [AI-assisted]#94985
fix(memory-core): skip markdown placeholder snippets in short-term promotion (#80582) [AI-assisted]#94985ml12580 wants to merge 1 commit into
Conversation
…omotion (openclaw#80582) Bare list markers (-, *, +), heading-only lines, and heading + empty-bullet ranges carry no durable content but were recorded as short-term recall candidates and could be promoted into MEMORY.md as empty blocks. Broad substring matching in compareCandidateWindow also anchored meaningful candidates onto bare-marker windows. Add isMarkdownPlaceholderLine / isPlaceholderShortTermSnippet / isUnpromotableShortTermSnippet and filter placeholders at recall recording, grounded-candidate recording, store load/normalization, and ranking. Guard compareCandidateWindow substring branches so neither side may be a placeholder (exact match unchanged). The relocation guard is intentionally narrower than a token count: an ASCII-only token check would split CJK text into separators and reject legitimate non-English relocations.
|
Thanks for the context here. I swept through the related work, and this is now duplicate or superseded. This PR should close because the same remaining memory-core bug is still owned by the open canonical issue, and maintainer review on the prior same-issue repair rejected this heuristic filter family in favor of a typed/source-shape-aware normalization repair. Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Canonical path: Keep #80582 as the canonical tracker and implement the maintainer-requested typed/source-shape-aware short-term promotion normalization repair in a replacement branch. So I’m closing this here and keeping the remaining discussion on #80582. Review detailsBest possible solution: Keep #80582 as the canonical tracker and implement the maintainer-requested typed/source-shape-aware short-term promotion normalization repair in a replacement branch. Do we have a high-confidence way to reproduce the issue? Yes. Current main and v2026.6.8 are source-reproducible because non-empty markdown placeholders still pass contamination-only recording, ranking, and apply gates. Is this the best way to solve the issue? No. The branch is a plausible narrow filter, but prior maintainer review rejected this heuristic direction and the current head still has concrete over-broad and incomplete apply-side behavior. Security review: Security review cleared: The diff changes memory-core filtering logic and colocated tests only, with no dependency, workflow, package metadata, secret-handling, or code-execution surface changes. AGENTS.md: found and applied where relevant. What I checked:
Likely related people:
Codex review notes: model internal, reasoning high; reviewed against b16fd6bee7fa. |
|
Closing this PR. ClawSweeper flagged it as superseded, and I see now that maintainer @vincentkoc already reviewed and closed the same-approach PR #92698 with the note that the core markdown-placeholder heuristic is both over- and under-broad and "not safe to land," directing the canonical issue #80582 toward a typed/source-shape-aware normalization repair rather than another heuristic filter. This PR is the same heuristic family (and narrower than #92698), so it would hit the same rejection. I'll step aside rather than spend more review cycles on an approach the maintainer has already declined. The canonical issue #80582 stays open for the representation-level repair. |
|
ClawSweeper applied the proposed close for this PR.
|
Summary
extensions/memory-corerecorded markdown skeleton placeholders — bare list markers (-,*,+), heading-only lines, and heading + empty-bullet ranges — as promotable recall candidates. During relocation, broad substring matching could also anchor a meaningful candidate onto a bare-marker window (e.g. a target containing-matching a-line at quality 1), so empty/structurally meaningless blocks could be appended intoMEMORY.md.isMarkdownPlaceholderLine,isPlaceholderShortTermSnippet,isUnpromotableShortTermSnippet) and the narrow guard added tocompareCandidateWindow.Linked context
Closes #80582
Related: the issue includes a patch sketch; this PR implements it with one justified deviation (see "Risk checklist").
Real behavior proof
-/*/+, heading-only lines, heading + empty-bullet ranges) as promotable candidates and anchored relocation substring matches onto them (Memory: skip markdown placeholder snippets during short-term promotion #80582).extensions/memory-coreshort-term-promotion shard.node scripts/run-vitest.mjs run --config test/vitest/vitest.extension-memory.config.tswith the shard include filter pointed atextensions/memory-core/src/short-term-promotion.test.ts, once with the production fix reverted and once with the fix applied.node scripts/run-vitest.mjsafter the fix. Terminal capture (console output):5 failed | 78 passed (83)— the 5 new tests failed because placeholders were recorded/ranked and a candidate relocated onto a bare-line (appliedwas 1, expected 0).pnpm testsuite was not run locally (scoped to the memory-core shard plus format/tsgo/lint/build);pnpm check:host-env-policy:swiftis skipped on Windows (no Swift); a live long-term dreaming promotion run against a real workspace was not executed end-to-end.recordShortTermRecalls/recordGroundedShortTermCandidates/rankShortTermPromotionCandidates/ store-normalization / relocation code paths in the extension shard; CI runs the same shard on Linux Node 24.The relocation regression failed with
expected 1 to be 0(applied.appliedwas 1), confirming the candidate relocated onto the bare-line before the fix.Tests and validation
pnpm exec oxfmt --check(both files clean),pnpm tsgo(clean),pnpm exec oxlint --type-awareon the changed files (clean),pnpm build, andpnpm test:extension memory-core(short-term-promotion shard: 83/83 pass).extensions/memory-core/src/short-term-promotion.test.ts— bare marker recording, multi-line skeleton range recording, grounded placeholder recording, store-load placeholder drop, and relocation-onto-placeholder refusal.5 failed | 78 passed); they pass after the fix (83 passed).manager.watcher-config.test.tschokidar watcher tests and oneqmd-manager.test.tscase failing onENOENT mkdir '...Notes #1: blue'because Windows disallows:in directory names) were confirmed to also fail on cleanmainwithout this PR's changes.Risk checklist
Did user-visible behavior change?
NoDid config, environment, or migration behavior change?
NoDid security, auth, secrets, network, or tool execution behavior change?
NoWhat is the highest-risk area? Correctness of the placeholder detector — it must not drop legitimate notes. A heading line that also carries a list item with body text (e.g.
## Notes - real content) is intentionally kept, and ordinary prose/list lines are never placeholders.How is that risk mitigated? The detector only treats a line as a placeholder when it is empty, a bare
-/*/+, or a heading line without an inline list item carrying body text. The existing 78 tests (including CJK heading-prefixed relocations and bullet-prefixed dreaming snippets) still pass, and the new tests assert real notes are kept while placeholders are dropped.Deviation from the issue's patch sketch: the issue suggests an
isMeaningfulRelocationSubstringtoken-count guard for relocation. That check splits on[^A-Za-z0-9_]+, which treats CJK characters as separators and would reject legitimate non-English relocations (the suite has CJK rehydration tests). This PR instead uses a narrower placeholder-only guard incompareCandidateWindowthat blocks substring matches only when either side is a placeholder — achieving the issue's stated goal ("avoid matching onto placeholders") without regressing CJK relocations. The exact-match branch is unchanged.Current review state
Next action: await CI and maintainer/ClawSweeper review.
Waiting on: CI (format/lint/tsgo/build + memory-core shard on Linux Node 24).
Bot/reviewer comments addressed: none yet (PR just opened).