Repository navigation
test(memory): own the fenced late manager's successor provider - #168300
Conversation
The reload owner test acquires a default-purpose manager for agent "late" while the reload fence is active and leaves it cached and live. Its file watcher emits a reconcile invalidation on start, and after the 1.5s watch debounce the background sync (now owned by the plugin lifecycle since eaf60b0) resumes on the successor adapter and creates a second successor provider, which closeAll correctly closes. Under CPU load that debounce lands between commit and closeAll, so successorClose counted 2. Acquire the late manager's successor provider explicitly after commit and expect one successor close per live replacement-era manager.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesThe test explicitly initializes the fenced late manager’s successor provider and expects cleanup once per live replacement-era manager. Review scores
ProductKind: Test only · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this maintainer-authored PR makes a useful, focused correction to a timing-dependent test expectation. No introduced correctness or security defect was found. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe plugin reload test exercises Memory Core manager acquisition, embedding-provider replacement, and final cleanup through the real lifecycle owners with synthetic providers. flowchart TD
A[Reload ownership test] --> B[Memory runtime]
B --> C[Manager registry]
C --> D[Main and late managers]
D --> E[Successor providers]
C --> F[Final cleanup]
F --> E
Technical reviewBest possible solution: Retain the explicit post-commit probe and exact per-manager cleanup expectations. Do we have a high-confidence way to reproduce the issue? Current source supports the race: a cached late manager can initialize its own provider after reload resumes; the author reports deterministic reproduction, but this read-only review ran no tests. Is this the best way to solve the issue? The change fixes the fixture’s incomplete setup while preserving exact cleanup assertions, the legacy single-provider case, and the null-provider case. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against dbe7b43beb09. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
PR surfaceTests +13. Total +13 across 1 file. 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 Reviewed October 10, 2026, 3:11 AM ET / 07:11 UTC. |
…law#168300) The reload owner test acquires a default-purpose manager for agent "late" while the reload fence is active and leaves it cached and live. Its file watcher emits a reconcile invalidation on start, and after the 1.5s watch debounce the background sync (now owned by the plugin lifecycle since eaf60b0) resumes on the successor adapter and creates a second successor provider, which closeAll correctly closes. Under CPU load that debounce lands between commit and closeAll, so successorClose counted 2. Acquire the late manager's successor provider explicitly after commit and expect one successor close per live replacement-era manager.
What Problem This Solves
Fixes:
src/plugins/memory-runtime.owners.test.tsintermittently fails withexpected "vi.fn()" to be called 1 times, but got 2 timesonsuccessorCloseunder CI load. Seen on the 2026.10.1 stable release validation in plugin prerelease job 114117019527.User Impact
No user-visible change. Removes a timing-dependent failure from the plugin prerelease and node test lanes; production memory runtime code is unchanged.
Why This Change Was Made
The reload-owner test acquires a default-purpose manager for agent
latewhile the reload fence is up, then leaves it cached and live.extensions/memory-core/src/memory/manager-watch-ops.ts), the background sync runs. It has been owned by the plugin lifecycle since eaf60b0, so it resumes on the successor adapter and creates a second successor provider (manager-provider-lifecycle.ts).closeAllthen correctly closes both.reload.commit()andcloseAll, the count is 2.Production is correct: one provider per live manager, each closed exactly once. The test now probes the late manager explicitly after commit, so it deterministically owns its successor provider. It also expects one successor close per live replacement-era manager. No sleeps, retries or loosened matchers.
Evidence
late.=== 1assertions kept, 8 of 17 modes fail every time with the CI error.node scripts/run-vitest.mjs src/plugins/memory-runtime.owners.test.tspassed 30/30 with load average 40–50.oxfmtand scopedoxlintare clean.late-probeandmemory-background-reload.test.tsfailures. Inlate-probemode the successorcreatereturns null, so this race cannot cause them; they need their own investigation.