Skip to content

~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.

fix(config): use canonical source question key (#5389)

Ziyang Guoe2a474a5a633
diff --git a/changelog.d/4515.bugfix.md b/changelog.d/4515.bugfix.md
new file mode 100644
index 0000000000..e4fbc487b4
--- /dev/null
+++ b/changelog.d/4515.bugfix.md
@@ -0,0 +1 @@
+Correct source-based strategy diagnostics to read the canonical questions-per-iteration setting.
diff --git a/src/local_deep_research/advanced_search_system/strategies/source_based_strategy.py b/src/local_deep_research/advanced_search_system/strategies/source_based_strategy.py
index 01217317f4..cd4473559d 100644
--- a/src/local_deep_research/advanced_search_system/strategies/source_based_strategy.py
+++ b/src/local_deep_research/advanced_search_system/strategies/source_based_strategy.py
@@ -207,7 +207,9 @@ class SourceBasedSearchStrategy(BaseSearchStrategy):
# Determine number of iterations to run
iterations_to_run = self.get_setting("search.iterations", 2)
iterations_to_run = int(iterations_to_run)
- questions_per_iteration = self.get_setting("search.questions", 3)
+ questions_per_iteration = self.get_setting(
+ "search.questions_per_iteration", 3
+ )
logger.info(
f"SourceBasedStrategy configuration - iterations: {iterations_to_run}, questions_per_iteration: {questions_per_iteration}"
diff --git a/tests/strategies/test_strategy_behaviors.py b/tests/strategies/test_strategy_behaviors.py
index 8d60815181..f54aa110ff 100644
--- a/tests/strategies/test_strategy_behaviors.py
+++ b/tests/strategies/test_strategy_behaviors.py
@@ -4,12 +4,51 @@ Detailed behavior tests for working strategies.
Tests specific features and behaviors of strategies beyond basic functionality.
"""
+from unittest.mock import patch
+
from loguru import logger
class TestSourceBasedStrategy:
"""Detailed tests for SourceBasedSearchStrategy."""
+ def test_logs_questions_from_canonical_setting(
+ self,
+ strategy_mock_llm,
+ strategy_mock_search,
+ strategy_settings_snapshot,
+ ):
+ from local_deep_research.search_system_factory import create_strategy
+
+ settings = dict(strategy_settings_snapshot)
+ settings["search.iterations"] = {"value": 1, "type": "int"}
+ settings["search.questions"] = {"value": 1, "type": "int"}
+ settings["search.questions_per_iteration"] = {
+ "value": 7,
+ "type": "int",
+ }
+ strategy = create_strategy(
+ strategy_name="source-based",
+ model=strategy_mock_llm,
+ search=strategy_mock_search,
+ settings_snapshot=settings,
+ )
+
+ with patch(
+ "local_deep_research.advanced_search_system.strategies."
+ "source_based_strategy.logger"
+ ) as mock_logger:
+ strategy.analyze_topic("Test query")
+
+ messages = [
+ call.args[0]
+ for call in mock_logger.info.call_args_list
+ if call.args
+ ]
+ assert any(
+ "questions_per_iteration: 7" in message for message in messages
+ )
+
def test_finds_sources_from_search_results(
self,
strategy_mock_llm,