diff --git a/src/agent_loop.py b/src/agent_loop.py index 5a4d1dbd7..828cdae1d 100644 --- a/src/agent_loop.py +++ b/src/agent_loop.py @@ -2532,11 +2532,17 @@ async def stream_agent_loop( ) logger.info(f"[tool-rag] Retrieved tools for query: {sorted(_relevant_tools - ALWAYS_AVAILABLE)}") except asyncio.TimeoutError: + # Leave _relevant_tools unset so the keyword fallback + # below still runs. Hard-coding ALWAYS_AVAILABLE here + # skipped the deterministic keyword hints whenever the + # embedding backend was slow (e.g. a remote endpoint + # cold-loading its model), silently stripping email/ + # calendar tools from queries that named them outright. logger.warning( - "[tool-rag] Retrieval exceeded %.1fs; falling back to always-available tools", + "[tool-rag] Retrieval exceeded %.1fs; falling back to keyword tool selection", _TOOL_SELECTION_TIMEOUT_SECONDS, ) - _relevant_tools = set(ALWAYS_AVAILABLE) + _relevant_tools = None except Exception as e: logger.warning(f"[tool-rag] Retrieval failed, using keyword fallback: {e}") _relevant_tools = None