Skip to content

test(memory): align rebuild notice with monotonic clock - #187454

Merged
obviyus merged 3 commits into
openclaw:mainfrom
ruel225:fix/memory-rebuild-notice-clock-187396
Oct 29, 2026
Merged

obviyus merged 3 commits into
openclaw:mainfrom
ruel225:fix/memory-rebuild-notice-clock-187396

Conversation

@ruel225

@ruel225 ruel225 commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #187396. Regression from #186829.

What Problem This Solves

The detached full-rebuild warning test advances the wall clock while the failed-rebuild cooldown uses monotonic time, so scheduled validation misses the expected provider-cost warning.

User Impact

No user-visible or production behavior change. Restores meaningful test coverage of detached automatic rebuild disclosure and aligns remaining session-scheduler fixtures with the clock they exercise. No assertions, timeouts, schemas, dependencies, or public contracts change.

Why This Change Was Made

Keep @ruel225's minimal monotonic-clock repair and finish the requested sweep across all of memory-core, memory-host-sdk and direct references to the three owners changed in #186829. Thanks @shannon0430 for reporting.

The detached retry fixture now advances performance.now(). The session-delta, background reindex-resume and startup-close fixtures also fake performance when advancing their session scheduler timers. Other Date-only fixtures intentionally exercise calendar timestamps, Date-based provider recovery/cache or worker crash windows; those owners were not migrated by #186829. Existing cooldown/recovery fixtures already control performance.

Evidence

Secretless Docker, Node 24.22.1, root Vitest project matrix, complete files (not name filters):

  • Main snapshot, three runs: four files collected, 25 passed / 1 failed each time. Only the detached-maintenance case fails at line 197, missing the provider cost warning.
  • Candidate, three runs: all four files passed, 26 tests passed each time.
  • Targeted oxfmt and oxlint: passed on all four files.

Detailed repeated-run capture and full sweep classification: #187454 (comment)

The suite exercises the actual memory manager, SQLite publication and provider admission boundaries. This is a test-only repair: a shipped Gateway cannot discriminate a change to the Vitest clock fixture.

Simplification retained only clock-selection edits and every existing assertion. Production delta: 0. Test delta: +7/-7, net 0 lines across four files.

Merge danger: two-way door; a revert fully undoes this test-only repair. Blast radius is the four memory regression fixtures; production behavior and persisted state are unchanged.

@clawsweeper

clawsweeper Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review in progress

ClawSweeper is reviewing this revision. This supersedes any previous blocked status.

View the workflow run.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 29, 2026
@obviyus

obviyus commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@obviyus

obviyus commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator

Exact candidate: 2b29caaebaefc9391b92d0600b6d70c9dc83a558 (contributor repair retained, remaining scheduler fixtures corrected).

Secretless Docker, Node 24.22.1:

pnpm exec vitest run --config vitest.config.ts \
 extensions/memory-core/src/tools.index-upgrade.test.ts \
 extensions/memory-core/src/memory/manager-session-delta.test.ts \
 extensions/memory-core/src/memory/manager-reindex-resume.test.ts \
 extensions/memory-core/src/memory/manager-startup-close.test.ts

main run 1: 4 files collected; 25 passed, 1 failed
main run 2: 4 files collected; 25 passed, 1 failed
main run 3: 4 files collected; 25 passed, 1 failed
candidate run 1: 4 files passed; 26 tests passed
candidate run 2: 4 files passed; 26 tests passed
candidate run 3: 4 files passed; 26 tests passed

Baseline failure, all three runs:
 tools.index-upgrade.test.ts:197
 discloses a full retry handed to detached maintenance before embedding finishes
 expected concurrentResult.details to have warning containing 'provider cost'

oxfmt --check: passed, all four files
oxlint: passed, 0 warnings/errors, all four files
Production delta 0; test delta +7/-7 (net 0).

Sweep covered ALL of extensions/memory-core and packages/memory-host-sdk, including Date spies, setSystemTime, explicit/default fake timers and timer advances. Also traced direct owner imports, inheritance, recordFullReindexFailure, fullReindexRetryBackoff and session deadline fields across the checkout (no direct owner/field references in src/, packages/ or test/).

Remaining wall-clock controls are intentional:

  • Provider fallback recovery and probe-cache TTL still use Date in their own production owner; worker crash windows still use Date in local-file-watcher.ts.
  • Memory-delta mtimes, offthread recency, dreaming, promotion, flush planning and recall tracking test calendar/persisted timestamps, not the three migrated deadlines.
  • Read-file, filesystem watchers, KNN subprocess and standing-intents timeout fixtures exercise separate timer owners.
  • Default fake timers already control performance. Deliberate wall-clock-jump tests remain independent of monotonic time.
  • Existing search-reindex-backoff, session-update-race, FTS reindex, reindex-recovery, scheduling, startup-catchup and canonical SDK recovery fixtures already control performance.

Only the four fixtures in this PR required clock-selection changes. No production changes or assertion weakening; this test-only defect is reproduced by running the complete registered test files, not a shipped Gateway.

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 29, 2026
@clawsweeper

clawsweeper Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

Updates memory regression fixtures to advance the monotonic clock used by rebuild cooldowns and session scheduling.

Example: The detached-rebuild test advances its retry clock by 30,000 milliseconds.

  • Before: Advancing Date.now leaves the monotonic cooldown active, so the concurrent provider-cost warning assertion fails.
  • After: Advancing performance.now expires the cooldown and lets the unchanged assertion exercise detached rebuild admission.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Repeated, maintainer-accepted red/green integration evidence adequately proves this minimal test-only repair; the absence of a discriminating Gateway scenario warrants no further proof request or C-tier cap.
