Skip to content

fix(memory): skip empty dreaming placeholders#80916

Open
hyspacex wants to merge 1 commit into
openclaw:mainfrom
hyspacex:fix/80858-dreaming-empty-placeholder
Open

fix(memory): skip empty dreaming placeholders#80916
hyspacex wants to merge 1 commit into
openclaw:mainfrom
hyspacex:fix/80858-dreaming-empty-placeholder

Conversation

@hyspacex

@hyspacex hyspacex commented May 12, 2026

Copy link
Copy Markdown
Contributor

Summary

  • stop REM preview from writing the No strong candidate truths surfaced placeholder under ### Possible Lasting Truths
  • defensively classify historical empty-result placeholders as contaminated so already-written daily memory candidates do not promote into MEMORY.md
  • add regression coverage for both REM preview output and short-term promotion apply filtering

Fixes #80858

Real behavior proof

  • Behavior or issue addressed: Empty REM days should not emit candidate-like placeholder markdown, and already-written placeholder snippets should not be promoted into long-term MEMORY.md.
  • Real environment tested: Harry's Mac mini, Darwin 25.4.0 arm64, Node v22.22.0, local OpenClaw checkout on branch fix/80858-dreaming-empty-placeholder.
  • Exact steps or command run after this patch:
node --import tsx - <<'EOF'
import fs from 'node:fs/promises';
import os from 'node:os';
import path from 'node:path';
import { __testing as dreamingTesting } from './extensions/memory-core/src/dreaming-phases.ts';
import { applyShortTermPromotions } from './extensions/memory-core/src/short-term-promotion.ts';

const preview = dreamingTesting.previewRemDreaming({ entries: [], limit: 5, minPatternStrength: 0 });
console.log('REM body contains placeholder:', preview.bodyLines.join('\n').includes('No strong candidate truths surfaced'));
console.log('REM body contains possible truths section:', preview.bodyLines.join('\n').includes('### Possible Lasting Truths'));
console.log('REM body:');
console.log(preview.bodyLines.join('\n'));

const workspaceDir = await fs.mkdtemp(path.join(os.tmpdir(), 'openclaw-80858-proof-'));
await fs.mkdir(path.join(workspaceDir, 'memory', '.dreams'), { recursive: true });
const applied = await applyShortTermPromotions({
  workspaceDir,
  minScore: 0,
  minRecallCount: 0,
  minUniqueQueries: 0,
  candidates: [{
    key: 'memory:memory/2026-04-08.md:13:13',
    path: 'memory/2026-04-08.md',
    startLine: 13,
    endLine: 13,
    source: 'memory',
    snippet: '- Candidate: Possible Lasting Truths: No strong candidate truths surfaced.',
    recallCount: 3,
    avgScore: 0.95,
    maxScore: 0.95,
    uniqueQueries: 2,
    firstRecalledAt: '2026-04-08T00:00:00.000Z',
    lastRecalledAt: '2026-04-09T00:00:00.000Z',
    ageDays: 0,
    score: 0.95,
    recallDays: ['2026-04-08', '2026-04-09'],
    conceptTags: ['candidate', 'truths'],
    components: { frequency: 1, relevance: 1, diversity: 1, recency: 1, consolidation: 1, conceptual: 1 },
  }],
});
console.log('placeholder promotions applied:', applied.applied);
console.log('MEMORY.md exists:', await fs.access(path.join(workspaceDir, 'MEMORY.md')).then(() => true, () => false));
EOF
  • Evidence after fix: terminal output from the real local checkout:
REM body contains placeholder: false
REM body contains possible truths section: false
REM body contains placeholder: false
REM body contains possible truths section: false
REM body line 1: ### Reflections
REM body line 2: - No strong patterns surfaced.
placeholder promotions applied: 0
MEMORY.md exists: false
  • Observed result after fix: Empty REM preview output no longer contains ### Possible Lasting Truths or No strong candidate truths surfaced; a historical placeholder-shaped promotion candidate applies 0 entries and does not create MEMORY.md.
  • What was not tested: A full scheduled dreaming cron run; validation exercised the real REM preview and promotion code paths directly with a temp workspace.

