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: only show server_config.json warning when file has non-default values (#2655)

LearningCircuit3bfb43096e50
diff --git a/src/local_deep_research/web/warning_checks/hardware.py b/src/local_deep_research/web/warning_checks/hardware.py
index 2910a3935c..df8393e4fa 100644
--- a/src/local_deep_research/web/warning_checks/hardware.py
+++ b/src/local_deep_research/web/warning_checks/hardware.py
@@ -62,12 +62,44 @@ def check_model_mismatch(
def check_legacy_server_config(dismissed: bool) -> Optional[dict]:
- """Return a warning if the deprecated server_config.json file exists."""
- from ..server_config import get_server_config_path
+ """Return a warning only if server_config.json has non-default values."""
+ from ..server_config import (
+ _DEFAULTS,
+ _LEGACY_KEY_MAP,
+ get_server_config_path,
+ )
if dismissed:
return None
- if not get_server_config_path().exists():
+
+ config_path = get_server_config_path()
+ if not config_path.exists():
+ return None
+
+ # Load and compare against defaults — only warn if user customized something
+ import json
+
+ try:
+ data = json.loads(config_path.read_text(encoding="utf-8-sig"))
+ except (json.JSONDecodeError, OSError):
+ return None
+
+ if not isinstance(data, dict):
+ return None
+
+ has_customization = False
+ for json_key in _LEGACY_KEY_MAP:
+ if json_key in data and data[json_key] != _DEFAULTS.get(json_key):
+ has_customization = True
+ break
+
+ # Also flag unrecognized keys as customizations
+ if not has_customization:
+ unrecognized = set(data.keys()) - set(_LEGACY_KEY_MAP.keys())
+ if unrecognized:
+ has_customization = True
+
+ if not has_customization:
return None
return {
@@ -75,9 +107,9 @@ def check_legacy_server_config(dismissed: bool) -> Optional[dict]:
"icon": "ℹ️",
"title": "server_config.json Detected",
"message": (
- "A server_config.json file was found. Environment variables are "
- "the preferred configuration method. See the documentation for "
- "migration details."
+ "A server_config.json file was found with non-default settings. "
+ "Environment variables are the preferred configuration method. "
+ "See the documentation for migration details."
),
"dismissKey": "app.warnings.dismiss_legacy_config",
}
diff --git a/tests/web/warning_checks/test_hardware.py b/tests/web/warning_checks/test_hardware.py
index cd7f0dff76..95c00df1b3 100644
--- a/tests/web/warning_checks/test_hardware.py
+++ b/tests/web/warning_checks/test_hardware.py
@@ -173,7 +173,7 @@ class TestCheckLegacyServerConfig:
def test_no_warning_when_dismissed(self, tmp_path):
config_file = tmp_path / "server_config.json"
- config_file.write_text("{}", encoding="utf-8")
+ config_file.write_text('{"port": 9999}', encoding="utf-8")
with patch(
"local_deep_research.web.server_config.get_server_config_path",
return_value=config_file,
@@ -188,9 +188,34 @@ class TestCheckLegacyServerConfig:
):
assert check_legacy_server_config(dismissed=False) is None
- def test_warns_when_file_exists(self, tmp_path):
+ def test_no_warning_when_all_defaults(self, tmp_path):
+ """File exists but all values match defaults — no warning."""
+ import json
+
+ from local_deep_research.web.server_config import _DEFAULTS
+
+ config_file = tmp_path / "server_config.json"
+ config_file.write_text(json.dumps(_DEFAULTS), encoding="utf-8")
+ with patch(
+ "local_deep_research.web.server_config.get_server_config_path",
+ return_value=config_file,
+ ):
+ assert check_legacy_server_config(dismissed=False) is None
+
+ def test_no_warning_when_empty_object(self, tmp_path):
+ """Empty JSON object has no customizations — no warning."""
config_file = tmp_path / "server_config.json"
config_file.write_text("{}", encoding="utf-8")
+ with patch(
+ "local_deep_research.web.server_config.get_server_config_path",
+ return_value=config_file,
+ ):
+ assert check_legacy_server_config(dismissed=False) is None
+
+ def test_warns_when_non_default_value(self, tmp_path):
+ """File has a customized value — should warn."""
+ config_file = tmp_path / "server_config.json"
+ config_file.write_text('{"port": 9999}', encoding="utf-8")
with patch(
"local_deep_research.web.server_config.get_server_config_path",
return_value=config_file,
@@ -206,3 +231,35 @@ class TestCheckLegacyServerConfig:
"message",
"dismissKey",
}
+
+ def test_warns_when_unrecognized_keys(self, tmp_path):
+ """File has unrecognized keys — should warn."""
+ config_file = tmp_path / "server_config.json"
+ config_file.write_text('{"custom_thing": true}', encoding="utf-8")
+ with patch(
+ "local_deep_research.web.server_config.get_server_config_path",
+ return_value=config_file,
+ ):
+ result = check_legacy_server_config(dismissed=False)
+ assert result is not None
+ assert result["type"] == "legacy_server_config"
+
+ def test_no_warning_on_malformed_json(self, tmp_path):
+ """Malformed JSON should not crash — just return None."""
+ config_file = tmp_path / "server_config.json"
+ config_file.write_text("not valid json", encoding="utf-8")
+ with patch(
+ "local_deep_research.web.server_config.get_server_config_path",
+ return_value=config_file,
+ ):
+ assert check_legacy_server_config(dismissed=False) is None
+
+ def test_no_warning_on_non_dict_json(self, tmp_path):
+ """JSON array instead of object should not crash — just return None."""
+ config_file = tmp_path / "server_config.json"
+ config_file.write_text("[1, 2, 3]", encoding="utf-8")
+ with patch(
+ "local_deep_research.web.server_config.get_server_config_path",
+ return_value=config_file,
+ ):
+ assert check_legacy_server_config(dismissed=False) is None