fix(dreaming): use ingestion date for dayBucket instead of file date#67091
Conversation
Greptile SummaryFixes a dedupe regression in the dreaming pipeline where Confidence Score: 5/5Safe to merge — targeted fix with a direct regression test and no unintended side effects. All three changed call sites receive the same correct treatment (ingestion date instead of file date), same-day deduplication still works correctly, and the new test directly exercises the broken path. No P0/P1 issues found. No files require special attention. Reviews (1): Last reviewed commit: "fix(dreaming): use ingestion date for da..." | Re-trigger Greptile |
cb4ab80 to
7257b0c
Compare
When dreaming re-ingests the same daily memory file on a later day, dayBucket was set to batch.day (the file date, e.g. '2026-04-11') instead of the current ingestion date. Because dedupeByQueryPerDay checks whether todayBucket already appears in recallDays, using the file date caused all subsequent sweeps to hit the dedupe guard — the file date was already in recallDays from the first ingestion. This kept dailyCount stuck at 1, signalCount below the minRecallCount=3 promotion gate, and zero entries ever reached the scoring stage. Fix: pass formatMemoryDreamingDay(params.nowMs, params.timezone) as dayBucket in all three ingestion call sites (session transcripts, daily memory, and historical seed). The query string still uses the file date for identification; only the dedupe bucket changes to reflect when the sweep actually ran. Closes openclaw#67061
7257b0c to
2df44e4
Compare
|
Merged via squash.
Thanks @Bartok9! |
…penclaw#67091) Merged via squash. Prepared head SHA: 2df44e4 Co-authored-by: Bartok9 <259807879+Bartok9@users.noreply.github.com> Co-authored-by: jalehman <550978+jalehman@users.noreply.github.com> Reviewed-by: @jalehman
…penclaw#67091) Merged via squash. Prepared head SHA: 2df44e4 Co-authored-by: Bartok9 <259807879+Bartok9@users.noreply.github.com> Co-authored-by: jalehman <550978+jalehman@users.noreply.github.com> Reviewed-by: @jalehman
…penclaw#67091) Merged via squash. Prepared head SHA: 2df44e4 Co-authored-by: Bartok9 <259807879+Bartok9@users.noreply.github.com> Co-authored-by: jalehman <550978+jalehman@users.noreply.github.com> Reviewed-by: @jalehman
…penclaw#67091) Merged via squash. Prepared head SHA: 2df44e4 Co-authored-by: Bartok9 <259807879+Bartok9@users.noreply.github.com> Co-authored-by: jalehman <550978+jalehman@users.noreply.github.com> Reviewed-by: @jalehman
…penclaw#67091) Merged via squash. Prepared head SHA: 2df44e4 Co-authored-by: Bartok9 <259807879+Bartok9@users.noreply.github.com> Co-authored-by: jalehman <550978+jalehman@users.noreply.github.com> Reviewed-by: @jalehman
…penclaw#67091) Merged via squash. Prepared head SHA: 2df44e4 Co-authored-by: Bartok9 <259807879+Bartok9@users.noreply.github.com> Co-authored-by: jalehman <550978+jalehman@users.noreply.github.com> Reviewed-by: @jalehman
…penclaw#67091) Merged via squash. Prepared head SHA: 2df44e4 Co-authored-by: Bartok9 <259807879+Bartok9@users.noreply.github.com> Co-authored-by: jalehman <550978+jalehman@users.noreply.github.com> Reviewed-by: @jalehman
…penclaw#67091) Merged via squash. Prepared head SHA: 2df44e4 Co-authored-by: Bartok9 <259807879+Bartok9@users.noreply.github.com> Co-authored-by: jalehman <550978+jalehman@users.noreply.github.com> Reviewed-by: @jalehman
Summary
Fixes #67061.
When dreaming re-ingests the same daily memory file across multiple days,
dailyCountstays stuck at1becausedayBucketwas set tobatch.day(the file date) instead of the current ingestion date. SincededupeByQueryPerDaychecks whethertodayBucketalready appears inrecallDays, using the file date causes every subsequent sweep to hit the dedupe guard — the file date was already recorded on the first ingestion.This keeps
signalCount(recallCount + dailyCount + groundedCount) below the defaultminRecallCount=3promotion gate, so zero entries ever reach the scoring stage, and the phase reinforcement from #64068 can never take effect.Root cause
In
dreaming-phases.ts, all three ingestion functions pass the file date asdayBucket:The dedupe logic in
recordShortTermRecallsthen checks:Since both
queryHashandtodayBucket(derived fromdayBucket) are identical across sweeps,dedupeSignalis alwaystrueafter the first ingestion, preventingdailyCountfrom incrementing.Fix
Change
dayBucketfrom the file date to the ingestion date (viaformatMemoryDreamingDay(params.nowMs, params.timezone)) in all three call sites:ingestSessionTranscriptSignalsingestDailyMemorySignalsseedHistoricalDailyMemorySignalsThe
querystring still uses the file date for identification; only the dedupe bucket changes to reflect when the sweep actually ran.formatMemoryDreamingDaywas already imported andparams.nowMs/params.timezonewere already available at all three sites.Test
Added a regression test that:
dailyCountincrements to2(was stuck at1before this fix)All 22 tests in
dreaming-phases.test.tspass.