Validation

  • node scripts/test-projects.mjs extensions/memory-core/src/dreaming-phases.test.ts extensions/memory-core/src/short-term-promotion.test.ts
  • pnpm exec oxfmt --check --threads=1 extensions/memory-core/src/dreaming-phases.ts extensions/memory-core/src/dreaming-phases.test.ts extensions/memory-core/src/short-term-promotion.ts extensions/memory-core/src/short-term-promotion.test.ts
  • pnpm check:changed

Notes

This is intentionally narrow and does not attempt to replace the broader dreaming-contamination hardening discussed in #68774.

@clawsweeper

clawsweeper Bot commented May 12, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed July 3, 2026, 11:49 PM ET / 03:49 UTC.

Summary
The PR changes memory-core REM preview output and short-term promotion filtering so empty dreaming placeholders are not emitted or promoted.

PR surface: Source +16, Tests +66. Total +82 across 4 files.

Reproducibility: yes. source-level: current main still emits the empty REM placeholder when no candidate truths are selected, and the promotion guard does not recognize that placeholder as contaminated. I did not run executable tests because this review had to keep the checkout read-only.

Review metrics: 1 noteworthy metric.

  • Live merge state: CONFLICTING / DIRTY at 211d0d1. Maintainers need a resolved exact head before CI, proof, and review can cover the actual merge result.

Stored data model
Persistent data-model change detected: unknown-data-model-change: extensions/memory-core/src/short-term-promotion.test.ts, vector/embedding metadata: extensions/memory-core/src/short-term-promotion.test.ts, vector/embedding metadata: extensions/memory-core/src/short-term-promotion.ts. Confirm migration or upgrade compatibility proof before merge.

Merge readiness
Overall: 🐚 platinum hermit
Proof: 🦞 diamond lobster
Patch quality: 🐚 platinum hermit
Result: ready for maintainer review.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • Resolve the current-main conflict while preserving newer dreaming-contamination and fence-overlap hardening.
  • Rerun the focused memory-core tests and format check on the resolved exact head.

Risk before merge

  • [P1] GitHub reports the PR branch as CONFLICTING / DIRTY, so maintainers cannot treat the current head as merge-ready until conflict resolution is reviewed and revalidated.
  • [P1] The change is on the durable memory promotion path, so a bad merge resolution could either keep placeholder contamination or accidentally suppress legitimate durable candidates.

Maintainer options:

  1. Resolve the memory-core conflict first (recommended)
    Rebase or manually resolve the PR so current main's contamination, fence-overlap, and raw-snippet guards remain intact alongside the placeholder-specific fix, then rerun focused memory-core validation.
  2. Use a clean replacement if resolution gets noisy
    If this branch becomes harder to resolve than the change warrants, keep the linked issue open until a narrow replacement carries the same REM-output and promotion-filter fix with proof.

Next step before merge

  • [P2] Manual review is needed because the branch is conflicting; the remaining action is conflict resolution and exact-head validation, not a new independent fix-PR lane.

Security
Cleared: The diff is limited to memory-core filtering logic and tests, with no dependency, CI, secret, network, install, or code-execution surface added.

Review details

Best possible solution:

Resolve this PR against current main while preserving newer memory-core contamination guards, then land the two-sided fix that stops empty REM candidate output and rejects already-written placeholder snippets before promotion.

Do we have a high-confidence way to reproduce the issue?

Yes, source-level: current main still emits the empty REM placeholder when no candidate truths are selected, and the promotion guard does not recognize that placeholder as contaminated. I did not run executable tests because this review had to keep the checkout read-only.

Is this the best way to solve the issue?

Yes after conflict resolution: the PR uses the narrow maintainable shape by stopping candidate-like empty REM output and rejecting already-written placeholder snippets through the existing promotion contamination gate.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 9d68f877ac3e.

Label changes

Label justifications:

  • P2: This is a normal-priority memory-core bugfix that prevents meaningless placeholder text from polluting durable workspace memory.
  • merge-risk: 🚨 session-state: The PR changes durable memory promotion filtering, and an unsafe conflict resolution could reintroduce MEMORY.md pollution or drop newer contamination guards.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR body includes after-fix terminal output from a real local checkout invoking the production REM preview and short-term promotion apply paths with a temp workspace.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body includes after-fix terminal output from a real local checkout invoking the production REM preview and short-term promotion apply paths with a temp workspace.
Evidence reviewed

PR surface:

