fix(memory-core): exclude archive transcripts from dreaming corpus and propagate cron parentage to subagents#93187
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed June 24, 2026, 12:40 PM ET / 16:40 UTC. Summary PR surface: Source +117, Tests +252, Other 0. Total +369 across 8 files. Reproducibility: yes. from source inspection: Dreaming still enumerates every transcript corpus entry and buildSessionEntry still parses usage-counted reset/deleted archives unless they are classified as generated cron/dreaming. I did not run a live Dreaming cycle in this read-only review. Review metrics: 2 noteworthy metrics.
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:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Security Review findings
Review detailsBest possible solution: Keep QMD/memory_search archive indexing, add a Dreaming-only archive-artifact/primary-transcript guard with regression coverage, preserve cron lineage classification, and refresh current-head real behavior proof. Do we have a high-confidence way to reproduce the issue? Yes from source inspection: Dreaming still enumerates every transcript corpus entry and buildSessionEntry still parses usage-counted reset/deleted archives unless they are classified as generated cron/dreaming. I did not run a live Dreaming cycle in this read-only review. Is this the best way to solve the issue? No. The cron lineage walk is a plausible part of the fix, but the best fix also needs a Dreaming-only archive boundary and should avoid unused public SDK surface growth. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against c5f10b5f7c00. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +117, Tests +252, Other 0. Total +369 across 8 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
|
|
@clawsweeper check-test-types (pull_request) failed seems flaky |
b2c4548 to
94aca53
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
05fea9a to
ae9d3ba
Compare
|
@clawsweeper re-review |
…d propagate cron parentage to subagents Two fixes for Dreaming session-corpus pollution: 1. Change listSessionFilesForAgent to use isPrimarySessionTranscriptFileName instead of isUsageCountedSessionTranscriptFileName so reset/deleted archives are no longer re-ingested into the dreaming session corpus. 2. Propagate cron parentage to spawned subagents so dreaming phases skip content from cron-descended sessions. At spawn time, set parentTrigger on child sessions when the parent is cron-descended. The classification function walks the spawnedBy chain to identify cron descendants. Includes a secondary defense-in-depth check in dreaming-phases.ts. Fixes: openclaw#90313
…dBy chain tests - Remove misleading entry.sessionFile === fileName comparison in dreaming-phases.ts secondary defense (P3) - Add 8 dedicated tests for spawnedBy chain walk in loadSessionTranscriptClassificationForSessionsDir (P2) Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
… walk for cron classification
… ingestion, already handled by SDK classifier
…ssionTranscriptsDirForAgent QMD exports
a7e6944 to
dbba695
Compare
|
Hi @jalehman, sorry for the ping — this PR's been quiet for about a week. Just wanted to check: is this still worth |
|
Superseded by #96517, which implements a cleaner maintainer-owned fix that keeps the owner boundary on the existing session transcript corpus seam without SDK export churn. Closing this PR. Thanks for the solid root-cause analysis — the bug class was spot on. |
Summary
listSessionFilesForAgentusedisUsageCountedSessionTranscriptFileNamewhich includes.reset.*/.deleted.*archive artifacts. Archive exclusion is now at the Dreaming-only boundary — the shared helper remains usage-counted somemory_search/QMDcan still index archives.isCronRunSessionKeyonly matched the session's own key. Subagent sessions spawned by cron runs hadagent:main:subagent:*keys and were never classified as cron-descended.spawnedBychain walk in the SDK'sloadSessionTranscriptClassificationForSessionsDir— no duplicate secondary defense in Dreaming code, no new durable session-store field.isCronRunSessionKeyandresolveSessionTranscriptsDirForAgentQMD exports per ClawSweeper review — onlyisPrimarySessionTranscriptFileNameneeded at that boundary.fc27481): Fixed missing-parent lineage gap — the spawnedBy chain walk now checksisCronRunSessionKey(entry.spawnedBy)before requiring a parent store entry, so a subagent whosespawnedByis itself a cron-run key is classified as cron-descended even when the parent row has been pruned or was never in this store. Added regression test for this exact shape..deleted/.reset) transcripts re-ingested #90313Changes
extensions/memory-core/src/dreaming-phases.tsisPrimarySessionTranscriptFileNamecheck); remove duplicate spawnedBy chain walk (SDK classifier already handles this)packages/memory-host-sdk/src/host/session-files.tslistSessionFilesForAgentusage-counted formemory_search/QMDcallers; addspawnedBychain walk for cron-descended classification; removeparentTriggerhandling; checkisCronRunSessionKey(entry.spawnedBy)before parent store entry lookuppackages/memory-host-sdk/src/host/session-files.test.tspackages/memory-host-sdk/src/engine-qmd.tsisPrimarySessionTranscriptFileNamefor Dreaming boundary; remove unusedisCronRunSessionKeyandresolveSessionTranscriptsDirForAgentpackages/memory-host-sdk/src/host/openclaw-runtime.tsisPrimarySessionTranscriptFileNamefor Dreaming boundarypackages/memory-host-sdk/src/host/openclaw-runtime-session.tsscripts/plugin-sdk-surface-report.mjsVerification
pnpm test packages/memory-host-sdk/src/host/session-files.test.ts— 20/20 passed (incl. missing-parent regression test)pnpm test packages/memory-host-sdk/src/host/— 49/49 passed across 9 test filespnpm test extensions/memory-core/src/dreaming-phases.test.ts— 47/47 passedupstream/mainpnpm build— OK, binary matches HEAD (4d653f1)Real behavior proof
Behavior addressed: Exclude archive transcripts (
.reset.*and.deleted.*) from the Dreaming ingestion corpus so cron-heavy workspaces do not have 67%+ archive contamination in Dreaming output. Propagate cron parentage to subagent sessions via spawnedBy chain walk — including the missing-parent case where a subagent's spawnedBy is a cron-run key but the parent row has been pruned.Real environment tested: Local Linux x86_64 checkout of this PR branch (
fix/issue-90313-dreaming-corpus-archive) on OpenClaw2026.6.9(build4d653f1). OpenClaw built from repo viapnpm build. Node runtime.Exact steps or command run after this patch:
pnpm build— builds OpenClaw from PR branch sourceOpenClaw 2026.6.9 (4d653f1)matchesgit rev-parse --short HEAD(4d653f1)pnpm dlx tsx dreaming-proof-93187.mjs— runs a proof script that directly imports and calls the source functions:isPrimarySessionTranscriptFileName()/isUsageCountedSessionTranscriptFileName()fromsrc/config/sessions/artifacts.tsloadSessionTranscriptClassificationForSessionsDir()frompackages/memory-host-sdk/src/host/session-files.tspnpm test packages/memory-host-sdk/src/host/session-files.test.ts -- -t "archive|primary" --reporter verbose— archive exclusion tests (4 passed)pnpm test packages/memory-host-sdk/src/host/session-files.test.ts -- -t cron --reporter verbose— cron classification tests incl. missing-parent regression (7 passed)pnpm test extensions/memory-core/src/dreaming-phases.test.ts --reporter verbose— Dreaming integration tests (47/47 passed)node scripts/plugin-sdk-surface-report.mjs— SDK surface budgets regenerated (10328/5185)Evidence after fix:
Observed result after fix: All fix behaviors verified:
.deleted.*and.reset.*archive transcripts are excluded from the Dreaming corpus while remainingusage-counted=trueformemory_search/QMDarchive indexingspawnedBy → cron, and deeply nested subagent sessions are all correctly classified as cron-run via thespawnedBychain walkspawnedBykey is a cron-run key is correctly classified as cron-descended even when no parent entry exists in the store — covered by dedicated regression testupstream/main: 10328 public exports / 5185 public function exportsWhat was not tested: Live OpenClaw runtime with actual cron-heavy workspace and Dreaming invocation — classification is tested at the unit level; end-to-end runtime behavior with real Dreaming cycles depends on the ingestion pipeline integration tested in
dreaming-phases.test.ts.Related
.deleted/.reset) transcripts re-ingested #90313