Skip to content

fix(memory): stop light dreaming from restaging stale summaries#97446

Merged
vincentkoc merged 2 commits into
openclaw:mainfrom
qingminglong:codex/72096-dreaming-light-dedupe
Jun 28, 2026
Merged

fix(memory): stop light dreaming from restaging stale summaries#97446
vincentkoc merged 2 commits into
openclaw:mainfrom
qingminglong:codex/72096-dreaming-light-dedupe

Conversation

@qingminglong

@qingminglong qingminglong commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

Closes #72096

What Problem This Solves

Fixes an issue where users running memory-core dreaming would see the same light-phase work summary staged again in later cycles when the underlying daily memory content had not changed.

Why This Change Was Made

Light dreaming now filters already-emitted recall entries unless the recall freshness moved past the last light emission. Repeated same-query daily signals keep their original freshness when the stored snippet is unchanged, including cross-day re-ingestion, so unchanged daily ingestion no longer makes stale content look new while real same-day note edits can still be staged.

User Impact

DREAMS.md light-phase sections stop repeating unchanged work-summary blocks across hourly or cross-night cycles, reducing duplicate memory noise without hiding newly edited daily-note content from later light dreaming cycles.

Evidence

  • Claim proved: unchanged light dreaming candidates are not restaged in a later cycle, cross-day unchanged daily re-ingestion increments dailyCount without refreshing lastRecalledAt, and same-day daily-note content changes are still restaged.

  • Duplicate PR checks: gh search prs --repo openclaw/openclaw --state open --match title,body -- "72096", "Dreaming light-phase work summary repeats", and "light dreaming lastLightAt" returned no open PR coverage before opening this PR.

  • Real behavior proof: ran runDreamingSweepPhases from extensions/memory-core/src/dreaming-phases.ts against a temporary memory workspace and temporary SQLite-backed memory-core state store on PR head 5c3f7ed6f3ce3ea4566f29e7402792d6a3af729a. This exercised the real light-dreaming runtime write path into memory/2026-04-05.md with inline dreaming output; no private local OpenClaw home, credentials, or user memory were used.

    Redacted terminal output from the repeated light-dreaming cycle:

    {
      "proof": "PR #97446 real light-dreaming repeated-cycle proof",
      "head": "5c3f7ed6f3ce3ea4566f29e7402792d6a3af729a",
      "workspace": "<temp-workspace>",
      "stateDir": "<temp-state>",
      "cycles": [
        {
          "label": "cycle 1: initial daily note",
          "now": "2026-04-05T10:01:00.000Z",
          "candidateCount": 1,
          "noNotableUpdates": false,
          "lightBlock": "- Candidate: Added primary issue extraction for pain notifications.; Updated signals cron notification style.\n  - confidence: 0.62\n  - evidence: memory/2026-04-05.md:3-4\n  - recalls: 0\n  - status: staged",
          "logs": [
            "[info] memory-core: light dreaming staged 1 candidate(s) [workspace=<temp-workspace>]."
          ]
        },
        {
          "label": "cycle 2: unchanged note",
          "now": "2026-04-05T11:01:00.000Z",
          "candidateCount": 0,
          "noNotableUpdates": true,
          "lightBlock": "- No notable updates.",
          "logs": []
        },
        {
          "label": "cycle 3: edited note",
          "now": "2026-04-05T12:01:00.000Z",
          "candidateCount": 1,
          "noNotableUpdates": false,
          "lightBlock": "- Candidate: Added primary issue extraction for pain notifications.; Updated signals cron notification style.; Documented the shared pain notification issue.\n  - confidence: 0.62\n  - evidence: memory/2026-04-05.md:3-5\n  - recalls: 0\n  - status: staged",
          "logs": [
            "[info] memory-core: light dreaming staged 1 candidate(s) [workspace=<temp-workspace>]."
          ]
        }
      ]
    }

    Observed result: the first cycle staged one light candidate, the second unchanged cycle wrote - No notable updates. with candidateCount: 0, and the third cycle after editing the daily note staged the updated candidate again.

  • Commands / artifacts:

    • git diff --check passed.
    • node scripts/run-vitest.mjs extensions/memory-core/src/dreaming-phases.test.ts extensions/memory-core/src/short-term-promotion.test.ts passed: 2 files, 130 tests.
    • corepack 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 passed.
    • node scripts/run-tsgo.mjs -p test/tsconfig/tsconfig.extensions.test.json --incremental --tsBuildInfoFile .artifacts/tsgo-cache/extensions-test.tsbuildinfo passed, matching the previous failing CI check-test-types extension-test lane.
    • python .agents\skills\autoreview\scripts\autoreview --mode local passed with autoreview clean: no accepted/actionable findings reported after the cross-day freshness fix.
  • Not tested / proof gaps: did not run an overnight wall-clock dreaming cycle or broad local repo checks. The added real behavior proof uses a temporary workspace and calls the shipped memory-core light-dreaming runtime entry directly to exercise the repeated-cycle write path without exposing private local memory.

@clawsweeper

clawsweeper Bot commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed June 28, 2026, 4:50 AM ET / 08:50 UTC.

Summary
The PR adds a memory-core light-dreaming freshness filter, preserves lastRecalledAt for unchanged repeated deduped recall entries, and adds regression tests for unchanged, edited, and cross-day ingestion cycles.

PR surface: Source +47, Tests +115. Total +162 across 4 files.

