Repository navigation
Description
Bug type
Regression (worked before, now fails)
Beta release blocker
No
Summary
On 2026.6.1, dreaming session-corpus files contain entries sourced from .jsonl.deleted.* session paths, and the narrative phase writes a placeholder fallback to DREAMS.md while the journal shows a full prose response on the next log line.
Steps to reproduce
- Install 2026.6.1 with
plugins.entries.memory-core.config.dreaming.enabled: trueand at least one agent. - Let dreaming run for 2–3 cycles (default cron
0 7 * * *). - Run:
grep -c '\.deleted\.' ~/.openclaw/workspace/memory/.dreams/session-corpus/*.txt
Observe non-zero counts. - Run:
openclaw memory rem-harness --agent main --json --groundedand observe deep candidates whosepathfield references.jsonl.deleted.*files. - Watch the gateway journal during a
0 7 * * *cycle. For each affected phase, the plugin logsnarrative generation produced no text for <phase> phase; writing fallback diary entry, immediately followed by a separate stdout line containing a complete prose response. - Inspect DREAMS.md for the affected workspace; entries read
A memory trace surfaced, but details were unavailable in this run.
Expected behavior
Per 2026.5.28 behavior (last known working version): dreaming narrative phase writes prose entries to DREAMS.md derived from the model's response, and session-corpus does not contain entries sourced from session files with .jsonl.deleted.* path suffixes.
Actual behavior
- session-corpus/*.txt files contain entries with path prefix
[<agent>/sessions/<agent>/<uuid>.jsonl.deleted.<timestamp>#L<n>]. - On a 5-agent install, the
mainagent's corpus contained 411 of 570 lines (~72%) matching this pattern across 15 daily files; some days were 100% these paths. openclaw memory rem-harness --agent main --json --groundedreturned 507 deep candidates whose snippets are sourced from.jsonl.deleted.*paths.- During each dreaming cycle, the gateway journal logs
narrative generation produced no text for <phase> phase; writing fallback diary entry. The next stdout line contains a complete prose response, indicating the model returned text that the plugin classified as empty. - DREAMS.md entries for affected phases are the placeholder string
A memory trace surfaced, but details were unavailable in this run.
OpenClaw version
2026.6.1 (commit 2e08f0f)
Operating system
Ubuntu 24.04 (x86_64)
Install method
npm global (/usr/lib/node_modules/openclaw)
Model
openrouter/x-ai/grok-4.3 (default dreaming model); anthropic/claude-sonnet-4-6 (deep-phase override). "produced no text" classification observed against both per journal output.
Provider / routing chain
openclaw → openrouter (default and rem/light phases) and openclaw → anthropic (deep phase). Memory-core narrative subagent runs use the same routing.
Additional provider/model setup details
Memory plugin: bundled memory-core. dreaming.enabled: true at all five agents/workspaces. The "produced no text" classification reproduces across model providers per journal observation; the symptom is not provider-specific.
Logs, screenshots, and evidence
Contamination count, main agent corpus (2026-06-04):
2026-05-26.txt contam=38 total=38
2026-05-28.txt contam=39 total=39
2026-05-31.txt contam=40 total=50
2026-06-01.txt contam=40 total=47
2026-06-02.txt contam=35 total=43
2026-06-03.txt contam=10 total=10
(15 files total; 3 days clean, 12 contaminated, ~411/570 lines)
rem-harness candidate sample (one of 507):
"snippet": "User: Write a dream diary entry from these memory fragments: -
Assistant: <truncated session content> ..."
"path": "memory/.dreams/session-corpus/2026-06-01.txt"
Journal excerpt from a dreaming cycle on 2026-06-04 07:00 UTC:
07:00:14 [plugins] memory-core: narrative generation produced no text for deep phase; writing fallback diary entry.
07:00:14 [plugins] memory-core: narrative generation used fallback for deep phase because the narrative run produced no text.
07:00:14 <complete prose response captured on next stdout line>Impact and severity
Affected users/systems/channels: Users with memory-core.config.dreaming.enabled: true, especially multi-agent installs.
Severity: Medium-high. Memory promotion candidates and DREAMS.md fill with content sourced from prior dreaming cycles; long-term memory quality degrades indirectly.
Frequency: Always (100% of dreaming cycles on 2026.6.1 with multiple agents enabled).
Consequence: Long-term memory consolidation silently degrades. The fallback prose mechanism means dreaming never visibly fails; operators may not detect the issue until inspecting DREAMS.md.
Additional information
Last known good: 2026.5.28.
First known bad: 2026.6.1 (intermediate 2026.6.x builds not tested).
Related: #65653 (narrative-subagent sessions write under agents/main/sessions/ regardless of source agent).
2026.6.2-beta.1 release notes do not appear to address this; memory items in that release cover watcher pressure and session write-lock release on prompt-cache fence reads.
Workaround applied:
find /memory/.dreams/session-corpus -name '*.txt' -exec sed -i '/.deleted./d' {} ;
mv /memory/.dreams/short-term-recall.json /
openclaw config set 'plugins.entries.memory-core.config.dreaming.enabled' false --strict-json
systemctl --user restart openclaw-gateway
openclaw memory rem-backfill --rollback and --rollback-short-term per agent both returned removedEntries: 0 / removedShortTermEntries: 0. These commands only undo manual rem-backfill operations and do not affect automatic session ingestion into session-corpus.
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Activity
clawsweeper commentedon Jun 4, 2026
Thanks for the context here. I swept through the related work, and this is now duplicate or superseded.
Close as superseded: the useful remaining work from this umbrella report is now split across focused open issues for the archive-corpus defect and the remaining narrative fallback variants, while the already-merged retry PR covers the immediate post-run read visibility race.
Canonical path: #90313 is open and specifically tracks the usage-counted archive predicate plus cron-descended subagent classification gaps that explain
.jsonl.deleted.*and.jsonl.reset.*corpus contamination.So I’m closing this here and keeping the remaining discussion on #90313, #87182, #90292, and #90781.
Review details
Best possible solution:
Keep this umbrella closed and route fixes through the focused canonical issues so archive ingestion, cleanup/readback races, and diagnostic fallback behavior can be resolved independently without losing this report’s linked evidence.
Do we have a high-confidence way to reproduce the issue?
Yes, source-level: current main still has an archive-eligible session listing feeding dreaming, and the narrative path still falls back when settled reads remain empty. I did not run a live current-main dreaming cron sweep in this read-only review.
Is this the best way to solve the issue?
Yes. Closing this umbrella as superseded is the best cleanup path because the remaining work is already split into narrower open reports with fresher evidence and clearer fix boundaries.
Security review:
Security review: This is issue cleanup with no patch security surface to review.
AGENTS.md: found and applied where relevant.
What I checked:
listSessionFilesForAgentcurrently filters session files withisUsageCountedSessionTranscriptFileName, which includes.jsonl.reset.*and.jsonl.deleted.*archives; this confirms the archive-corpus half belongs to the narrower open corpus issue rather than being fully fixed here. (packages/memory-host-sdk/src/host/session-files.ts:303, d1b33a6040a4)collectSessionIngestionBatchescallslistSessionFilesForAgent, classifies returned files, and only skips checkpoint paths before rendering the session path into corpus lines; the remaining archive boundary is the same one tracked by Dreaming session-corpus: cron classification doesn't follow subagent parentage; archived (.deleted/.reset) transcripts re-ingested #90313. (extensions/memory-core/src/dreaming-phases.ts:852, d1b33a6040a4)extensions/memory-core/src/dreaming-narrative.ts:1106, d1b33a6040a4)extensions/memory-core/src/dreaming-narrative.ts:391, cdb55b3edb37).deleted/.reset) transcripts re-ingested #90313 is open and specifically tracks the usage-counted archive predicate plus cron-descended subagent classification gaps that explain.jsonl.deleted.*and.jsonl.reset.*corpus contamination.Likely related people:
extensions/memory-core/src/dreaming-narrative.ts,extensions/memory-core/src/dreaming-narrative.test.ts)extensions/memory-core/src/dreaming-narrative.ts,extensions/memory-core/src/dreaming-narrative.test.ts)extensions/memory-core/src/dreaming-phases.ts,extensions/memory-core/src/dreaming-phases.test.ts)extensions/memory-core/src/dreaming-phases.ts,packages/memory-host-sdk/src/host/session-files.ts)packages/memory-host-sdk/src/host/session-files.ts)Codex review notes: model internal, reasoning high; reviewed against d1b33a6040a4.
apalmiere commentedon Jun 5, 2026
Root cause for the "narrative phase writes fallback despite valid prose" half of this issue (the
produced no textpath), traced on2026.6.1indist/dreaming-narrative-*.js(generateAndAppendDreamNarrative).Mechanism: the readback reads the wrong session key.
The narrator subagent run succeeds (
result.status === "ok"), so the model does return prose — which is why the very next journal line shows a complete response. But the readback that follows uses the bare attempt key, while the run stored its messages under the owner-canonical key (agent:<id>:<bareKey>):successfulSessionKeycomes frombuildNarrativeAttemptSessionKey(buildNarrativeSessionKey(...)), which yields an unprefixeddreaming-narrative-<phase>-<hash>. ButgetSessionMessages→ gatewaysessions.getresolves/stores under the owner-canonical key viaresolveSessionStoreKey(session-store-key-*.js), i.e.agent:<id>:dreaming-narrative-<phase>-<hash>. The bare-keysessions.getmisses →messagesempty →extractNarrativeTextreturns nothing → unconditional fallback. The prose is generated and then discarded every cycle.Confirmed locally: zero diary/narrator readback hits,
produced no texton every phase, DREAMS.md filled with raw fallback stubs — while gateway logs showed full Sonnet prose on the adjacent line. Last good prose entry predates the regression.Fix: when the bare-key readback is empty, retry against the owner-canonical key(s) before falling back. Minimal, reuses existing runtime resolvers (
listAgentIds/canonicalizeSessionKeyForAgent):The cleaner upstream fix is to canonicalize the key once at the source (have
generateAndAppendDreamNarrativeresolvesuccessfulSessionKeythrough the sameresolveSessionStoreKeypath the writer uses, or have the narrator return its run output directly rather than via a session readback), so the read and write keys can never diverge.The
.jsonl.deleted.*corpus-path half of this issue looks separate (session-corpus sourcing from soft-deleted session files); I haven't root-caused that one, but it's plausibly why some readbacks land on a now-renamed/deleted store entry, compounding the miss.Happy to open a PR for the readback fix if useful.
mrizzo123 commentedon Jun 5, 2026
@apalmiere thanks for this, the key-mismatch finding lines up exactly with what we observed (full prose on the adjacent journal line, but DREAMS.md getting the fallback string). Please open the PR, happy to test on our install once it lands in any tagged release (beta or stable).
One clarification to make sure I'm reading you right: your fix addresses the "produced no text" / wrong-readback-key bug. The
.jsonl.deleted.*paths showing up insession-corpus/*.txtlook like a separate issue (autoingestion of soft-deleted session files), which I assume needs its own fix. Is that your read too?If so, want me to split that half into a sibling issue so #90466 stays focused on the readback fix you're patching?
tianxiaochannel-oss88 commentedon Jun 8, 2026
Adding another live datapoint for the DREAMS.md fallback half of this issue.
Environment:
Observed locally:
~/.openclaw/workspace/DREAMS.mdcontains the exact placeholder stringA memory trace surfaced, but details were unavailable in this run.5 times across the June 6-8 diary window./tmp/openclaw/openclaw-2026-06-08.log: 8 lines matchingnarrative generation produced no text/narrative generation used fallback/tmp/openclaw/openclaw-2026-06-07.1.log: 6 matching lines).Source-level observation from the installed package:
In my local install this is in the bundled
dist/dreaming-narrative-*.js; the fallback is not coming from local workspace docs/scripts/overlays. That lines up with this issue being in the native memory-core dreaming narrative path rather than a user-authored memory framework artifact.This also matches the comment above about the generated prose being discarded or read back as empty: the log says the narrative run produced no text, while DREAMS.md receives the generic fallback placeholder instead of a real diary entry.