Repository navigation
fix(memory): keep generated REM reflections out of promotion rankings - #154994
Conversation
…ming snippets isContaminatedDreamingSnippet required status: staged AND recalls: N alongside the narrative lead/confidence/evidence signals. Generated REM ### Reflections blocks (buildRemReflections in dreaming-phases.ts) carry note: reflection instead, so they satisfied only three of the five AND'd conditions and slipped through into promotion scoring. Accept a reflection-note marker as an alternate to the staged status/recalls pair, closing the leak (openclaw#154803).
… lead The prior commit only widened the status/recalls clause to accept note: reflection, but left hasDreamingNarrativeLead requiring a colon-suffixed "Reflections:" marker. The real REM generator (buildRemReflections/previewRemDreaming) emits the block under a markdown heading, "### Reflections" (no colon), so that clause never matched real generated content and the fix was unreachable. Widen hasDreamingNarrativeLead to also match the markdown heading form, and rewrite the regression test to build its snippet from the real previewRemDreaming generator output instead of a hand-authored string that inserted a colon the generator never emits. Co-Authored-By: Claude Sonnet 5 <[email protected]>
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs real behavior proof before merge. Reviewed September 21, 2026, 12:44 PM ET / 16:44 UTC. ClawSweeper reviewWhat this changesMemory Core’s promotion filter now recognizes generated REM reflection headings and metadata, with a regression covering generator-produced content. Merge readiness⛔ Blocked before merge - 2 items remain This remains a useful, focused fix: current main and the latest release retain the faulty predicate. No introduced correctness defect was found, but real behavior proof is still required before merge. Priority: P2 Review scores
Verification
How this fits togetherMemory Core consolidates recalled material into durable memory. Its contamination filter excludes internal dreaming output during recall ingestion, stored-entry loading, candidate ranking, and promotion. flowchart TD
A[Recent memory traces] --> B[REM reflection generator]
B --> C[Daily memory snippets]
C --> D{Internal dreaming artifact?}
D -->|Yes| E[Exclude from promotion]
D -->|No| F[Score memory candidates]
F --> G[Validated durable memory]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +12, Tests +72. Total +84 across 2 files. View PR surface stats
Review metricsNone. Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Technical reviewBest possible solution: Keep the repair in the shared contamination predicate so generated REM artifacts are excluded consistently while ordinary memories retain existing eligibility. Do we have a high-confidence way to reproduce the issue? Yes, source establishes the mismatch: generated REM blocks lack both the colon marker and staged metadata required by current main. The contributor reports a failing regression, but this review did not execute a current-main reproduction. Is this the best way to solve the issue? Yes, extending the existing shared predicate is a narrow repair that preserves the prior staged-block check and avoids a competing filter. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against bb3a9b0f40e1. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
…ry154994-rem-exclusion
|
Merged as 05f3f89. Generated REM reflections now stay out of recall signals and promotion rankings while ordinary notes remain eligible. Verified through the built memory CLI with fresh and existing recall state, plus 97 passing focused tests. Existing fenced-block safeguards are unchanged. Thanks @chelsealong for the contribution! |
* commit '8a26ae487b5fb9b72ea2c12bf384e9c776659429': (154 commits) fix(ui): preserve skill group expansion when filtering (#150911) test(gateway): consolidate server history and lifecycle fixtures (#155063) test(codex): select HTTP fallback in native finalizer fixtures (#155008) improve: reduce isolated Gateway CI test time (#154366) test(gateway): await approval registration acknowledgments fix(workboard): explain blocked-card claim recovery (#154990) perf(agents): consolidate exec target policy tests (#155060) perf(config): consolidate environment test fixtures (#155062) fix(ui): keep the chat rail anchored through composer resize fix: recovery tests wait for committed outcomes (#154995) fix(codex): keep inference bursts from failing turns (#154945) fix(memory): keep generated REM reflections out of promotion rankings (#154994) fix(sqlite): reclaim scratch files when storage is full (#154937) test(cli): spawn the compiled Doctor entry in the output process test (#155055) fix(update): distinguish config validation execution failures (#154892) test(doctor): await session cleanup before deleting fixture state fix(update): report unavailable service inspection accurately (#154896) test(gateway): observe plugin approval response completion perf(msteams): reduce file-consent test scaffolding (#155050) fix(ui): retain saved permissions during delayed startup reads (#154982) ...
…openclaw#154994) Closes openclaw#154803 ## What Problem This Solves Generated REM reflections in eligible daily memory notes can accumulate ordinary recall signals and appear in promotion rankings after repeated searches. ## User Impact Recognizable REM artifacts no longer compete with ordinary notes for promotion. Ordinary memories, including prose mentioning “Reflections,” remain eligible. Search results themselves remain available; this change filters recall signals and promotion candidates, not retrieval. Existing managed-block safeguards still independently prevent promoting fenced dreaming output. No configuration, database migration, or user action is required. ## Why This Change Was Made The shared artifact detector now recognizes the actual Markdown `### Reflections` heading and `note: reflection` metadata. It preserves the existing staged-block signature rather than adding a separate filter. ## Evidence Exercised the built, registered `memory index`, `memory search --json`, and `memory promote --json` commands with isolated synthetic daily notes, FTS-only search, and unchanged promotion thresholds. Recall state was populated exclusively by actual searches, never seeded directly. | Default-threshold promotion preview | Before (`6eb97ae49348`) | After | | --- | --- | --- | | Producer-format REM reflection in an unfenced daily note | Ranked, score 0.836 | Excluded | | Same reflection inside a managed REM block | Ranked, score 0.830 | Excluded | | Two ordinary notes, including prose mentioning Reflections | Both eligible | Both eligible | | Existing staged artifact format | Excluded | Excluded | Fresh baseline and candidate search results contained the complete reflection heading and metadata. A separate promotion-only check against recall state previously created by the baseline CLI excluded the artifacts while retaining both ordinary notes; search was not rerun in that existing-state check. No promotion was applied, and the existing `MEMORY.md` sentinel remained unchanged; this does not claim that fenced REM output previously bypassed apply-time safeguards. The consolidated regression uses the real REM generator and recall-to-ranking path. It failed with the original predicate because the generated reflection remained ranked. On the final revision, the focused promotion suite passed **97/97**: **25.73 s wall**, **22.64 s Vitest**, with the changed regression taking **16 ms**. Scoped formatting, assertion safety, and both line-growth ratchets passed without exceptions. The test file shrank instead of adding another fixture-store regression. Co-authored-by: Ayaan Zaidi <[email protected]>
Closes #154803
What Problem This Solves
Generated REM reflections in eligible daily memory notes can accumulate ordinary recall signals and appear in promotion rankings after repeated searches.
User Impact
Recognizable REM artifacts no longer compete with ordinary notes for promotion. Ordinary memories, including prose mentioning “Reflections,” remain eligible. Search results themselves remain available; this change filters recall signals and promotion candidates, not retrieval.
Existing managed-block safeguards still independently prevent promoting fenced dreaming output. No configuration, database migration, or user action is required.
Why This Change Was Made
The shared artifact detector now recognizes the actual Markdown
### Reflectionsheading andnote: reflectionmetadata. It preserves the existing staged-block signature rather than adding a separate filter.Evidence
Exercised the built, registered
memory index,memory search --json, andmemory promote --jsoncommands with isolated synthetic daily notes, FTS-only search, and unchanged promotion thresholds. Recall state was populated exclusively by actual searches, never seeded directly.2d71ebc9426e)Fresh baseline and candidate search results contained the complete reflection heading and metadata. A separate promotion-only check against recall state previously created by the baseline CLI excluded the artifacts while retaining both ordinary notes; search was not rerun in that existing-state check. No promotion was applied, and the existing
MEMORY.mdsentinel remained unchanged; this does not claim that fenced REM output previously bypassed apply-time safeguards.The consolidated regression uses the real REM generator and recall-to-ranking path. It failed with the original predicate because the generated reflection remained ranked. On the final revision, the focused promotion suite passed 97/97: 25.73 s wall, 22.64 s Vitest, with the changed regression taking 16 ms. Scoped formatting, assertion safety, and both line-growth ratchets passed without exceptions. The test file shrank instead of adding another fixture-store regression.