fix(memory): search memory and wiki concurrently for corpus=all (#92633)#92833
fix(memory): search memory and wiki concurrently for corpus=all (#92633)#92833openperf wants to merge 1 commit into
Conversation
…claw#92633) corpus=all awaited the memory/sessions branch fully before starting the wiki/supplement branch, so two searches that each fit the 15s tool deadline summed past it and the tool returned empty with disabled=true. Start the supplement search concurrently with the memory branch within the same deadline; combined wall time drops to ~max(branch). Co-Authored-By: Claude Opus 4.8 <[email protected]>
|
Codex review: needs maintainer review before merge. Reviewed June 21, 2026, 3:36 PM ET / 19:36 UTC. Summary PR surface: Source +9, Tests +98. Total +107 across 2 files. Reproducibility: yes. Current main and v2026.6.9 await the memory/session branch before the wiki/supplement branch under the same 15s wrapper, so two individually sub-deadline branches can exceed the deadline when summed. Review metrics: none identified. Stored data model Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Land the concurrency fix after maintainers decide issue-closure scope, and keep timeout attribution/debug behavior in #92647 or another canonical follow-up. Do we have a high-confidence way to reproduce the issue? Yes. Current main and v2026.6.9 await the memory/session branch before the wiki/supplement branch under the same 15s wrapper, so two individually sub-deadline branches can exceed the deadline when summed. Is this the best way to solve the issue? Yes for the narrow additive-latency bug. Starting the independent supplement branch earlier is the owner-local fix; warning attribution and partial/debug semantics remain separate work. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 6daf9307e0b9. Label changesLabel justifications:
Evidence reviewedPR surface: Source +9, Tests +98. Total +107 across 2 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
|
This pull request has been automatically marked as stale due to inactivity. |
|
Closing due to inactivity. |
Summary
memory_searchwithcorpus=allran the builtin memory/sessions branch and the wiki/supplement branch sequentially under one 15s tool deadline. Two searches that each finished well under 15s individually summed past the deadline, socorpus=allconsistently returnedresults: []withdisabled: truewhilecorpus=memory,corpus=sessions,corpus=wiki, and the CLI all succeeded.memory + wikito roughlymax(memory, wiki), socorpus=allfits the deadline and returns merged results.Root cause
In the memory_search tool runner, the supplement branch was awaited only after the memory branch fully resolved (manager fetch → vector search → optional forced resync → visibility filtering → decoration). The wiki/supplement branch then performed its own independent embedding and search. Under a single shared 15s deadline the two latencies added together, so an aggregation that was healthy per-corpus timed out as a whole and was misreported as an embedding/provider failure.
Fix
corpus=allcooldown attribution stays single-writer and deterministic: a wiki failure can no longer race a real memory-backend failure into skipping the cooldown.Real behavior proof
Behavior addressed:
memory_search({ corpus: "all" })no longer times out and returns empty when the memory and wiki branches each complete within the deadline but sum past it; it now returns merged memory + wiki results, and a real memory-backend failure still records the cooldown even when the wiki branch fails too.Real environment tested (memory-core extension Vitest suite, Linux, Node 24): a deterministic concurrency regression test drives the real tool runner with a memory search and a registered wiki supplement that each take 9s under fake timers, plus a both-branches-throw test for the cooldown attribution.
Exact steps or command run after this patch (
pnpm test extensions/memory-core/src/tools.citations.test.ts extensions/memory-core/src/tools.test.ts): the new casesruns the memory and wiki branches concurrently for corpus=all (#92633)andrecords the memory cooldown when corpus=all memory and wiki both fail (#92633), plus the full files.Evidence after fix (advancing fake time by 9s resolves the tool with both corpora):
corpus=allreturns[["wiki","entities/alpha.md"],["memory","MEMORY.md"]]withdisabledundefined; the both-fail case still records the memory cooldown so the next memory search is suppressed. All 39 cases across the two suites pass.Observed result after fix (the same two 9s branches that summed to 18s sequentially now complete at ~9s): with the production change reverted, the identical concurrency test hangs until the 120s test timeout because the wiki branch only starts after the memory branch finishes; with the change it resolves at 9s.
What was not tested (a live gateway against a real OpenAI-compatible embedding endpoint,
text-embedding-v4, and a real compiled-wiki supplement on Windows Server): the reporter's exact environment was not reproduced; proof is the deterministic two-slow-branch simulation of the shared-deadline path.Reproduction
memory_searchwith a healthy embedding provider and at least one registered wiki/compiled-wiki supplement, where the builtin memory/sessions search and the wiki search each take several seconds.memory_search({ query, corpus: "memory" }),corpus: "sessions", andcorpus: "wiki"— each succeeds within the 15s deadline.memory_search({ query, corpus: "all" }).results: [],disabled: true,error: "memory_search timed out after 15s".Risk / Mitigation
catch, and the real rejection still surfaces at the awaited merge point on the normal path.Change Type (select all)
Scope (select all touched areas)
extensions/memory-core)Linked Issue/PR
Fixes #92633