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.

test: add regression test for output_instructions propagation

LearningCircuitde0e4f57bf25
diff --git a/tests/strategies/test_strategy_instantiation.py b/tests/strategies/test_strategy_instantiation.py
index b8ccad76e6..9a545e39b5 100644
--- a/tests/strategies/test_strategy_instantiation.py
+++ b/tests/strategies/test_strategy_instantiation.py
@@ -228,6 +228,69 @@ class TestStrategyDefaultValues:
assert isinstance(strategy.questions_by_iteration, dict)
+class TestOutputInstructionsPropagation:
+ """Regression test: settings_snapshot with output_instructions reaches citation handler."""
+
+ STRATEGIES_WITH_CITATION_HANDLER = [
+ "source-based",
+ "standard",
+ "parallel",
+ "rapid",
+ "iterdrag",
+ "focused-iteration",
+ ]
+
+ @pytest.mark.parametrize("strategy_name", STRATEGIES_WITH_CITATION_HANDLER)
+ def test_output_instructions_reach_citation_handler(
+ self,
+ strategy_name: str,
+ strategy_mock_llm,
+ strategy_mock_search,
+ strategy_settings_snapshot,
+ ):
+ """Test that general.output_instructions in the snapshot is visible to the citation handler."""
+ from local_deep_research.search_system_factory import create_strategy
+
+ snapshot = {
+ **strategy_settings_snapshot,
+ "general.output_instructions": "Respond in Spanish",
+ }
+
+ strategy = create_strategy(
+ strategy_name=strategy_name,
+ model=strategy_mock_llm,
+ search=strategy_mock_search,
+ settings_snapshot=snapshot,
+ )
+
+ handler = strategy.citation_handler
+ # The internal handler should produce the output instruction prefix
+ prefix = handler._handler._get_output_instruction_prefix()
+ assert "Respond in Spanish" in prefix
+
+ @pytest.mark.parametrize("strategy_name", STRATEGIES_WITH_CITATION_HANDLER)
+ def test_no_output_instructions_produces_empty_prefix(
+ self,
+ strategy_name: str,
+ strategy_mock_llm,
+ strategy_mock_search,
+ strategy_settings_snapshot,
+ ):
+ """Test that omitting output_instructions yields an empty prefix."""
+ from local_deep_research.search_system_factory import create_strategy
+
+ strategy = create_strategy(
+ strategy_name=strategy_name,
+ model=strategy_mock_llm,
+ search=strategy_mock_search,
+ settings_snapshot=strategy_settings_snapshot,
+ )
+
+ handler = strategy.citation_handler
+ prefix = handler._handler._get_output_instruction_prefix()
+ assert prefix == ""
+
+
class TestSharedLinksIsolation:
"""Test that all_links_of_system is properly isolated between instances."""