fix(plugin): paginate dirty-closed reward recovery#2120
Conversation
🤖 Open Code ReviewTarget: PR #2120 🔍 OpenCodeReview found 3 issue(s) in this PR. 1.
|
|
Follow-up commit 26aa9f24 now imports and uses the storage-layer I also verified the other two automated findings against the call flow: the cursor advances one bounded page per startup/periodic scan and is intentionally cleared only after a complete pass; the page size is exactly the repository's enforced 500-row cap. Validation: |
✅ Automated Test Results: PASSEDAll tests passed (44/44 executed). memos_local_plugin/unit: 44/44. Duration: 11s [advisory, non-gating] AI-generated tests on branch test/auto-gen-8c86a9867e66394a-20260718224733: 60/60 passed — these do NOT affect the PR verdict; review the branch manually. Branch: |
✅ Automated Test Results: PASSEDAll tests passed (44/44 executed). memos_local_plugin/unit: 44/44. Duration: 11s Branch: |
Description
Resubmits only the paginated dirty-closed recovery portion of #1784 against current
main.episodes.list({ status: "closed", limit: 500 })is hard-capped at 500 rows, so closed episodes beyond the newest 500 never reach the startup or periodic dirty-reward scan. This change adds a stable(started_at, id)keyset page, processes one 500-row page per scan, and persists the page cursor in the existingkvstore so restarts continue toward older episodes rather than repeatedly rescanning the newest page.No dependency or schema changes are required.
Related Issue: #1782
Type of change
How Has This Been Tested?
npx vitest run tests/unit/pipeline/memory-core.test.ts -t 'continues a bounded dirty-closed scan past 500 rows across restart'Additional checks:
npm run lintnpx vitest run tests/unit/pipeline/memory-core.test.ts(34 passed)make format(Ruff checks passed; 601 files unchanged)npm run test:unitcurrently has two unrelated baseline failures outside this diff: the startup-recovery source-shape assertion expects a removedscheduleStartupRecovery(...)helper, and the namespace-visibility migrator fixture insertstraces.role, which is absent from the current schema.Checklist
Reviewer Checklist