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: preserve known worker recovery suggestions in research status (#7244)

Chanhyo Jung312a142b3779
diff --git a/changelog.d/5712.bugfix.md b/changelog.d/5712.bugfix.md
new file mode 100644
index 0000000000..7dbc41ea1b
--- /dev/null
+++ b/changelog.d/5712.bugfix.md
@@ -0,0 +1 @@
+Preserve worker-provided recovery suggestions for recognized research failures in status responses.
diff --git a/src/local_deep_research/web/routers/research.py b/src/local_deep_research/web/routers/research.py
index 0f1f7c9618..734378ceea 100644
--- a/src/local_deep_research/web/routers/research.py
+++ b/src/local_deep_research/web/routers/research.py
@@ -3348,6 +3348,8 @@ def get_research_status(
# missing-model message with a generic Ollama-service error.
if known_message is not None:
error_info["message"] = known_message
+ if metadata.get("solution"):
+ error_info["suggestion"] = str(metadata["solution"])
# Get the latest milestone log for this research
latest_milestone = None
diff --git a/tests/web/routers/test_research_status_error_guidance.py b/tests/web/routers/test_research_status_error_guidance.py
index 3cb236c3ad..572dd173c1 100644
--- a/tests/web/routers/test_research_status_error_guidance.py
+++ b/tests/web/routers/test_research_status_error_guidance.py
@@ -327,15 +327,7 @@ class TestFailureGuidance:
)
def test_a_solution_does_not_override_a_classified_failure(self):
- """The ``solution`` arm sits *after* the five classified ones, so a
- recognised Ollama failure keeps the Ollama advice.
-
- This is the live case, not a hypothetical: the ollama_unavailable
- branch of ``run_research_process`` sets both an error text containing
- "Ollama" and a ``solution``, so the metadata solution is shadowed
- here by design. Move the ``solution`` arm earlier and every Ollama
- failure starts reporting a different suggestion.
- """
+ """An unrecognised stored message keeps the Ollama branch's advice."""
info = _error_info(
_call_status(
{
@@ -353,6 +345,91 @@ class TestFailureGuidance:
)
+ "error,solution,json_metadata",
+ [
+ pytest.param(
+ "Ollama AI service is unavailable. Please check that Ollama is "
+ "running properly on your system.",
+ "Start Ollama with 'ollama serve' or check if it's installed correctly.",
+ False,
+ id="ollama-unavailable",
+ ),
+ pytest.param(
+ "Required Ollama model not found. Please pull the model first.",
+ "Run 'ollama pull mistral' to download the required model.",
+ False,
+ id="model-not-found",
+ ),
+ pytest.param(
+ "Required Ollama model not found. Please pull the model first.",
+ "Run 'ollama pull mistral' to download the required model.",
+ True,
+ id="json-metadata",
+ ),
+ ],
+)
+def test_known_worker_solution_survives_status(
+ error: str, solution: str, json_metadata: bool
+) -> None:
+ metadata = {"phase": "error", "error": error, "solution": solution}
+
+ response = _call_status(json.dumps(metadata) if json_metadata else metadata)
+
+ assert response["metadata"]["error"] == error
+ assert _error_info(response) == {
+ "type": "ollama_error",
+ "message": error,
+ "suggestion": solution,
+ }
+
+
+ "solution_metadata", [{}, {"solution": None}, {"solution": ""}]
+)
+def test_known_worker_error_without_solution_keeps_default_advice(
+ solution_metadata: dict[str, str | None],
+) -> None:
+ error = "Required Ollama model not found. Please pull the model first."
+ metadata = {"phase": "error", "error": error, **solution_metadata}
+
+ info = _error_info(_call_status(metadata))
+
+ assert info == {
+ "type": "ollama_error",
+ "message": error,
+ "suggestion": "Make sure Ollama is running with 'ollama serve' and the "
+ "model is downloaded.",
+ }
+
+
+def test_worker_message_with_private_suffix_keeps_masking_and_precedence() -> (
+ None
+):
+ private_detail = "/srv/private/provider-internals.txt"
+ metadata = {
+ "phase": "error",
+ "error": "Required Ollama model not found. Please pull the model first. "
+ + private_detail,
+ "solution": "Run 'ollama pull mistral' to download the required model.",
+ "settings_snapshot": {"private_path": private_detail},
+ }
+
+ response = _call_status(metadata)
+
+ assert private_detail not in json.dumps(response, default=str)
+ assert "settings_snapshot" not in response["metadata"]
+ assert response["metadata"]["error"] == (
+ "Research failed. Check the server logs for details."
+ )
+ assert _error_info(response) == {
+ "type": "ollama_error",
+ "message": "The Ollama service is not responding properly.",
+ "suggestion": "Make sure Ollama is running with 'ollama serve' and the "
+ "model is downloaded.",
+ }
+
+
class TestMatchOrderIsLoadBearing:
"""Overlapping error texts must resolve to the earlier arm.