feat: schedule memory evolution in a daily processing window - #2344
feat: schedule memory evolution in a daily processing window#2344lapaca wants to merge 4 commits into
Conversation
Add configurable time window to defer heavy evolution work outside idle
hours. Episodes that close outside the window are queued in KV and
replayed when the window opens.
- Add time-window utilities with timezone support
- Add deep-window queue with bounded capacity and deduplication
- Wire deferHook into capture subscriber
- Add drain logic with periodic timer
- Gate orphan recovery and dirty-reward rescan
- Add config validation for window spec and timezone
- Add 38 tests covering all components
Config:
algorithm:
deepProcessing:
mode: "window" # or "always" for legacy behavior
window: "02:00-06:00" # HH:MM-HH:MM, supports overnight wrap
timezone: "UTC" # IANA zone or empty for system default
drainIntervalSec: 600
maxBatchPerCycle: 10
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
🤖 Open Code ReviewTarget: PR #2344 🔍 OpenCodeReview found 21 issue(s) in this PR. 1.
|
✅ Automated Test Results: PASSEDAll tests passed (149/149 executed). memos_local_plugin/unit: 149/149. Duration: 14s [advisory, non-gating] AI-generated tests on branch test/auto-gen-ae60b1d30a4886e4-20260905175620: 115/120 passed, 5 failed — these do NOT affect the PR verdict; review the branch manually. Branch: |
✅ Automated Test Results: PASSEDAll tests passed (161/161 executed). memos_local_plugin/unit: 161/161. Duration: 15s [advisory, non-gating] AI-generated tests on branch test/auto-gen-4c30c812ab9019f9-20260905191659: 0/62 passed, 62 failed — these do NOT affect the PR verdict; review the branch manually. Branch: |
Preserve abandoned close reasons and newer deferred work, acknowledge completed chains across the window boundary, recheck stale startup selections, and stop recovery database access after shutdown. Add six regression cases; 316 related tests, TypeScript checks, build, and applicable pre-commit hooks pass.
✅ Automated Test Results: PASSEDAll tests passed (167/167 executed). memos_local_plugin/unit: 167/167. Duration: 16s Branch: |
✅ Automated Test Results: PASSEDAll tests passed (175/175 executed). memos_local_plugin/unit: 175/175. Duration: 15s [advisory, non-gating] AI-generated tests on branch test/auto-gen-9ebf8dd41627e889-20260906142232: 63/70 passed, 6 failed — these do NOT affect the PR verdict; review the branch manually. Branch: |
Description
Fixes #2333.
Add an opt-in daily idle window for memory evolution in memos-local-plugin. With
algorithm.deepProcessing.mode: window, daytime episode closures persist their pending work while lightweight capture remains available. Reflection, automatic reward, L2, L3, and skill requests wait for the configured window;mode: alwayspreserves immediate processing.always.No new project dependencies, API routes, or database schema changes.
Type of change
How Has This Been Tested?
Run from
apps/memos-local-pluginon Windows with Node 24:Regression coverage includes semaphore admission at window boundaries, cancellation, foreground permit availability, feedback before reflection, lost queues, concurrent recovery, completed queue cleanup, nonblocking close requests, and restoring
alwaysmode. Six recovery regressions for abandoned closures (queue present/lost), overlapping closures, stale startup selections, window-end completion, and post-shutdown database access were observed failing before their fixes.A broader baseline run including
tests/unit/configexposed five existing Windows path assertion failures inconfig/paths.test.tsandconfig/load.test.ts. The failing assertions and the path implementation are unchanged frommain; that broader suite is not fully green on this machine.Root
make formatwas unavailable because GNU make is not installed. The plugin's TypeScript checks, build,git diff --check, and applicable repository pre-commit checks passed. No Python source was changed.Checklist
Reviewer Checklist