Repository navigation
Conversation
|
Codex review: needs maintainer review before merge. What this changesThis PR uses monotonic time for background session-index deadlines and the coordinated full-rebuild retry cooldown. Example: Continuous transcript activity reaches 280 seconds, then Date advances by 120 seconds before another append.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR fixes a current clock-sensitive scheduling bug with a focused change; no actionable defects remain, and exact-head CI is still pending. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherMemory Core receives transcript and agent-activity notifications, queues pending sessions, and publishes searchable index rows after quiet periods or bounded deferral. flowchart LR
A[Transcript updates] --> C[Session queue]
B[Agent activity] --> C
C --> D[Monotonic deadline timer]
E[Rebuild retry cooldown] --> D
D --> F[Memory index publication]
F --> G[Memory search]
Technical reviewBest possible solution: Keep the existing scheduling owners and consistently measure their coordinated process-local deadlines with performance.now(). Do we have a high-confidence way to reproduce the issue? The supplied built-Gateway baseline reproduces early FTS publication twice after a wall-clock step and subsequent append; current-main source retains the responsible arithmetic. Is this the best way to solve the issue? This is the smallest complete fix: change the clock at existing deadline producers and consumers, retain scheduling policy, and update affected clock-controlled fixtures. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 0ba9fcf70ea1. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource 0, Tests 0. Total 0 across 9 files. Added test files: 0. View PR surface stats
LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (5 earlier review cycles)
Reviewed October 28, 2026, 11:10 PM ET / October 29, 2026, 03:10 UTC (Revision 6). |
605b120 to
1e3fcd9
Compare
|
🦞👀 Re-review progress:
|
|
🦞👀 Re-review progress:
|
scheduleSessionIndexPass computed its setTimeout deadline and all of its seed timestamps (sessionPendingSince, sessionLastActivity, sessionRetryAt) from the wall-clock Date.now(). A wall-clock jump (NTP correction, manual clock change) could collapse the remaining quiet-period delay to ~0 and fire an index pass immediately, or stretch it arbitrarily. Convert every deadline seed and remaining-time computation to the monotonic performance.now(), including the cross-domain full-reindex retry backoff that was Math.max'd against the retry deadline in the same clock domain. Add a regression test that jumps the wall clock forward after seeding and asserts the rescheduled delay is not collapsed.
1e3fcd9 to
0f1f037
Compare
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review. |
|
🦞👀 Re-review progress:
|
Built Gateway session-memory publication proofCandidate: Real entry point and discrimination
The preload controls Date.now/performance.now and dispatches only timers armed by the real scheduler. It never calls scheduler methods, mocks the memory manager, substitutes transcript events, changes production code, changes the host/container system clock, or supplies a model/provider key. Keyword-only memory is configured with the supported
Both stepped main runs publish 20 seconds early after recomputation. Both candidate runs remain unpublished through 299,999 ms and publish at the original 300-second monotonic deadline. Both no-step controls publish at 300 seconds. The final Gateway search returns the marker in all six runs, and FTS rows identify the real session source. Regression and focused checks
The original contributor commit is preserved. Extension-owned code uses performance.now() directly at the three existing owners, with no local clock helper or new SDK export. |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Landed in 4843f39. Thanks @SunnyShu0925. Memory session indexing now keeps its deadline when the wall clock jumps. |
…nclaw#186829) fix(memory-core): keep the session-index deadline on the monotonic clock The memory session-index pass recomputed its pending publication deadline with Date.now, so a forward wall-clock step made the index publish early (or a backward step delayed it). The three memory-core deadline sites now use performance.now(), as the other extension budgets do since openclaw#186484. Evidence: built Gateway with real transcript appends and SQLite FTS publication. At 280 s on the monotonic clock, Date.now was stepped forward 120 s inside the process only, followed by another real append. Main rearmed for 0 ms and published at once (twice); with this change it rearmed for 20,000 ms, was still unpublished at 299,999 ms and published at 300 s (twice). No-step controls published at 300 s on both refs, and memory search found the marker in every run. Details: openclaw#186829 (comment). Thanks @SunnyShu0925. Co-authored-by: Ayaan Zaidi <[email protected]>
…igration (#187345) test(memory): advance the monotonic clock in the cold transcript recovery test #186829 (4843f39) moved the Memory Core failed-rebuild cooldown to performance.now(), but the canonical SQLite transcript recovery test in packages/memory-host-sdk still advanced only Date.now(). Its automatic retry stayed inside the cooldown, and the test failed on main with TRANSCRIPT_COLD. The test now advances performance.now() through the cooldown. Assertions and production code are unchanged. Fixes #187330. Evidence: in Docker on Node 24.22.1, the full canonical SDK test file failed 3 of 3 runs on main b3ee406 and passed 3 of 3 with this change. The other memory-host-sdk and memory-core clock tests (session-delta, reindex-resume) pass unchanged 3 times on each ref. Details: #187345 (comment). Co-authored-by: Ayaan Zaidi <[email protected]>
test(memory): advance the monotonic clock in the remaining Memory Core cooldown fixtures #186829 moved the Memory Core failed-rebuild cooldown to performance.now(), and #187345 fixed one stale fixture, but others still advanced only Date.now(). The detached-rebuild notice test in extensions/memory-core/src/tools.index-upgrade.test.ts kept its retry inside the cooldown and failed, missing its "provider cost" warning. This fixes that test and the session-delta, reindex-resume and startup-close timer fixtures found in a full sweep of memory-core, memory-host-sdk and the callers of the three changed sites. Production code is unchanged. Fixes #187396. Evidence: all four touched test files run three times per ref in Docker on Node 24.22.1. Main gave 25 passes and 1 failure each run (the missing warning at line 197); with this change, 26 passes each run. The intentional wall-clock users are listed in #187454 (comment). Thanks @ruel225. Co-authored-by: Ayaan Zaidi <[email protected]>
) test(memory): advance the monotonic clock in the remaining Memory Core cooldown fixtures openclaw#186829 moved the Memory Core failed-rebuild cooldown to performance.now(), and openclaw#187345 fixed one stale fixture, but others still advanced only Date.now(). The detached-rebuild notice test in extensions/memory-core/src/tools.index-upgrade.test.ts kept its retry inside the cooldown and failed, missing its "provider cost" warning. This fixes that test and the session-delta, reindex-resume and startup-close timer fixtures found in a full sweep of memory-core, memory-host-sdk and the callers of the three changed sites. Production code is unchanged. Fixes openclaw#187396. Evidence: all four touched test files run three times per ref in Docker on Node 24.22.1. Main gave 25 passes and 1 failure each run (the missing warning at line 197); with this change, 26 passes each run. The intentional wall-clock users are listed in openclaw#187454 (comment). Thanks @ruel225. Co-authored-by: Ayaan Zaidi <[email protected]> Upstream-Commit: 933304e
…igration (openclaw#187345) test(memory): advance the monotonic clock in the cold transcript recovery test openclaw#186829 (0c66eb4) moved the Memory Core failed-rebuild cooldown to performance.now(), but the canonical SQLite transcript recovery test in packages/memory-host-sdk still advanced only Date.now(). Its automatic retry stayed inside the cooldown, and the test failed on main with TRANSCRIPT_COLD. The test now advances performance.now() through the cooldown. Assertions and production code are unchanged. Fixes openclaw#187330. Evidence: in Docker on Node 24.22.1, the full canonical SDK test file failed 3 of 3 runs on main 7c862ae and passed 3 of 3 with this change. The other memory-host-sdk and memory-core clock tests (session-delta, reindex-resume) pass unchanged 3 times on each ref. Details: openclaw#187345 (comment). Co-authored-by: Ayaan Zaidi <[email protected]>
) test(memory): advance the monotonic clock in the remaining Memory Core cooldown fixtures openclaw#186829 moved the Memory Core failed-rebuild cooldown to performance.now(), and openclaw#187345 fixed one stale fixture, but others still advanced only Date.now(). The detached-rebuild notice test in extensions/memory-core/src/tools.index-upgrade.test.ts kept its retry inside the cooldown and failed, missing its "provider cost" warning. This fixes that test and the session-delta, reindex-resume and startup-close timer fixtures found in a full sweep of memory-core, memory-host-sdk and the callers of the three changed sites. Production code is unchanged. Fixes openclaw#187396. Evidence: all four touched test files run three times per ref in Docker on Node 24.22.1. Main gave 25 passes and 1 failure each run (the missing warning at line 197); with this change, 26 passes each run. The intentional wall-clock users are listed in openclaw#187454 (comment). Thanks @ruel225. Co-authored-by: Ayaan Zaidi <[email protected]>
What Problem This Solves
The session-memory index scheduler stores pending, last-activity, and retry deadlines using wall-clock timestamps. If the clock steps forward while transcripts keep changing, a later notification recomputes the original five-minute deadline as already expired and publishes the index early. Clock rollback can instead stretch the delay. The full-reindex retry cooldown shares the same clock domain with the session retry owner.
Use
performance.now()consistently for these process-local deadline seeds and comparisons at the three existing memory-core owners. No local clock helper, SDK expansion, persisted timestamp rewrite, new option, or dependency. The original commit by SunnyShu0925 is preserved.User Impact
Background session indexing still waits for the quiet period or original five-minute cap, regardless of wall-clock correction. Retry cooldowns measure elapsed time rather than clock adjustments. FTS publication, stored transcript timestamps, search results and normal no-step scheduling retain their contracts.
Evidence
Built Gateway six-run before/after FTS proof and focused regression results.
f996c1c487a0fcb456a73c9af49e360b99d14de5, twice; candidate58271c77ac0cfde109175caf9c7311ea189a91cc, twice; one no-step control per revision./tools/invokestarts the shippedmemory_searchtool's retained manager. Actual session creation and transcript injection trigger the normal notification/indexing path. The probe does not call scheduler methods or substitute a memory manager.memory_index_chunks_fts MATCHrows at 280 s. Candidate recomputes 20,000 ms, remains unpublished at 299,999 ms, and publishes at the original 300 s deadline. Both repetitions agree. Both no-step controls publish at 300 s. Final Gateway search retrieves the indexed marker in every run.session-delta. Candidate: 90 passed across six touched suites. Targeted formatting/lint: clean, zero warnings/errors.Simplification
Merged duplicate quiet/coalescing and maximum-deferral setup into one parameterized regression, and wired the existing FTS fixture's Date/performance clock pair once in
beforeEach. Other Date-controlled fixtures now also control performance. Merge-base delta: production +10/−10 (20 changed lines); tests +34/−34 (net zero).Merge danger
Two-way door: reverting restores the prior deadline arithmetic without a migration. All monotonic readings remain process-local; no persisted epoch changes. Blast radius is memory-core background session scheduling and its coordinated full-reindex retry cooldown.