From 7615c40f737df9270aa78666283c81b7b0522fc2 Mon Sep 17 00:00:00 2001 From: huanghuoguoguo <60681390+huanghuoguoguo@users.noreply.github.com> Date: Mon, 20 Jul 2026 17:12:55 +0800 Subject: [PATCH] fix(plugin): extend knowledge retrieval timeout --- src/langbot/pkg/plugin/handler.py | 2 +- tests/unit_tests/plugin/test_handler.py | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/langbot/pkg/plugin/handler.py b/src/langbot/pkg/plugin/handler.py index fc6b980b0..ef5d247dd 100644 --- a/src/langbot/pkg/plugin/handler.py +++ b/src/langbot/pkg/plugin/handler.py @@ -1944,7 +1944,7 @@ class RuntimeConnectionHandler(handler.Handler): 'retriever_name': retriever_name, 'retrieval_context': retrieval_context, }, - timeout=30, + timeout=180, ) return result diff --git a/tests/unit_tests/plugin/test_handler.py b/tests/unit_tests/plugin/test_handler.py index 884ee74cf..1231d39a7 100644 --- a/tests/unit_tests/plugin/test_handler.py +++ b/tests/unit_tests/plugin/test_handler.py @@ -274,6 +274,24 @@ class TestHandlerPluginDiagnostic: plugin_handler.LangBotToRuntimeAction = original +class TestHandlerKnowledgeRetrieval: + @pytest.mark.asyncio + async def test_retrieve_knowledge_allows_runtime_to_finish_inner_timeout(self): + app = SimpleNamespace() + runtime_handler = make_handler(app) + runtime_handler.call_action = AsyncMock(return_value={'results': []}) + + result = await runtime_handler.retrieve_knowledge( + 'langbot-team', + 'LangRAG', + '', + {'query': 'sentinel'}, + ) + + assert result == {'results': []} + assert runtime_handler.call_action.await_args.kwargs['timeout'] == 180 + + class TestConstantsSemanticVersion: """Tests for version constant access."""