fix(memory-core): exclude archived transcripts from Dreaming session corpus#90433
fix(memory-core): exclude archived transcripts from Dreaming session corpus#90433xiaobao-k8s wants to merge 6 commits into
Conversation
…corpus Archived session transcripts (.jsonl.reset.* and .jsonl.deleted.*) are currently ingested into the Dreaming corpus, polluting analysis with reset/deleted cron-spawned subagent noise. On a cron-heavy deployment, this causes 67-91% of the daily corpus to be dominated by automation noise, suppressing pattern discovery. Add a Dreaming-specific archive-exclusion boundary: a new isSessionArchiveTranscriptPath helper detects .jsonl.reset.* and .jsonl.deleted.* archives, and collectSessionIngestionBatches skips them during corpus assembly. This preserves memory_search archive indexing via the existing listSessionFilesForAgent path, which is unchanged for non-Dreaming callers. Fixes openclaw#90313
|
Thanks for the context here. I swept through the related work, and this is now duplicate or superseded. Close: this PR is now superseded by the merged session-corpus metadata implementation, which covers the archive exclusion and the broader cron-lineage defect on current main. Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Canonical path: Keep the merged #96517 implementation as the canonical path and close this conflicting archive-only branch. So I’m closing this here and keeping the remaining discussion on #96517. Review detailsBest possible solution: Keep the merged #96517 implementation as the canonical path and close this conflicting archive-only branch. Do we have a high-confidence way to reproduce the issue? No for current main: source inspection shows Dreaming now skips Is this the best way to solve the issue? No for this branch now. It was a plausible archive-only fix, but the best current solution is the merged session-transcript-corpus metadata seam from #96517 because it also handles cron lineage and avoids a duplicate Dreaming-local source of truth. Security review: Security review cleared: The PR changes memory-core TypeScript ingestion logic and tests only; no workflow, dependency, lockfile, script, credential, or third-party execution surface is changed. AGENTS.md: found and applied where relevant. What I checked:
Likely related people:
Codex review notes: model internal, reasoning high; reviewed against 6cb82eaab865; fix evidence: commit da50a450d271, main fix timestamp 2026-06-24T11:29:26-07:00. |
…VE_TIMESTAMP_RE
Make the milliseconds portion of the archive timestamp optional
((?:\.\d{3})?Z), matching the canonical contract in
src/config/sessions/artifacts.ts. Previously the local regex required
exactly three millisecond digits (\.\d{3}Z), which could miss valid
usage-counted archive transcripts without the optional millisecond
portion.
The plugin SDK boundary prevents direct import of the host's
isSessionArchiveArtifactName; this change aligns the local regex to the
same contract.
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Updated after the latest review and refreshed the branch against current Changes since the previous proof attempt:
Local verification on head
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Closing per ClawSweeper review: this PR has been superseded by #96517 (session-corpus metadata implementation). Thanks for the contribution! |
Summary
Archived session transcripts (
.jsonl.reset.*and.jsonl.deleted.*) arecurrently ingested into the Dreaming corpus, polluting analysis with
reset/deleted cron-spawned subagent noise. On a cron-heavy deployment,
this causes 67-91% of the daily corpus to be dominated by automation
noise, suppressing pattern discovery. This is particularly visible on
workspaces where cron jobs frequently spawn subagents whose transcripts get
reset/deleted but remain in the session directory as usage-counted archives.
Changes
isSessionArchiveArtifactNameclassifier so Dreamingfollows the canonical archive filename contract instead of carrying a local regex
collectSessionIngestionBatchessoDreaming corpus assembly skips archived transcripts
memory_searcharchive indexing path unchanged (only Dreamingingestion is affected)
including archive timestamps without milliseconds (
...T18-10-00Z)Real behavior proof
Behavior or issue addressed: Before the fix, Dreaming session-corpus assembly could ingest usage-counted reset/deleted archive transcripts and, after refreshing against current main, could also fail to preserve skipped-transcript checkpoint semantics for generated dreaming/isolated-cron transcripts. After the fix, Dreaming excludes session archive artifacts from the session corpus, keeps generated dreaming/cron run transcripts out of corpus output, preserves skipped checkpoints with zero ingested content lines, and keeps legacy JSON
sessions.jsonclassification compatible with the current SQLite session-store loader.Real environment tested: Repository
openclaw/openclaw, branchfix/dreaming-exclude-archives, commit61fd2d6f9cc5, local Linux worktree/datad/github/openclaw-issue90313refreshed against currentorigin/main, using real OpenClaw session storage under/root/.openclaw/agentsfor the patched Dreaming storage proof and a temp workspace/plugin-state store for output isolation.Exact steps or command run after this patch:
Evidence after fix: Terminal output from the verification:
Observed result after fix: The refreshed branch builds a Dreaming session corpus from live real session storage while sampled
.jsonl.reset.*archive transcripts remain absent from the corpus; generated dreaming and isolated cron transcript checkpoints are retained as zero ingested content lines; focused regression suites pass on the refreshed main branch.What was not tested: Full repository test suite and full production gateway run were not executed; validation was limited to changed-file lint, focused memory-core/SDK regressions, and a patched Dreaming run over real local session storage with redacted/archive-only file identifiers.
Test Plan
git diff --checkpnpm exec oxlint extensions/memory-core/src/dreaming-phases.ts extensions/memory-core/src/dreaming-phases.test.ts— 0 warnings, 0 errorsOPENCLAW_TEST_FAST=1 node scripts/test-projects.mjs extensions/memory-core/src/dreaming-phases.test.ts— 45 tests, all passingOPENCLAW_TEST_FAST=1 node scripts/test-projects.mjs packages/memory-host-sdk/src/host/session-files.test.ts— 12 tests, all passingRisk
loop. Archive files are still indexed for
memory_searchthrough theunchanged
listSessionFilesForAgent→buildSessionEntrypath used bymanager-sync-ops.tsandqmd-manager.ts.memory_searchcontract for reset/deleted archiveindexing.
Related Issue
Refs #90313 (archive transcript Dreaming corpus pollution).
Note: the broader cron-descended subagent classification issue mentioned in
the linked report is outside this patch's scope and remains tracked separately.
Follow-up after ClawSweeper review
sessions.jsonfallback frompackages/memory-host-sdk/src/host/session-files.ts; SQLite session metadata remains the canonical runtime source.git diff --check— passedpnpm exec oxlint extensions/memory-core/src/dreaming-phases.ts extensions/memory-core/src/dreaming-phases.test.ts— 0 warnings, 0 errorsOPENCLAW_TEST_FAST=1 node scripts/test-projects.mjs extensions/memory-core/src/dreaming-phases.test.ts— 45/45 passedOPENCLAW_TEST_FAST=1 node scripts/test-projects.mjs packages/memory-host-sdk/src/host/session-files.test.ts— 12/12 passed