-
-
Notifications
You must be signed in to change notification settings - Fork 80.7k
memory_search tool-level timeout orphans background embedding work #91718
Copy link
Copy link
Labels
P2Normal backlog priority with limited blast radius.Normal backlog priority with limited blast radius.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.ClawSweeper found a clear likely implementation shape for this issue.clawsweeper:queueable-fixClawSweeper marked this issue as an existing queue_fix_pr work candidate.ClawSweeper marked this issue as an existing queue_fix_pr work candidate.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:otherThis issue has meaningful maintainer-visible impact outside the owned taxonomy.This issue has meaningful maintainer-visible impact outside the owned taxonomy.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Description
Metadata
Metadata
Assignees
Labels
P2Normal backlog priority with limited blast radius.Normal backlog priority with limited blast radius.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.ClawSweeper found a clear likely implementation shape for this issue.clawsweeper:queueable-fixClawSweeper marked this issue as an existing queue_fix_pr work candidate.ClawSweeper marked this issue as an existing queue_fix_pr work candidate.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.impact:otherThis issue has meaningful maintainer-visible impact outside the owned taxonomy.This issue has meaningful maintainer-visible impact outside the owned taxonomy.issue-rating: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Type
Fields
Priority
None yet
Problem
runMemorySearchToolWithDeadline()inextensions/memory-core/src/tools.tsusesPromise.racewith a 15s timeout to fail thememory_searchtool call open when the embedding backend stalls. When the timeout wins the race, the tool returns a clean "timed out" error to the agent.However, the underlying embedding operation (and its retry loop) continues running in the background as an orphaned promise. No
AbortSignalis propagated from the tool-level timeout to cancel the in-flight HTTP fetch or abort theembedQueryWithRetryloop.Impact
When the embedding backend hangs (e.g., Ollama model scheduler wedge), the tool correctly returns after 15s, but:
embedQueryWithRetrycontinues retrying (up to 3 attempts × 60s timeout each = ~3-4 min of background work)Expected behavior
The tool-level timeout should propagate an
AbortSignalto the search operation so that when the 15s deadline fires, the underlyingembedQueryWithRetryloop and its HTTP fetches are cancelled — not just orphaned.The per-call
runEmbeddingOperationWithTimeout()already accepts and uses anAbortSignalcorrectly. The gap is that no signal flows from the tool-level deadline down to the search/embedding call chain.Relevant code
extensions/memory-core/src/tools.ts—runMemorySearchToolWithDeadline()(Promise.race, no signal propagation)extensions/memory-core/src/memory/manager-embedding-ops.ts—embedQueryWithRetry()andrunEmbeddingOperationWithTimeout()(already accept AbortSignal)extensions/memory-core/src/memory/manager.ts:613—embedQueryWithRetrycall site during searchSuggested fix
Pass an
AbortControllerintorunMemorySearchToolWithDeadline, abort it on timeout, and thread the signal throughmanager.search()→embedQueryWithRetry()→runEmbeddingOperationWithTimeout(). The plumbing for signal acceptance already exists at the lower layers.