~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.
Python academiaanthropicarxivbravedeep-researchencryptionhome-automationhomeserverlocallocal-deep-researchlocal-llmmistralollamaopenaipubmedresearchresearch-toolretrieval-augmented-generationsearxngself-hosted
fix(langgraph-agent): fix meaningless synthesising 0 sources milestone in detailed-report mode (#5176)
S26dca68c2bae
diff --git a/src/local_deep_research/advanced_search_system/strategies/langgraph_agent_strategy.py b/src/local_deep_research/advanced_search_system/strategies/langgraph_agent_strategy.pyindex 7c047d7bce..99ade11106 100644--- a/src/local_deep_research/advanced_search_system/strategies/langgraph_agent_strategy.py+++ b/src/local_deep_research/advanced_search_system/strategies/langgraph_agent_strategy.py@@ -1632,11 +1632,38 @@ class LangGraphAgentStrategy(BaseSearchStrategy):f"citations (#4969, query '{query[:80]}')")- self._update_progress(- f"Synthesizing {len(all_search_results)} sources with citations",- 90,- {"phase": "synthesis", "type": "milestone"},- )+ # Emit synthesis milestone if it is not an agent failure+ if final_answer != NO_RESULTS_MESSAGE:+ if not all_search_results and self.all_links_of_system:+ self._update_progress(+ f"Skipping citation synthesis (reusing {len(self.all_links_of_system)} accumulated sources)",+ 90,+ {+ "phase": "synthesis",+ "type": "milestone",+ "new_sources": 0,+ "accumulated_sources": len(self.all_links_of_system),+ "citation_pass_skipped": True,+ },+ )+ elif not all_search_results and not self.all_links_of_system:+ self._update_progress(+ "No sources available for citation synthesis",+ 90,+ {+ "phase": "synthesis",+ "type": "milestone",+ "new_sources": 0,+ "accumulated_sources": 0,+ "citation_pass_skipped": True,+ },+ )+ else:+ self._update_progress(+ f"Synthesizing {len(all_search_results)} sources with citations",+ 90,+ {"phase": "synthesis", "type": "milestone"},+ )synthesized_content = final_answerdocuments: list = []diff --git a/tests/strategies/test_langgraph_agent_strategy.py b/tests/strategies/test_langgraph_agent_strategy.pyindex 835f142d4d..8f6966f919 100644--- a/tests/strategies/test_langgraph_agent_strategy.py+++ b/tests/strategies/test_langgraph_agent_strategy.py@@ -2249,3 +2249,64 @@ class TestFinalizeCitationLogging:"no inline [N] citation markers" in wfor w in self._warnings(mock_logger))++ def test_milestone_skipped_for_no_results_sentinel(self):+ """NO_RESULTS_MESSAGE sentinel must suppress the progress milestone completely."""+ from local_deep_research.advanced_search_system.strategies.langgraph_agent_strategy import (+ NO_RESULTS_MESSAGE,+ )++ strategy = self._make_strategy(all_links=[])+ progress_updates = []+ strategy.set_progress_callback(+ lambda msg, pct, meta: progress_updates.append((msg, pct, meta))+ )++ strategy._finalize("q", NO_RESULTS_MESSAGE, 1, 0, [])++ # The synthesis milestone (progress 90) must not be emitted+ synthesis_updates = [+ u for u in progress_updates if u[2].get("phase") == "synthesis"+ ]+ assert len(synthesis_updates) == 0++ def test_milestone_describes_accumulated_sources_when_new_empty(self):+ """Empty per-call collector but accumulated sources present -> show accumulated sources."""+ links = [self._link(1, "https://a.example/x")]+ strategy = self._make_strategy(all_links=links)+ progress_updates = []+ strategy.set_progress_callback(+ lambda msg, pct, meta: progress_updates.append((msg, pct, meta))+ )++ strategy._finalize("q", "prose", 1, 0, [])++ synthesis_updates = [+ u for u in progress_updates if u[2].get("phase") == "synthesis"+ ]+ assert len(synthesis_updates) == 1+ msg, pct, meta = synthesis_updates[0]+ assert (+ "Skipping citation synthesis (reusing 1 accumulated sources)" in msg+ )+ assert meta.get("citation_pass_skipped") is True+ assert meta.get("accumulated_sources") == 1++ def test_milestone_both_empty_emits_followup(self):+ """Both collectors empty -> emit only the fallback explanation milestone."""+ strategy = self._make_strategy(all_links=[])+ progress_updates = []+ strategy.set_progress_callback(+ lambda msg, pct, meta: progress_updates.append((msg, pct, meta))+ )++ strategy._finalize("q", "prose", 1, 0, [])++ synthesis_updates = [+ u for u in progress_updates if u[2].get("phase") == "synthesis"+ ]+ assert len(synthesis_updates) == 1+ assert (+ "No sources available for citation synthesis"+ in synthesis_updates[0][0]+ )