Source +16, Tests +66. Total +82 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 2 24 8 +16
Tests 2 66 0 +66
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 90 8 +82

What I checked:

Likely related people:

  • mbelinky: Merged PR metadata and git show show feat(memory-core): add REM preview and safe promotion replay #61540 added REM preview/candidate-truth output, including the empty placeholder fallback this PR removes. (role: introduced REM preview behavior; confidence: high; commits: 79348f73c8b6; files: extensions/memory-core/src/dreaming-phases.ts, extensions/memory-core/src/short-term-promotion.ts)
  • solomonneas: Merged PR metadata shows fix(memory-core): prevent staged dream candidates from leaking into MEMORY.md #68774 hardened the same short-term promotion contamination helper this PR extends. (role: recent adjacent filter contributor; confidence: high; commits: 314903417fcc; files: extensions/memory-core/src/short-term-promotion.ts, extensions/memory-core/src/short-term-promotion.test.ts)
  • gumadeiras: Merged PR metadata shows memory: block dreaming self-ingestion #66852 added earlier dreaming self-ingestion guards in the same promotion-filtering area. (role: adjacent dreaming self-ingestion contributor; confidence: medium; commits: 0c4e0d703023; files: extensions/memory-core/src/dreaming-phases.ts, extensions/memory-core/src/short-term-promotion.ts, extensions/memory-core/src/short-term-promotion.test.ts)
  • SebTardif: Merged PR metadata shows fix(memory-core): filter REM dreaming candidates to light-staged entries #86302 recently changed REM staging and promotion behavior in the same memory-core files after this PR opened. (role: recent REM/promotion area contributor; confidence: medium; commits: 8b42771aabd2; files: extensions/memory-core/src/dreaming-phases.ts, extensions/memory-core/src/short-term-promotion.ts, extensions/memory-core/src/short-term-promotion.test.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@openclaw-barnacle openclaw-barnacle Bot added proof: supplied External PR includes structured after-fix real behavior proof. and removed triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. labels May 12, 2026
@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 12, 2026
@openclaw-barnacle

Copy link
Copy Markdown

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added the stale Marked as stale due to inactivity label May 27, 2026
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. P2 Normal backlog priority with limited blast radius. labels May 27, 2026
@clawsweeper

clawsweeper Bot commented May 27, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper PR egg: ✨ hatched 🌱 uncommon Moonlit Shellbean. Rarity: 🌱 uncommon. Trait: sparkles near resolved comments.

Details

Share on X: post this hatch
Copy: My PR egg hatched a 🌱 uncommon Moonlit Shellbean in ClawSweeper.
Hatchability:

  • Merged PRs are hatchable.
  • Open PRs are hatchable when they are status: 👀 ready for maintainer look, status: 🚀 automerge armed, or labeled clawsweeper:automerge.
  • Closed unmerged PRs are hatchable only when one of those hatchable labels is still present in the durable record.

About:

  • Eggs appear after real-behavior proof passes. They are collectible flavor only.
  • Review momentum changes the shell state: follow-up work warms it, re-review makes it wobble, and a clean final review lets it hatch.
  • The hatch is seeded from this repository and PR number, so the same PR keeps the same creature; the reviewed head SHA can only change safe visual details.
  • Rarity is just collectible sparkle: 🥚 common, 🌱 uncommon, 💎 rare, ✨ glimmer, and 🌈 legendary.

@openclaw-barnacle openclaw-barnacle Bot removed the stale Marked as stale due to inactivity label May 28, 2026
@clawsweeper clawsweeper Bot added the merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. label Jun 14, 2026
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Jun 29, 2026
@openclaw-barnacle

Copy link
Copy Markdown

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

@openclaw-barnacle openclaw-barnacle Bot added the stale Marked as stale due to inactivity label Jul 19, 2026
@clawsweeper

clawsweeper Bot commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper status: review started.

I am starting a fresh review of this pull request: fix(memory): skip empty dreaming placeholders This is item 1/1 in the current shard. Shard 19/22.

This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking.

Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extensions: memory-core Extension: memory-core merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: supplied External PR includes structured after-fix real behavior proof. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S stale Marked as stale due to inactivity status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dreaming pipeline promotes empty-result placeholder "No strong candidate truths surfaced" into MEMORY.md

1 participant