~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
chore(chat): log follow-up prior-context mode + size (#4359)
LearningCircuit07ddc906d690
diff --git a/changelog.d/+chat-followup-context-logging.misc.md b/changelog.d/+chat-followup-context-logging.misc.mdnew file mode 100644index 0000000000..5ae2981ba5--- /dev/null+++ b/changelog.d/+chat-followup-context-logging.misc.md@@ -0,0 +1 @@+Chat follow-up research now logs which prior-context mode ran and how many characters of context it built. Previously the context-building step (especially the LLM summary) produced no log output, so a follow-up's preparation looked like an unexplained pause.diff --git a/src/local_deep_research/chat/context.py b/src/local_deep_research/chat/context.pyindex cd73429b02..712d306d1c 100644--- a/src/local_deep_research/chat/context.py+++ b/src/local_deep_research/chat/context.py@@ -164,16 +164,29 @@ class ChatContextManager:)if mode == "none":- return ""- if mode == "raw":- return self._extract_findings_from_history()- if mode == "full":- return self._build_conversation_text()- # "summary": needs the new question to focus on; without one (e.g. a- # no-arg build_research_context call) fall back to raw recent findings.- if current_query:- return self._summarize_prior_work(current_query)- return self._extract_findings_from_history()+ findings = ""+ elif mode == "raw":+ findings = self._extract_findings_from_history()+ elif mode == "full":+ findings = self._build_conversation_text()+ elif current_query:+ # "summary" with a question to focus on.+ findings = self._summarize_prior_work(current_query)+ else:+ # "summary" with no question (e.g. a no-arg build_research_context+ # call): fall back to raw recent findings.+ findings = self._extract_findings_from_history()++ # Observability: the summary path is otherwise silent (no token-counter+ # entry, since get_llm runs without a research_id), so a follow-up's+ # prior-context build looked like an unexplained pause. One line per+ # follow-up turn records which mode ran and how much context it built.+ logger.info(+ "Chat follow-up prior context: mode={}, {} chars",+ mode,+ len(findings),+ )+ return findingsdef _build_conversation_text(self) -> str:"""Render the prior conversation (both roles) as a plain transcript.diff --git a/tests/chat/test_chat_followup_context_logging.py b/tests/chat/test_chat_followup_context_logging.pynew file mode 100644index 0000000000..530630a6b2--- /dev/null+++ b/tests/chat/test_chat_followup_context_logging.py@@ -0,0 +1,54 @@+"""Observability: a chat follow-up's prior-context build logs its mode + size.++The summary path is otherwise silent (no token-counter entry), so a follow-up+looked like an unexplained pause. One info line per follow-up records what ran.+"""++from src.local_deep_research.chat.context import ChatContextManager++_LOGGER = "src.local_deep_research.chat.context.logger"+++def _conversation():+ return [+ {"role": "user", "content": "What is X?", "message_type": "query"},+ {+ "role": "assistant",+ "content": "X is a thing with several properties.",+ "message_type": "response",+ "research_id": "r1",+ },+ ]+++class TestFollowupContextLogging:+ def test_logs_mode_and_size_on_followup(self, mocker):+ log = mocker.patch(_LOGGER)+ manager = ChatContextManager(+ session_id="s1",+ messages=_conversation(),+ accumulated_context={},+ settings_snapshot={"chat.followup_context_mode": "raw"},+ )++ manager.build_research_context(current_query="tell me more")++ log.info.assert_called_once()+ fmt, *values = log.info.call_args.args+ assert "mode=" in fmt+ assert "raw" in values # the resolved mode is logged++ def test_first_turn_does_not_log(self, mocker):+ log = mocker.patch(_LOGGER)+ manager = ChatContextManager(+ session_id="s1",+ messages=[+ {"role": "user", "content": "First", "message_type": "query"}+ ],+ accumulated_context={},+ )++ manager.build_research_context(current_query="First")++ # No prior work on the first turn → no context-build log line.+ log.info.assert_not_called()