Skip to content

DeepTutor: Lifelong Personalized Tutoring. https://deeptutor.info/.

follow-up to #1357: a ceiling for a stalled provider, not for a slow tool

Bingxi Zhao (Frank)253dc0b28476
diff --git a/deeptutor/agents/research/pipeline.py b/deeptutor/agents/research/pipeline.py
index 1b9c0922e..e105a52a8 100644
--- a/deeptutor/agents/research/pipeline.py
+++ b/deeptutor/agents/research/pipeline.py
@@ -397,12 +397,21 @@ class ResearchPipeline:
key="max_iterations",
default=DEFAULT_BLOCK_MAX_ITERATIONS,
)
+ # A ceiling on a stalled provider, not a service-level objective. A
+ # research tool is not quick by nature: one ``rag`` call against a
+ # LightRAG or GraphRAG index makes its own LLM calls before it returns
+ # anything, and a search-then-fetch chain waits on someone else's site.
+ # 60s would have cancelled work that was going to succeed, and each
+ # retry then pays the full timeout again. 240s matches the ceiling
+ # ``geogebra_analysis`` uses for the same reason, and retries are off by
+ # default: only a caller who knows its tools are flaky (rather than
+ # slow) should pay for a second attempt.
self.tool_timeout = max(
1,
_read_int(
researching,
key="tool_timeout",
- default=60,
+ default=240,
),
)
self.tool_max_retries = max(
@@ -410,7 +419,7 @@ class ResearchPipeline:
_read_int(
researching,
key="tool_max_retries",
- default=3,
+ default=0,
),
)
self.max_parallel_topics = max(
diff --git a/tests/agents/research/test_block_tool_policy.py b/tests/agents/research/test_block_tool_policy.py
index df751f174..fb0ac7780 100644
--- a/tests/agents/research/test_block_tool_policy.py
+++ b/tests/agents/research/test_block_tool_policy.py
@@ -78,3 +78,26 @@ async def test_block_host_passes_tool_policy_to_dispatcher(
assert captured["tool_timeout"] == 7
assert captured["tool_max_retries"] == 2
+
+
+def test_tool_policy_defaults_bound_a_stall_without_multiplying_a_slow_tool(
+ monkeypatch: pytest.MonkeyPatch,
+) -> None:
+ """The shipped pair is deliberate, so pin it.
+
+ A research tool is slow by nature — one ``rag`` call against a LightRAG or
+ GraphRAG index makes its own LLM calls first, and search-then-fetch waits
+ on someone else's site — so the ceiling has to be one only a stalled
+ provider reaches, and a retry must not re-pay it for a tool that was going
+ to succeed. Neither number is pinned anywhere else: the policy tests above
+ pass whatever they configure.
+ """
+ monkeypatch.setattr("deeptutor.agents.research.pipeline.get_llm_config", lambda: _FakeLLM())
+ monkeypatch.setattr(
+ "deeptutor.agents.research.pipeline.get_tool_registry", lambda: _FakeRegistry()
+ )
+
+ pipeline = ResearchPipeline(language="en", runtime_config={})
+
+ assert pipeline.tool_timeout == 240
+ assert pipeline.tool_max_retries == 0