Proof confidence 🐚 platinum hermit (4/6) Sufficient (terminal): Collaborator obviyus explicitly accepts the exact-head complete-file Docker evidence for this test-only repair: the real memory manager and SQLite paths produce the same warning failure in three baseline runs and pass all 26 tests in three candidate runs; a shipped Gateway cannot discriminate these Vitest fixture changes.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Test only · Worth it: Yes · Fix scope: Complete
User problem: Memory regression validation fails to exercise detached rebuild disclosure because the fixture advances the wrong clock.
Reason: The repair restores existing validation contracts, and the collaborator has explicitly accepted its direction and test-only proof.

Regression provenance

Regression provenance — verified: source commit 4843f39db21b by SunnyShu; canonical PR #186829 (blame-to-merge-commit).

Merge readiness

✅ Ready for maintainer review

This PR is a minimal, correct test-fixture repair with accepted exact-head red/green evidence, successful CI, and no actionable findings.

Priority: P2
Reviewed head: 2b29caaebaefc9391b92d0600b6d70c9dc83a558

Before merge

None.

Findings

None.

Agent review details

How this fits together

Memory Core tests send synthetic transcripts and search requests through the memory manager, then inspect SQLite publication, rebuild disclosure, resumption, and shutdown results.

flowchart LR
 A[Test clock controls] --> B[Monotonic deadlines]
 C[Synthetic transcripts and searches] --> D[Memory manager]
 B --> D
 D --> E[SQLite index publication]
 D --> F[Warnings and lifecycle results]
 E --> G[Existing assertions]
 F --> G
Loading

Technical review

Best possible solution:

Merge the scoped clock-selection repair while preserving the production deadlines and all existing regression assertions.

Do we have a high-confidence way to reproduce the issue?

The supplied repeated complete-file runs reproduce the warning failure on main and pass on the exact head; inspected clock producers, comparisons, and fixture changes explain the result, and this read-only review ran no tests.

Is this the best way to solve the issue?

This is the smallest complete repair: control the clocks the existing owners use, retain every assertion, and introduce no production machinery or persisted changes.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against d34d855440a7.

Provenance checked

  • Detached full-rebuild disclosure fixture keeps the original intent (eecaa9d: Advance the fixture through the automatic full-rebuild cooldown while preserving concurrent disclosure and embedding assertions.)
  • Session-delta scheduling fixtures keeps the original intent (8e02d1a: Exercise quiet-period batching, foreground yielding, and incremental publication through the memory manager.)
  • Background reindex resumption fixture keeps the original intent (6387f3a: Verify interrupted SQLite rebuilds retain completed work and resume through supported lifecycle paths.)
  • Startup-close fixture keeps the original intent (4994048: Consolidate fixtures while preserving distinct lifecycle, error, and ordering coverage.)
  • Monotonic deadline contract keeps the original intent (4843f39: Measure process-local scheduling and retry delays independently of wall-clock adjustments.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 8e02d1a adds extensions/memory-core/src/memory/manager-session-delta.test.ts:37 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 8e02d1ae9694; files: extensions/memory-core/src/memory/manager-session-delta.test.ts)
  • SunnyShu: Raw commit 4843f39 adds extensions/memory-core/src/memory/manager-sync-ops.ts:318 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 4843f39db21b; files: extensions/memory-core/src/memory/manager-sync-ops.ts)

PR surface

Tests 0. Total 0 across 4 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 4 7 7 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 7 7 0

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #187396
Summary: This PR supplies the focused fixture repair tracked by the open issue.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.

Label justifications:

  • P2: The clock mismatch breaks memory regression validation without a demonstrated production behavior failure.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (2 earlier review cycles)
  • reviewed 2026-10-29T07:45:13.452Z sha 2b29caa :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-29T07:51:39.274Z sha 2b29caa :: needs maintainer review before merge. :: none

Reviewed October 29, 2026, 4:07 AM ET / 08:07 UTC (Revision 3).

@obviyus

obviyus commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator

Maintainer note on proof: this is a test-only fix for fixtures that our #186829 left advancing Date.now() after the cooldown moved to performance.now(). No production code changes, so no shipped entry point can show a difference. I accept the exact-head complete-file Docker proof as the right evidence here: on main the touched files give 25 passes and 1 failure in each of 3 runs, and with this change 26 passes in each of 3 runs. The full clock sweep of memory-core, memory-host-sdk and callers found no other stale fixtures.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 29, 2026
@obviyus

obviyus commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator

The maintainer proof acceptance now clears all proof requests, and this review identifies no findings. Please reconcile the remaining 3/6 cap with the exact same test-only clock-repair precedent in #187345: #187345 (comment) rated complete-file Docker red/green proof 4/6 explicitly because no Gateway demonstration can discriminate test-only changes. Here all four full files ran three times per ref, production delta is zero, the maintainer override is explicit, and exact-head ci-gate is green. This requests consistent evaluation of the evidence, not weakened assertions or additional production scope.

@obviyus

obviyus commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 29, 2026
@obviyus
obviyus merged commit 933304e into openclaw:main Oct 29, 2026
147 checks passed
@obviyus

obviyus commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator

Landed in 933304e. Thanks @ruel225 for fixing the Memory Core test fixtures our #186829 merge left on the wrong clock.

shannon0430 pushed a commit to shannon0430/openclaw that referenced this pull request Oct 29, 2026
)

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
wyf027 added a commit to wyf027/openclaw that referenced this pull request Oct 29, 2026
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 30, 2026
)

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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extensions: memory-core Extension: memory-core P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XS status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: detached memory rebuild notice test advances the wrong retry clock

2 participants