fix(memory-core): route dreaming corpus through session metadata#96517
Conversation
|
Codex review: needs maintainer review before merge. Reviewed June 24, 2026, 2:28 PM ET / 18:28 UTC. Summary PR surface: Source +73, Tests +158, Other +1. Total +232 across 6 files. Reproducibility: yes. Current main is source-reproducible: Dreaming sends every memory-host corpus entry except checkpoints into ingestion, while reset/deleted archive artifacts remain part of the shared usage-counted corpus and cron classification is direct-key only. Review metrics: 1 noteworthy metric.
Stored data model Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land this seam-owned fix after memory/session owners accept the intentional Dreaming session-state behavior, use it to resolve #90313, and leave the broader SQLite migration work tracked by #88838. Do we have a high-confidence way to reproduce the issue? Yes. Current main is source-reproducible: Dreaming sends every memory-host corpus entry except checkpoints into ingestion, while reset/deleted archive artifacts remain part of the shared usage-counted corpus and cron classification is direct-key only. Is this the best way to solve the issue? Yes. Filtering archive artifacts at the Dreaming collector preserves QMD and memory_search archive indexing, and computing cron lineage in the memory-host corpus metadata seam avoids new SDK, config, or SQLite surface. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against c2d2f7fef9bd. Label changesLabel justifications:
Evidence reviewedPR surface: Source +73, Tests +158, Other +1. Total +232 across 6 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
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
|
3d88a03 to
cc7fac2
Compare
What Problem This Solves
This PR closes the remaining Path 3 3.1b memory-host session corpus follow-up for the Dreaming corpus defects reported in #90313. It keeps retained reset/delete archive artifacts available to the shared memory-host transcript corpus for QMD and
memory_search, while preventing Dreaming from re-ingesting those archives, and it classifies cron-descended child transcripts through existing session metadata.Why This Change Was Made
#93187 found the right bug class, but it pulled the fix through legacy helper surfaces and SDK export churn. This maintainer-owned slice keeps the owner boundary on the existing session transcript corpus seam in
packages/memory-host-sdk, avoids a new SDK API or SQLite contract, and adds the ratchet coverage needed for the Path 3 tracker.User Impact
Dreaming session-corpus files stop filling with reset/delete archive duplicates and cron-spawned child transcript noise. Shared corpus consumers still see archive artifacts where they are expected, so historical transcript search behavior is preserved.
Evidence
node scripts/run-vitest.mjs test/scripts/plugin-sdk-surface-report.test.ts packages/memory-host-sdk/src/host/session-files.test.ts extensions/memory-core/src/dreaming-phases.test.ts test/scripts/check-session-accessor-boundary.test.ts- passed on rebased headcc7fac26ee9(72 unit/script tests + 48 memory-core extension tests).node scripts/check-session-accessor-boundary.mjs- passed.node scripts/plugin-sdk-surface-report.mjs --check- passed.pnpm exec oxfmt --check --threads=1 ...- passed for all changed files.node scripts/run-oxlint.mjs ...- passed for all changed files.node scripts/run-tsgo.mjs -p tsconfig.core.json ...- passed.node scripts/run-tsgo.mjs -p tsconfig.extensions.json ...- passed.node scripts/run-tsgo.mjs -p test/tsconfig/tsconfig.test.packages.json ...- passed.node scripts/run-tsgo.mjs -p test/tsconfig/tsconfig.extensions.test.json ...- passed.node scripts/run-tsgo.mjs -p test/tsconfig/tsconfig.test.src.json ...- passed..agents/skills/autoreview/scripts/autoreview --mode branch --base upstream/main ...- clean, no accepted/actionable findings; overall patch correct (0.84).3d88a034986failedchecks-node-compact-small-whole-2intest/scripts/plugin-sdk-surface-report.test.tswithexpected +0 to be 1at line 103. That check was unrelated to this PR's touched files and was fixed upstream byd01c2906015 test(sdk): assert surface budget growth guardand5eec2158ea0 fix(sdk): restore post-build surface budgets; this branch was rebased to inherit those fixes and pushed ascc7fac26ee9. GitHub CI is now green oncc7fac26ee9with merge stateCLEAN(69 successful checks, 29 skipped, CodeQL neutral, no pending or failing checks).Real behavior proof
Behavior addressed: Dreaming learns only from live non-cron session transcripts while the shared memory-host session corpus still exposes retained reset/delete archive artifacts for QMD and
memory_search.Real environment tested: Local live OpenClaw gateway from
/Users/phaedrus/Projects/clawdbot, temporarily loaded with pre-rebase proof SHA7e3590a3f897a536e98905774ad948e49bfddbdd, OpenClaw2026.6.10 (7e3590a), then restored to the original detached checkout352c4a40d838d7deb0bfdf38fa33665aef00be72. Rebased PR head iscc7fac26ee980af61c53cb2501c2e4a301ad18be; focused post-rebase tests/checks above passed after the conflict-free code rebase.Exact steps or command run after this patch:
Evidence after fix: The isolated live-proof script seeded temp
OPENCLAW_STATE_DIRandOPENCLAW_CONFIG_PATHwith active, archive-only, cron parent, cron child, cron grandchild, orphan cron child, and normal child transcripts. It reportedverdict: "PASS",corpusEntryCount: 7,archiveArtifactVisibleToCorpus: true, cron-classified pathscron-parent.jsonl,cron-child.jsonl,cron-grandchild.jsonl, andorphan-child.jsonl, and a persisted Dreaming corpus file with 28 lines. The grep proof showed onlyLive primary session insightandNormal child should be dreamedlines inmemory/.dreams/session-corpus/2026-04-05.txt; archive and cron phrases were absent. Persisted temp state includedstate/state/openclaw.sqlite, proving the Dreaming plugin-state seam wrote through SQLite. Cleanup removed both the temp proof root and temp proof script. The restored live gateway later reportedOpenClaw 2026.6.10 (352c4a4),ok: true,memoryCoreLoaded: true,eventLoopDegraded: false,/readyzready, and/healthzlive.Observed result after fix: Shared corpus enumeration still includes retained archive artifacts, but Dreaming skips archive artifacts before parsing and marks cron-lineage transcripts as seen without appending their content to the Dreaming session-corpus. Live/normal session content is appended as expected.
What was not tested: The future SQLite transcript flip, doctor import/migration behavior, new SDK APIs, and defense-in-depth prompt-stem filtering were not tested because they are out of scope for this 3.1b seam slice. The real live proof was run before the rebase from
7e3590a3f897a536e98905774ad948e49bfddbddtocc7fac26ee980af61c53cb2501c2e4a301ad18be; the rebased head received the focused test/guard/type/autoreview proof listed above.Related
.deleted/.reset) transcripts re-ingested #90313..deleted/.reset) transcripts re-ingested #90313 fix shape in fix(memory-core): exclude archive transcripts from dreaming corpus and propagate cron parentage to subagents #93187 with a narrower Path 3 seam-owned implementation.