Skip to content

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

fix(research): stop the settings layer shadowing the tool policy defaults

Bingxi Zhao (Frank)3d2648d01bc8
diff --git a/deeptutor/services/config/capabilities_settings.py b/deeptutor/services/config/capabilities_settings.py
index 3a77deb14..ed99c11e4 100644
--- a/deeptutor/services/config/capabilities_settings.py
+++ b/deeptutor/services/config/capabilities_settings.py
@@ -72,8 +72,13 @@ _MAIN_YAML_RUNTIME_DEFAULTS: dict[str, dict[str, Any]] = {
"research": {
"researching": {
"note_agent_mode": "auto",
- "tool_timeout": 60,
- "tool_max_retries": 3,
+ # Must match ``ResearchPipeline``'s own defaults. This table is the
+ # fallback used when a settings payload is written, so a user who
+ # merely opens research settings and saves would otherwise persist
+ # 60/3 and permanently shadow the pipeline's 240/0 — the same shape
+ # of bug as #1316, where a layer below the config silently won.
+ "tool_timeout": 240,
+ "tool_max_retries": 0,
"paper_search_years_limit": 5,
},
},
diff --git a/tests/agents/research/test_block_tool_policy.py b/tests/agents/research/test_block_tool_policy.py
index fb0ac7780..e8eeb1d00 100644
--- a/tests/agents/research/test_block_tool_policy.py
+++ b/tests/agents/research/test_block_tool_policy.py
@@ -101,3 +101,22 @@ def test_tool_policy_defaults_bound_a_stall_without_multiplying_a_slow_tool(
assert pipeline.tool_timeout == 240
assert pipeline.tool_max_retries == 0
+
+
+def test_settings_layer_defaults_match_the_pipeline_defaults() -> None:
+ """The two layers that can decide the tool policy must not disagree.
+
+ ``_MAIN_YAML_RUNTIME_DEFAULTS`` is the fallback applied when a research
+ settings payload is written to main.yaml. If it holds different numbers
+ than ``ResearchPipeline`` reads as its own defaults, then saving settings
+ once — without touching either field — persists the table's values and the
+ pipeline default becomes unreachable, which is how #1316 hid a 4096 token
+ budget no user could raise.
+ """
+ from deeptutor.services.config.capabilities_settings import (
+ _MAIN_YAML_RUNTIME_DEFAULTS,
+ )
+
+ researching = _MAIN_YAML_RUNTIME_DEFAULTS["research"]["researching"]
+ assert researching["tool_timeout"] == 240
+ assert researching["tool_max_retries"] == 0