Repository navigation
fix(memory): stop cancelled searches before returning results - #124118
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 15, 2026, 4:54 AM ET / 08:54 UTC. ClawSweeper reviewWhat this changesThe PR passes a caller cancellation signal through Memory Core’s vector search so aborted hybrid searches stop fallback scanning and reject instead of returning keyword results. Merge readinessNo blocking correctness or security finding: the PR repairs the missing cancellation propagation at the vector-search owner. Likely related people: steipete (high) and nitinjwadhawan (medium). Priority: P2 Review scores
Verification
How this fits togetherMemory Core turns an embedding query into vector and keyword retrieval results for the memory_search tool. This path decides whether vector retrieval continues, falls back to keyword results, or ends because the caller cancelled. flowchart LR
A[Memory search request] --> B[Deadline and caller signal]
B --> C[Hybrid memory search]
C --> D[Vector readiness]
D --> E[Vector or fallback scan]
E --> F{Caller cancelled?}
F -->|Yes| G[Reject with abort reason]
F -->|No| H[Merge and return results]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +11, Tests +128. Total +139 across 4 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep cancellation owned by the vector-search boundary, with checks at entry, readiness, and the existing cooperative scan yield; rebase and validate that exact head before merge. Do we have a high-confidence way to reproduce the issue? Yes—current main drops the caller signal before vector retrieval and treats its rejection as an ordinary vector error; the added 4,096-row tests provide a focused current-main regression path, though no local test was run in this read-only review. Is this the best way to solve the issue? Yes—the repair places cancellation at the vector owner rather than adding a downstream result guard, while retaining existing keyword degradation for genuine un-aborted vector failures. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against de4104c84d71. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Land-ready proof for
No schema/data, provider health/auth/routing, config/default, SDK/protocol, retention, migration, changelog, or release change. |
|
Merged via squash.
|
…aw#124118) * fix(memory): stop vector scan after search cancellation * fix(memory): preserve cancellation through hybrid search
Related: #124050
What Problem This Solves
Fixes an issue where cancelling built-in memory search after query embedding could leave an in-process vector fallback scan running and allow hybrid search to return ordinary keyword matches as if the cancelled request had succeeded.
Why This Change Was Made
Carry the caller cancellation signal through vector readiness and fallback SQLite scanning, check it at the existing 256-row cooperative yield boundary, and let cancellation win in hybrid orchestration before the existing vector-error degradation path. Genuine un-aborted vector failures still degrade to keyword results.
The change stays inside Memory Core search ownership. It does not change provider health policy, auth/routing, configuration/defaults, SQLite schema or data, SDK/protocol contracts, retention, or migrations.
User Impact
Cancelled memory searches now reject with the exact caller reason, stop within one bounded scan batch, perform no later SQLite scan work, and never surface keyword results as successful output. Later healthy searches continue to work on the same provider and index. Large indexes avoid CPU work after the caller has already abandoned the search.
Evidence
memory/2026-01-12.mdafter caller abort instead of rejecting.memory_search, and 2 CLI search/output tests passed.git diff --check: clean.