fix(doctor): match timestamp-suffixed daily memory files in isShortTermMemoryPath (fixes #90896)#90907
Conversation
…rmMemoryPath regex The regex only matched memory/YYYY-MM-DD.md, skipping files with timestamp suffixes like memory/YYYY-MM-DD-HHMM.md. This caused promotedToday, shortTermCount, and promotedTotal to show incorrect values in the WebUI Dreams tab. Update the regex to also match -HHMM timestamp suffixes, fixing underreporting of dreaming recall store entries. Fixes openclaw#90896
|
Thanks for the context here. I did a careful shell check against current Current main now has the same-or-better fix by routing So I’m closing this as already implemented rather than keeping a duplicate issue open. Review detailsBest possible solution: Keep the current main implementation that uses memory-core as the single source of truth for short-term path filtering, and only reopen with a fresh narrow report if live Dreams status still undercounts after that refactor ships. Do we have a high-confidence way to reproduce the issue? No current-main failure path is visible from source inspection: the old base had a gateway-local matcher mismatch, but current main delegates stats to memory-core’s suffix-aware matcher. I did not run tests because this was a read-only review. Is this the best way to solve the issue? Yes for current main: delegating to memory-core is the better fix because it removes the duplicate gateway path contract instead of widening one stale regex. The PR’s original patch was plausible on its base, but it is now obsolete. Security review: Security review cleared: The diff only changes TypeScript doctor logic and tests, with no dependency, workflow, secret, or supply-chain surface change. AGENTS.md: found and applied where relevant. What I checked:
Likely related people:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 66b91d78feb3; fix evidence: commit 9fb8d87f91f8, main fix timestamp 2026-06-07T10:26:59+02:00. |
…in isShortTermMemoryPath Align the gateway doctor predicate with the memory-core short-term path contract. The regex now matches any slug suffix (not just -HHMM numeric), handling llmSlug output like memory/YYYY-MM-DD-vendor-pitch.md. Add a focused regression test proving doctor.memory.status counts both timestamp-suffixed (-HHMM) and slugged (-vendor-pitch) recall-store entries. Fixes openclaw#90896
|
@clawsweeper re-review Addressed all review findings:
|
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
The core-support-boundary CI failure is pre-existing and unrelated to this PR — the changed files are under src/ not extensions/. The lint:plugins:no-extension-test-core-imports check passes locally with these changes. CI re-run requested. |
|
@clawsweeper re-run |
|
🦞👀 Command router queued. I will update this comment with the next step. Re-review progress:
|
|
@clawsweeper re-run |
|
🦞👀 Command router queued. I will update this comment with the next step. Re-review progress:
|
|
ClawSweeper applied the proposed close for this PR.
|
Summary
Aligns
isShortTermMemoryPath()in the gateway doctor predicate with the memory-core short-term path contract. The regex now matches any slug suffix (-HHMMtimestamps and-vendor-pitchdescriptive slugs), fixing underreported dreaming stats. 2 files, +200/-1 lines.Root Cause
The
isShortTermMemoryPath()function insrc/gateway/server-methods/doctor.tsused a strict regex at line 353 that only matchedmemory/YYYY-MM-DD.md. The memory-core short-term path contract atextensions/memory-core/src/short-term-promotion.ts:27already accepts(?:-[^/]+)?(any non-slash suffix), covering both numeric timestamp suffixes (-HHMM) andllmSlugdescriptive names (-vendor-pitch). The gateway predicate was out of sync with this contract, so entries with any suffix were filtered before the dreaming stats counters ran.isShortTermMemoryPath()should match the same path shapes that memory-core accepts as valid short-term memory filesdoctor.memory.status→ iterate recall store entries →isShortTermMemoryPath()filter (line 524) → entries with timestamp or slug suffixes are discarded →promotedToday,shortTermCount,promotedTotalunderreportedSHORT_TERM_PATH_RE(short-term-promotion.ts:27):/(?:^|\/)memory\/(?:[^/]+\/)*(\d{4})-(\d{2})-(\d{2})(?:-[^/]+)?\.md$/uses(?:-[^/]+)?. Also:session-corpusregex at doctor.ts:357 already handles multiple extensions (md|txt), and session-memory HOOK.md documentsllmSlugoutput asYYYY-MM-DD-vendor-pitch.md.Verification
pnpm buildpasses cleanlyReal behavior proof
Behavior or issue addressed:
isShortTermMemoryPath()regex did not match daily memory files with any slug suffix (-HHMMtimestamp or-vendor-pitchdescriptive slug); now it does, matching the memory-core short-term path contract.Real environment tested: Linux x86_64, Node v22.22.0, OpenClaw main @ f4a5e57, pnpm 11.2.2
Exact steps or command run after this patch:
pnpm test src/gateway/server-methods/doctor.test.tsThis runs the full
doctor.memory.statusgateway handler (not a copied regex snippet) against a populated recall store containing both timestamp-suffixed (memory/YYYY-MM-DD-HHMM.md) and slugged (memory/YYYY-MM-DD-vendor-pitch.md) entries with phase signals, and asserts the exact dreaming stat counts returned by the handler.Evidence after fix:
The new regression test (
counts timestamp-suffixed and slugged recall-store entries in dreaming stats) specifically validates:memory/2026-06-04-1503.md(timestamp suffix) → counted as promoted entry, promotedToday=1 ✅memory/2026-06-03-vendor-pitch.md(llmSlug suffix) → counted as promoted entry, promotedTotal=2 ✅memory/2026-06-05-0930.md(timestamp suffix) → counted as short-term entry with correct signal counts ✅Source: src/gateway/server-methods/doctor.ts:353 — regex changed from
(?:-\d{4})?to(?:-[^/]+)?to match any slug suffix.Observed result after fix: All 62 tests pass including the new regression test. The
doctor.memory.statusgateway handler (not a copied regex snippet) correctly counts both timestamp-suffixed and slugged recall-store entries. No regressions — plainYYYY-MM-DD.mdpaths continue to match.What was not tested: End-to-end WebUI Dreams tab rendering with a live gateway and real recall store containing timestamp-suffixed/slugged entries.
Review Findings Addressed
(?:-\d{4})?to(?:-[^/]+)?to accept any slug suffix, aligning with memory-core'sSHORT_TERM_PATH_REatextensions/memory-core/src/short-term-promotion.ts:27.counts timestamp-suffixed and slugged recall-store entries in dreaming statsinsrc/gateway/server-methods/doctor.test.tsprovesdoctor.memory.statuscounts both-HHMMand-vendor-pitchentries.doctor.memory.statushandler (not copied regex) processing a real recall store with timestamp and slugged entries.Regression Test Plan
pnpm test src/gateway/server-methods/doctor.test.tsThe new
counts timestamp-suffixed and slugged recall-store entries in dreaming statstest creates a populated recall store with both-HHMMtimestamp and-vendor-pitchslugged paths and asserts exact dreaming stat counts through the fulldoctor.memory.statusgateway handler.Merge Risk
Low. The change aligns the gateway doctor predicate with the existing memory-core short-term path contract (
(?:-[^/]+)?instead of(?:-\d{4})?). The memory-core module already creates and accepts entries with these path shapes — the doctor just couldn't count them. All previously matching paths continue to match. No API surface changes.