mirror of
https://github.com/HKUDS/nanobot.git
synced 2026-04-07 19:53:40 +00:00
DDGS's internal `timeout=10` relies on `requests` read-timeout semantics, which only measure the gap between bytes — not total wall-clock time. When the underlying HTTP connection enters CLOSE-WAIT or the server dribbles data slowly, this timeout never fires, causing `ddgs.text` to hang indefinitely via `asyncio.to_thread`. Since `asyncio.to_thread` cannot cancel the underlying OS thread, the agent's session lock is never released, blocking all subsequent messages on the same session (observed: 8+ hours of unresponsiveness). Fix: - Add `timeout` field to `WebSearchConfig` (default: 30s, configurable via config.json or NANOBOT_TOOLS__WEB__SEARCH__TIMEOUT env var) - Wrap `asyncio.to_thread` with `asyncio.wait_for` to enforce a hard wall-clock deadline Closes #2804 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>