Reproducibility: yes. source-level: current main ranks live short-term recall entries within the lookback before using prior light-emission state, and the linked report plus PR proof show the repeated-cycle behavior. I did not run a live overnight cycle in this read-only review.

Review metrics: 1 noteworthy metric.

  • Persistent Memory Freshness: 1 stored timestamp write behavior changed. The PR changes when lastRecalledAt advances for repeated deduped recall entries, which affects session-state semantics before merge.

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

Root-cause cluster
Relationship: fixed_by_candidate
Canonical: #72096
Summary: The linked issue is the canonical report for repeated light-phase DREAMS.md work-summary blocks, and this PR is the current open candidate fix while prior same-root PR attempts are closed unmerged.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

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

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

Risk before merge

  • [P1] The PR changes how persisted recall freshness and prior light emissions interact; if the invariant is wrong, light dreaming could either suppress edited memory content or allow stale summaries to repeat.

Maintainer options:

  1. Land With Current Proof (recommended)
    Accept the residual session-state risk based on the direct runtime proof, focused regression coverage, clean mergeability, and green checks on the current head.
  2. Request Longer Dreaming Proof
    Ask for an overnight or cross-night repeated-cycle artifact before merge if maintainers want proof beyond the temporary-workspace runtime path.

Next step before merge

  • No automated repair is needed; the remaining action is maintainer merge judgment on the session-state behavior change.

Security
Cleared: No concrete security or supply-chain concern found; the diff touches memory-core runtime/tests only and does not change dependencies, workflows, permissions, or secret handling.

Review details

Best possible solution:

Land the focused memory-core repair after maintainer acceptance of the session-state risk and exact-head proof/checks remain green.

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

Yes, source-level: current main ranks live short-term recall entries within the lookback before using prior light-emission state, and the linked report plus PR proof show the repeated-cycle behavior. I did not run a live overnight cycle in this read-only review.

Is this the best way to solve the issue?

Yes. The patch uses the existing phase-signal store and short-term recall freshness boundary instead of adding config or a parallel state shape, and it covers the prior cross-day freshness blocker.

AGENTS.md: found and applied where relevant.

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

Label changes

Label changes:

  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • remove rating: 🐚 platinum hermit: Current PR rating is rating: 🦞 diamond lobster, so this older rating label is no longer current.

Label justifications:

  • P2: This is a normal-priority memory-core bug fix with limited blast radius in DREAMS.md and future memory context.
  • merge-risk: 🚨 session-state: The diff changes persisted recall freshness and light-emission gating, which can stale or repeat user-visible memory context if wrong.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR body includes redacted terminal output from the real light-dreaming runtime entry showing the first cycle stages, the unchanged second cycle writes no notable updates, and an edited third cycle stages again.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body includes redacted terminal output from the real light-dreaming runtime entry showing the first cycle stages, the unchanged second cycle writes no notable updates, and an edited third cycle stages again.
Evidence reviewed

PR surface:

Source +47, Tests +115. Total +162 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 2 52 5 +47
Tests 2 116 1 +115
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 168 6 +162

What I checked:

Likely related people:

  • vignesh07: Introduced the dreaming sweep, diary surface, and central memory-core dreaming files that contain the changed light-dreaming path. (role: feature introducer; confidence: high; commits: 61e61ccc182f; files: extensions/memory-core/src/dreaming-phases.ts, extensions/memory-core/src/short-term-promotion.ts, extensions/memory-core/src/dreaming-narrative.ts)
  • SebTardif: Authored the merged REM light-staged phase-signal work using the same phase-signal store this PR now consumes for light freshness. (role: phase-signal contributor; confidence: high; 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)
  • obviyus: Authored the merged daily-memory re-ingestion change in the dreaming path implicated by cross-day recall freshness. (role: daily-ingestion contributor; confidence: medium; commits: 8faf91a2a8c9; files: extensions/memory-core/src/dreaming-phases.ts, extensions/memory-core/src/dreaming-phases.test.ts)
  • vincentkoc: Recently touched short-term promotion and light-confidence behavior in the same memory-core area, and prior review context identified the deduped daily-ingestion freshness blocker this branch addresses. (role: recent area contributor and reviewer; confidence: high; commits: 077cfca22972, 8a4a63ca076e; files: extensions/memory-core/src/short-term-promotion.ts, extensions/memory-core/src/dreaming-phases.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.

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. labels Jun 28, 2026
@qingminglong

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@qingminglong

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. 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. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Jun 28, 2026
@vincentkoc
vincentkoc merged commit 5e1f4c1 into openclaw:main Jun 28, 2026
133 of 140 checks passed
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jun 29, 2026
…claw#97446)

* fix(memory): stop restaging stale light dreams

* fix(memory): preserve cross-day light freshness
QiuYuang pushed a commit to QiuYuang/openclaw that referenced this pull request Jul 1, 2026
…claw#97446)

* fix(memory): stop restaging stale light dreams

* fix(memory): preserve cross-day light freshness
chenyangjun-xy pushed a commit to chenyangjun-xy/openclaw that referenced this pull request Jul 1, 2026
…claw#97446)

* fix(memory): stop restaging stale light dreams

* fix(memory): preserve cross-day light freshness
chenyangjun-xy pushed a commit to chenyangjun-xy/openclaw that referenced this pull request Jul 3, 2026
…claw#97446)

* fix(memory): stop restaging stale light dreams

* fix(memory): preserve cross-day light freshness
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. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. size: S 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.

[Bug]: Dreaming light-phase work summary repeats verbatim across hourly cycles, producing apparent duplicates in DREAMS.md

2 participants