fix(memory-core): preserve sibling supplement results when one search rejects (#77897)#78035
fix(memory-core): preserve sibling supplement results when one search rejects (#77897)#78035lonexreb wants to merge 1 commit intoopenclaw:mainfrom
Conversation
|
Codex review: needs real behavior proof before merge. Summary Reproducibility: yes. source-reproducible: register one resolving and one rejecting corpus supplement, then call Real behavior proof Next step before merge Security Review findings
Review detailsBest possible solution: Land the narrow allSettled fix in memory-core with regression coverage, a Do we have a high-confidence way to reproduce the issue? Yes, source-reproducible: register one resolving and one rejecting corpus supplement, then call Is this the best way to solve the issue? Yes for the code direction: Full review comments:
Overall correctness: patch is correct Acceptance criteria:
What I checked:
Likely related people:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against e28ad6a8697b. |
Summary
Fixes #77897.
searchMemoryCorpusSupplements(extensions/memory-core/src/tools.shared.ts) usedPromise.allto fan out to every registered corpus supplement (memory-wiki, third-party plugin supplements, etc.).Promise.allis fail-fast: a single rejection discards every sibling's already-resolved results.This patch swaps
Promise.all→Promise.allSettled, then re-flattens the fulfilled values. Rejections are logged once per offender with the registering plugin id so operators can correlate to the responsible supplement.Behavior contract (mathematical guarantee)
Let
Sbe the set of registered corpus supplements at call time. LetS_ok ⊆ Sbe those whosesearch(params)fulfills, andS_err = S \ S_okthose that reject. The function now satisfies:In particular:
|S_err| ≥ 1does not collapseresultto[]. Sibling results survive.|S_err| = |S|returns[](graceful degradation, not throw).|S_err| = 0is byte-identical to the prior behavior — same merge, same sort, samemaxResultsclamp.Real behavior proof
7 new tests in
extensions/memory-core/src/tools.shared.test.tslock in the contract:[]S_err=1does not poisonS_ok[](no throw)maxResults: 5,maxResults: 0corpus: "memory" | "sessions"Why this matters
Memory search is on the agent's hot read path. Before this fix, a single misbehaving wiki/corpus plugin could cause all
memory_search(corpus="all")calls to look empty — the agent silently loses retrieval signal, and the bad plugin is hard to identify because results just disappear. After this fix, the failing plugin is named in the warn log and sibling retrieval continues to work, so a noisy supplement degrades gracefully instead of poisoning the whole memory subsystem.Risk
Promise.allSettledis supported in Node 22+ (the repo's stated runtime).console.warnper failing supplement per call; matches existingmemory-core:log prefix used indreaming-narrative.ts.Closes #77897
🤖 Generated with Claude Code