Repository navigation
refactor(memory): move Forget planning reads off the caller thread - #162045
Conversation
Use the existing memory retrieval pool for noncreating index selection, counts, and vector inspection. Capture caller placement and matching facts before dispatch, share the existing scrub rules, and return only selected row identities and counts. Keep final lineage checks and write settlement with their existing transaction owner. Validation: causal host count regression, 150 owning tests, native fetched-row and byte bounds, captured-input and read-error controls, full changed-file gate, and independent review.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review in progressClawSweeper is reviewing this revision. This supersedes any previous blocked status. |
|
Codex review: blocked before merge. Reviewed September 30, 2026, 4:07 PM ET / 20:07 UTC (Revision 4). ClawSweeper reviewWhat this changesMemory Core moves Forget index selection, row counts, and vector inspection into its existing retrieval worker and updates boundary tests and database documentation. Merge readiness⛔ Blocked before merge - 1 item remains Current main still runs Forget index planning on the caller thread, so this PR remains useful. The previous upgrade-compatibility blocker does not apply: the patch changes private read messages and execution placement, without changing stored data. Priority: P2 Review scores
Verification
How this fits togetherMemory Forget takes session and source selectors, examines workspace artifacts and the agent’s SQLite index, then previews or purges matching memory. The retrieval worker prepares index facts; the existing write owner checks live lineage before deletion. flowchart LR
A[Forget selectors] --> B[Workspace evidence]
B --> C[Retrieval worker]
C --> D[Index plan and counts]
D --> E{Preview or apply}
E --> F[Preview report]
E --> G[Live lineage check]
G --> H[Purge and report]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +110, Tests +222, Docs +4, Other +4. Total +340 across 16 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Technical reviewBest possible solution: Keep index planning with Memory Core’s existing read worker while preserving noncreating preview, bounded returned facts, and write-time lineage revalidation. Do we have a high-confidence way to reproduce the issue? Yes. Current main’s Forget planner visibly executes its SQLite query on the caller thread; this read-only review did not rerun the reported failing case. Is this the best way to solve the issue? Yes. The existing retrieval worker is the narrow read owner, and the patch leaves destructive writes and live lineage checks with their established owner. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 7045908edbfc. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
|
Merged via explicitly authorized admin squash with attributed pre-existing CI failures.
|
…162045) Use the existing memory retrieval pool for noncreating index selection, counts, and vector inspection. Capture caller placement and matching facts before dispatch, share the existing scrub rules, and return only selected row identities and counts. Keep final lineage checks and write settlement with their existing transaction owner. Validation: causal host count regression, 150 owning tests, native fetched-row and byte bounds, captured-input and read-error controls, full changed-file gate, and independent review.
What Problem This Solves
memory forgetstill scans the index, counts derived rows, and loads the vector extension on the caller thread while preparing preview and apply.User Impact
Preview selection, reported counts, deletion ordering, and stored data stay unchanged. The remaining index-planning SQL runs in the existing Memory retrieval worker. No configuration, schema, retention, or supported SDK contract changes.
Session policy reads and cold database/bootstrap work remain separate migration work.
Why This Change Was Made
The caller captures its database target and matching inputs before dispatch. The worker reuses the original scrub rules and noncreating read owner, keeps indexed memory text local, and returns only selected row identities and counts. Real vector inspection retains its own probe/read-only cleanup. Final live lineage checks and mutations remain with their existing transaction owner.
The request participates in the retrieval pool's existing byte and task admission; no input truncation, new queue, or resource-budget override is added.
Evidence
pnpm buildpassed (20m 57s). Supported built CLI indexing and vector-enabled preview/apply/repeat passed in 44.11s: preview/apply each reported three selected vectors, repeat reported zero, surviving vector bytes and the original tombstone timestamp matched independent SQLite reads. All 15 child processes joined and the loopback endpoint closed.CI run 36759848676 stopped on two tooling assertions in
desktop-resize-proof.test.tsandparallels-smoke-model.test.ts(762 sibling tests passed). The unchanged tooling fixture port-ownership defects are corrected on main by 662b776. Independent real-contender controls reproduced the defects and passed with the existing claim owner; the repaired original-order selection passed 765 cases. The original CI socket tuples were not logged, and the unchanged local 764-case replay is only a non-reproduction. The cancelled lanes remain incomplete coverage.Local per-file wall times with the maintained test wrapper and
--maxWorkers=1(Node 24.21/macOS):memory-forget.test.ts77.82s (15 passed),memory-forget-recovery.test.ts40.91s (8 passed), andmemory-forget.sources.test.ts39.06s (11 passed). These include preparation, imports, hooks, and cleanup. The real worker/SQLite boundaries are necessary to observe host versus native SQL, live source refusal, and durable failure recovery; mock readers would not prove those contracts. The repeated measurements add no distinct cases to the 150-test total. Completed per-file CI timings are not available from the cancelled run.The automatic data-model checklist is not applicable: the agent schema/version, origin row codec, write backend, and tombstone kernel are byte-identical to the PR base. The added types are private worker read messages; no persisted format or migration changes. Existing-store CLI and optional-table/error controls cover the moved read boundary.