Skip to content

fix(memory-core): keep Dream Diary to one entry per sweep#70403

Closed
solomonneas wants to merge 1 commit into
openclaw:mainfrom
solomonneas:fix/dream-diary-one-entry-per-sweep
Closed

fix(memory-core): keep Dream Diary to one entry per sweep#70403
solomonneas wants to merge 1 commit into
openclaw:mainfrom
solomonneas:fix/dream-diary-one-entry-per-sweep

Conversation

@solomonneas

@solomonneas solomonneas commented Apr 23, 2026

Copy link
Copy Markdown
Contributor

Summary

  • keep Dream Diary generation to one entry per nightly sweep
  • stop light and REM phases from appending their own DREAMS.md diary entries
  • update dreaming tests and docs to match deep-only diary generation

Why

A single sweep was appending multiple diary entries with the same displayed timestamp because light, REM, and deep all used the same sweep time when calling the narrative append path. This keeps the diary readable without changing phase reporting or promotion behavior.

Validation

  • pnpm test extensions/memory-core/src/dreaming-phases.test.ts extensions/memory-core/src/dreaming-narrative.test.ts
  • pnpm exec tsc -p extensions/memory-core/tsconfig.json --noEmit

Notes

  • This follows the existing dreaming-bloat cleanup work, but had to be opened from a separate fork branch because the older PR branch is owned by another fork and is not writable from this account.

Follow-up to #68774.
Also builds on the earlier dreaming-bloat cleanup in #68445.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation extensions: memory-core Extension: memory-core agents Agent runtime and tooling size: M labels Apr 23, 2026
@solomonneas
solomonneas force-pushed the fix/dream-diary-one-entry-per-sweep branch from 74c80ec to b450f96 Compare April 23, 2026 00:40
@openclaw-barnacle openclaw-barnacle Bot added size: S and removed agents Agent runtime and tooling size: M labels Apr 23, 2026
@SeashoreShi

Copy link
Copy Markdown

自动巡检路过:这个 PR 看起来是高性价比修复项。若 maintainer 需要,我可以继续补一轮最小验证(冲突/关键检查/回归点)并协助推进到可合并状态。

@solomonneas
solomonneas marked this pull request as ready for review April 23, 2026 01:45
@greptile-apps

greptile-apps Bot commented Apr 23, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR stops the light and REM dreaming phases from each independently appending a DREAMS.md diary entry during a single nightly sweep, leaving diary generation to the deep-phase path in dreaming.ts. The defensive session-cleanup helpers (deleteNarrativeSessionBestEffort, buildNarrativeSessionKey) are consistently removed alongside the narrative calls, and the tests are updated to assert the subagent is never invoked from the light/REM paths.

Confidence Score: 5/5

Safe to merge — the change is internally consistent and the tests directly verify the new single-entry-per-sweep invariant.

All remaining feedback is P2 style (value import vs. type-only import). No logic errors, missing cleanup, or broken contracts were found.

No files require special attention.

Prompt To Fix All With AI
This is a comment left during a code review.
Path: extensions/memory-core/src/dreaming-phases.ts
Line: 22

Comment:
**Value import used only for type inference**

After this PR's removals, `generateAndAppendDreamNarrative` is never called in this file — it is only referenced via `Parameters<typeof generateAndAppendDreamNarrative>[0]["subagent"]` in type positions (lines 55, 1491, 1551, 1604). A `import type` satisfies `typeof` in type positions just as well, and signals intent clearly.

```suggestion
import type { generateAndAppendDreamNarrative } from "./dreaming-narrative.js";
```

How can I resolve this? If you propose a fix, please make it concise.

Reviews (1): Last reviewed commit: "fix(memory-core): keep Dream Diary to on..." | Re-trigger Greptile

generateAndAppendDreamNarrative,
type NarrativePhaseData,
} from "./dreaming-narrative.js";
import { generateAndAppendDreamNarrative } from "./dreaming-narrative.js";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Value import used only for type inference

After this PR's removals, generateAndAppendDreamNarrative is never called in this file — it is only referenced via Parameters<typeof generateAndAppendDreamNarrative>[0]["subagent"] in type positions (lines 55, 1491, 1551, 1604). A import type satisfies typeof in type positions just as well, and signals intent clearly.

Suggested change
import { generateAndAppendDreamNarrative } from "./dreaming-narrative.js";
import type { generateAndAppendDreamNarrative } from "./dreaming-narrative.js";
Prompt To Fix With AI
This is a comment left during a code review.
Path: extensions/memory-core/src/dreaming-phases.ts
Line: 22

Comment:
**Value import used only for type inference**

After this PR's removals, `generateAndAppendDreamNarrative` is never called in this file — it is only referenced via `Parameters<typeof generateAndAppendDreamNarrative>[0]["subagent"]` in type positions (lines 55, 1491, 1551, 1604). A `import type` satisfies `typeof` in type positions just as well, and signals intent clearly.

```suggestion
import type { generateAndAppendDreamNarrative } from "./dreaming-narrative.js";
```

How can I resolve this? If you propose a fix, please make it concise.

@prtags

prtags Bot commented Apr 23, 2026

Copy link
Copy Markdown

Related work from PRtags group safe-marten-ot47

Title: Open PR candidate: Dream Diary duplicate/raw fallback cleanup

Number Title
#65138 Fix dreaming replay, repair polluted artifacts, and gate wiki tabs
#70332 fix(memory): harden dreaming diary pipeline
#70403* fix(memory-core): keep Dream Diary to one entry per sweep
#70523 fix(memory-core): suppress raw dreaming inline dumps on fallback (Fixes #70509)

* This PR

@solomonneas

Copy link
Copy Markdown
Contributor Author

Closing as superseded by #65138 (merged 2026-04-12), which addressed the duplicate Dream Diary entries with dedupeDreamDiaryEntries in extensions/memory-core/src/dreaming-narrative.ts:573 (also exposed as the doctor.memory.dedupeDreamDiary method). Dedup-by-fingerprint is a different solution path than what this PR took (removing per-phase narrative writes entirely), so rebasing this PR forward is no longer appropriate.

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

Labels

docs Improvements or additions to documentation extensions: memory-core Extension: memory-core size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants