fix: add hard timeout to memory_search to prevent session wedging#993
Open
BingqingLyu wants to merge 2 commits into
Open
fix: add hard timeout to memory_search to prevent session wedging#993BingqingLyu wants to merge 2 commits into
BingqingLyu wants to merge 2 commits into
Conversation
A stalled memory manager init or search (e.g. iCloud/network mount in extraPaths) can wedge the entire agent turn indefinitely — the user gets no reply and the session appears dead. Wrap the full memory_search execution (manager init + search) with a 30s hard timeout using Promise.race. On timeout, the existing catch block returns the standard unavailable result with disabled=true, allowing the assistant to continue the turn with a degraded reply. Closes openclaw#49524
Address review feedback: distinguish timeout from generic provider errors in the unavailable result warning/action fields, and strengthen test assertions to use expectUnavailableMemorySearchDetails.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
memory_searchtool call (e.g. iCloud/network mount inextraPaths, unresponsive embedding provider, or slow manager init) can wedge the entire agent turn indefinitely — the user gets no reply and the session appears dead.memory_searchexecution (manager init + search) with a 30-second hard timeout usingPromise.race. On timeout, the existing catch block returns the standard{ disabled: true, unavailable: true }result, allowing the assistant to continue the turn with a degraded reply like "memory retrieval is unavailable right now."Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
User-visible / Behavior Changes
memory_searchnow fails open after 30 seconds instead of hanging foreverdisabled: trueand can tell the user memory is unavailable rather than going silentSecurity Impact (required)
Repro + Verification
Environment
extraPaths)agents.defaults.memorySearch.extraPathspointing at iCloud/network mountSteps
memorySearch.extraPathswith a slow/flaky mount (iCloud, network drive)memory_searchExpected
{ disabled: true }after timeout, assistant continues with degraded replyActual (before fix)
Evidence
The new test uses
vi.useFakeTimers()to simulate a never-resolving search, advances past 30s, and verifies the tool returns{ disabled: true, error: "...timed out" }.Human Verification (required)
Review Conversations
Compatibility / Migration
Failure Recovery (if this breaks)
Risks and Mitigations
AI-assisted: Yes (lightly tested via unit tests; I understand what the code does)
Testing degree: Fully tested with 1 new unit test using fake timers