Repository navigation
fix(memory-core): keep short protected-glossary terms past the min-length gate - #96304
Conversation
|
Codex review: needs maintainer review before merge. Reviewed June 24, 2026, 9:27 AM ET / 13:27 UTC. Summary PR surface: Source +39, Tests +26. Total +65 across 3 files. Reproducibility: yes. Current-main source shows Review metrics: 1 noteworthy metric.
Stored data model Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land the focused glossary fix after maintainers accept the bounded future concept-tag scoring change and required checks are green. Do we have a high-confidence way to reproduce the issue? Yes. Current-main source shows Is this the best way to solve the issue? Yes. Fixing the owner extraction path is narrower than lowering the global minimum length, and short-only delimiter matching avoids false positives while preserving shipped longer-glossary substring behavior. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 2aa9d6763564. Label changesLabel justifications:
Evidence reviewedPR surface: Source +39, Tests +26. Total +65 across 3 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
ed4f5fe to
c183df3
Compare
|
Addressed the P1 false-positive finding ( The min-length bypass meant a bare substring match could surface Behavior proof ( Before (substring matcher + bypass): After (whole-token matching): Checks green: oxfmt, oxlint, @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
c183df3 to
972956b
Compare
|
A self-audit caught a regression in my previous revision — fixed and re-pushed. The bug I introduced: the previous push switched all latin glossary entries from substring to whole-word matching. That dropped Fix: whole-word matching now applies only to entries below their script's minimum length — the ones that actually rely on the bypass ( Verified (function I/O, Node 22): @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
cedd222 to
d617093
Compare
…ngth gate
PROTECTED_GLOSSARY exists to preserve short technical terms that generic
filtering would discard, but every glossary match still flowed through
normalizeConceptToken's per-script minimum-length gate. The 2-char latin
entries "kv" and "s3" were therefore never emitted as concept tags despite
being on the protect-list. Thread a fromGlossary flag so glossary matches
bypass only that length check; all other gates still apply.
Because that bypass lets short entries through, a bare substring match would
also surface them from inside longer words ("kv" in "mkv", "s3" in "css3").
Match ONLY the short entries (those below their script's min length) as
delimiter-bounded whole tokens; longer entries keep substring containment, so
the shipped behavior of "backup" tagging inside "backups" is preserved. CJK
entries (no word delimiters) always use substring matching. Positive
(standalone kv/s3) and negative (mkv/css3 substrings) regression tests cover
both directions, and the short-term-promotion stable-tags assertion gains "s3".
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
d617093 to
9f91b95
Compare
|
Merged via squash.
|
…ngth gate (openclaw#96304) PROTECTED_GLOSSARY exists to preserve short technical terms that generic filtering would discard, but every glossary match still flowed through normalizeConceptToken's per-script minimum-length gate. The 2-char latin entries "kv" and "s3" were therefore never emitted as concept tags despite being on the protect-list. Thread a fromGlossary flag so glossary matches bypass only that length check; all other gates still apply. Because that bypass lets short entries through, a bare substring match would also surface them from inside longer words ("kv" in "mkv", "s3" in "css3"). Match ONLY the short entries (those below their script's min length) as delimiter-bounded whole tokens; longer entries keep substring containment, so the shipped behavior of "backup" tagging inside "backups" is preserved. CJK entries (no word delimiters) always use substring matching. Positive (standalone kv/s3) and negative (mkv/css3 substrings) regression tests cover both directions, and the short-term-promotion stable-tags assertion gains "s3". Co-authored-by: ly-wang19 <[email protected]> Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
Summary
PROTECTED_GLOSSARY(extensions/memory-core/src/concept-vocabulary.ts) exists specifically to preserve short technical terms that the generic stop-word/segmentation filtering would otherwise discard. But every glossary match still flows throughnormalizeConceptToken(viapushNormalizedTag), which applies a per-script minimum length — latin tokens shorter than 3 chars are rejected. The glossary listskvands3(2-char latin), so they were never emitted as concept tags despite being on the protect-list, defeating the allowlist.deriveConceptTagsis called from short-term recall/promotion (short-term-promotion.ts) for entries without storedconceptTags, so any recalled snippet mentioning these terms lost them.Changes
concept-vocabulary.ts— thread afromGlossaryflag throughpushNormalizedTag→normalizeConceptTokenthat bypasses only the min-length gate for glossary matches; all other gates (empty/non-letter, oversized, pure-number, date, stop-word) still apply.deriveConceptTagspassesfromGlossary: truefor glossary matches,falsefor compound/segment tokens.concept-vocabulary.test.ts— regression test thatkv/s3survive.Real behavior proof
Behavior addressed: 2-char latin glossary terms (
kv,s3) were silently dropped by the latin min-length-3 gate. After the fix they are emitted as concept tags.Real environment tested: Node 22.22.1, macOS, no network/model. Vitest exercises the real exported
deriveConceptTags. BEFORE isorigin/main's file (swapped viagit show).Exact steps or command run after this patch:
Evidence after fix:
Observed result after fix: short protected-glossary terms survive; 3-char+ latin entries, CJK entries, and all non-glossary filtering are unchanged. The new test fails on
origin/mainand passes after.What was not tested: end-to-end short-term recall promotion (the test drives the real exported
deriveConceptTagsthat path calls). Additive only — it surfaces two previously-dropped glossary tags and never removes or reorders existing tags.Additional checks
node scripts/run-vitest.mjs extensions/memory-core/src/concept-vocabulary.test.tspasses; fail-before verified by swapping inorigin/main's file. Extensionoxlintclean.