From a6336118236e6c6d4c2013c6492ea7e7a7dcaef7 Mon Sep 17 00:00:00 2001 From: Michael <52305679+michaelxer@users.noreply.github.com> Date: Mon, 15 Jun 2026 12:58:56 +0700 Subject: [PATCH] fix(agent): let retrieval run for non-English low-signal queries Allow non-workspace low-signal prompts to fall through to tool retrieval so non-English requests are not limited to always-available tools. --- src/agent_loop.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/agent_loop.py b/src/agent_loop.py index 26938c429..5b9bb2ba9 100644 --- a/src/agent_loop.py +++ b/src/agent_loop.py @@ -1801,18 +1801,21 @@ async def stream_agent_loop( logger.info(f"[tool-rag] Using caller-provided relevant_tools ({len(_relevant_tools)} tools)") if not guide_only and not _relevant_tools and bool(_intent.get("low_signal")): from src.tool_index import ALWAYS_AVAILABLE - _relevant_tools = set(ALWAYS_AVAILABLE) if workspace: # An active workspace IS the file-work signal: a vague "look at the # project" means explore this folder. Surface only the READ-ONLY file # tools (intersection with the plan-mode read-only allowlist) so the # agent can investigate; write/shell tools stay out until the request # actually calls for them (RAG retrieval adds those on a real ask). + _relevant_tools = set(ALWAYS_AVAILABLE) from src.tool_security import PLAN_MODE_READONLY_TOOLS _relevant_tools |= (_DOMAIN_TOOL_MAP["files"] & PLAN_MODE_READONLY_TOOLS) logger.info("[tool-rag] Low-signal but workspace active; including read-only file tools") else: - logger.info("[tool-rag] Low-signal agent message; skipping retrieval and using always-available tools only") + # Don't short-circuit: fall through to RAG retrieval below. + # Non-English queries are flagged low_signal by the English-only + # intent classifier, but fastembed retrieval works across languages. + logger.info("[tool-rag] Low-signal query; will run RAG retrieval") if not guide_only and not _relevant_tools: try: from src.tool_index import get_tool_index, ALWAYS_AVAILABLE