Skip to content

bug(memory): required recall timeout must block the turn #1848

Description

@memand

Summary

Required automatic memory recall can abort a turn with an unhandled timeout when its bounded search does not finish.

Reproduction context

  • Bundled _memory plugin with automatic recall enabled and delayed recall disabled
  • Local Hugging Face embedding model: sentence-transformers/all-MiniLM-L6-v2
  • Local FAISS memory index
  • Recall timeout: 30 seconds

_50_recall_memories.py creates a recall task with asyncio.wait_for(..., timeout=30). _91_recall_wait.py then awaits that task. If the embedding/search exceeds the budget, the timeout currently propagates through prompt preparation.

Required behavior

In a memory-required harness, a timed-out automatic recall must be visible and fail closed:

  • do not call the main model or generate a response without the required recalled-memory context;
  • record a concise user-visible error that the response was blocked because memory recall timed out;
  • preserve normal asyncio.CancelledError propagation;
  • handle a completed failed task as well as a task still pending at the wait point.

Proposed fix

Catch only asyncio.TimeoutError at the recall-wait boundary, clear the failed recall task, log a concise error, and raise the framework's HandledException to terminate that turn in controlled fashion. This prevents an uninformed contribution while avoiding an unhandled traceback.

Focused regression coverage verifies pending timeout blocking, already-completed timeout blocking, and cancellation propagation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions