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: normalize full_search_module paths and remove dead serpapi references (#2826)

LearningCircuit7d37d35b2fdf
diff --git a/.pre-commit-hooks/check-absolute-module-paths.py b/.pre-commit-hooks/check-absolute-module-paths.py
index 6aeadcc0c6..f7b9f8ee9b 100755
--- a/.pre-commit-hooks/check-absolute-module-paths.py
+++ b/.pre-commit-hooks/check-absolute-module-paths.py
@@ -156,7 +156,9 @@ def check_json_file(filename: str) -> bool:
for key, value in obj.items():
current_path = f"{path}.{key}" if path else key
# Only check values under module_path keys
- if key == "module_path" and isinstance(value, str):
+ if key in ("module_path", "full_search_module") and isinstance(
+ value, str
+ ):
if (
value.startswith(ABSOLUTE_BASE + ".")
and value not in LEGITIMATE_ABSOLUTE_REFS
diff --git a/docs/CONFIGURATION.md b/docs/CONFIGURATION.md
index 533ed0f512..4d58160096 100644
--- a/docs/CONFIGURATION.md
+++ b/docs/CONFIGURATION.md
@@ -454,8 +454,8 @@ They are not available in the Web UI because they are needed to start the applic
| `search.engine.web.serpapi.default_params.time_period` | `LDR_SEARCH_ENGINE_WEB_SERPAPI_DEFAULT_PARAMS_TIME_PERIOD` | `y` | Time filter for results: 'd' (day), 'w' (week), 'm' (month), 'y' (year), or empty for all time. | SEARCH |
| `search.engine.web.serpapi.description` | `LDR_SEARCH_ENGINE_WEB_SERPAPI_DESCRIPTION` | `Search the web with Google's search API.` | Human-readable description of the search engine. | SEARCH |
| `search.engine.web.serpapi.display_name` | `LDR_SEARCH_ENGINE_WEB_SERPAPI_DISPLAY_NAME` | `SerpApi` | Display name to use in the U.I. for this search engine. | SEARCH |
-| `search.engine.web.serpapi.full_search_class` | `LDR_SEARCH_ENGINE_WEB_SERPAPI_FULL_SEARCH_CLASS` | `FullSerpAPISearchResults` | Internal: Class used for full-text content retrieval after initial search. Do not modify. | SEARCH |
-| `search.engine.web.serpapi.full_search_module` | `LDR_SEARCH_ENGINE_WEB_SERPAPI_FULL_SEARCH_MODULE` | `.engines.full_serp_search_results_old` | Internal: Python module path for full search functionality. Do not modify. | SEARCH |
+| `search.engine.web.serpapi.full_search_class` | `LDR_SEARCH_ENGINE_WEB_SERPAPI_FULL_SEARCH_CLASS` | `FullSearchResults` | Internal: Class used for full-text content retrieval after initial search. Do not modify. | SEARCH |
+| `search.engine.web.serpapi.full_search_module` | `LDR_SEARCH_ENGINE_WEB_SERPAPI_FULL_SEARCH_MODULE` | `.engines.full_search` | Internal: Python module path for full search functionality. Do not modify. | SEARCH |
| `search.engine.web.serpapi.module_path` | `LDR_SEARCH_ENGINE_WEB_SERPAPI_MODULE_PATH` | `.engines.search_engine_serpapi` | Internal: Python module path for this search engine implementation. Do not modify. | SEARCH |
| `search.engine.web.serpapi.reliability` | `LDR_SEARCH_ENGINE_WEB_SERPAPI_RELIABILITY` | `0.6` | Reliability score (0-1). SerpAPI rated moderate (0.6) - good for general search but less authoritative than specialized sources. | SEARCH |
| `search.engine.web.serpapi.requires_api_key` | `LDR_SEARCH_ENGINE_WEB_SERPAPI_REQUIRES_API_KEY` | `true` | Indicates this engine requires a SerpAPI key. Get one at serpapi.com. | SEARCH |
diff --git a/src/local_deep_research/defaults/default_settings.json b/src/local_deep_research/defaults/default_settings.json
index cb20aa2d88..d0e2d6027d 100644
--- a/src/local_deep_research/defaults/default_settings.json
+++ b/src/local_deep_research/defaults/default_settings.json
@@ -3126,7 +3126,7 @@
"step": null,
"type": "SEARCH",
"ui_element": "text",
- "value": "FullSerpAPISearchResults",
+ "value": "FullSearchResults",
"visible": true
},
"search.engine.web.serpapi.full_search_module": {
@@ -3140,7 +3140,7 @@
"step": null,
"type": "SEARCH",
"ui_element": "text",
- "value": ".engines.full_serp_search_results_old",
+ "value": ".engines.full_search",
"visible": true
},
"search.engine.web.serpapi.module_path": {
diff --git a/src/local_deep_research/security/module_whitelist.py b/src/local_deep_research/security/module_whitelist.py
index a65792c3b7..e049846fcd 100644
--- a/src/local_deep_research/security/module_whitelist.py
+++ b/src/local_deep_research/security/module_whitelist.py
@@ -28,7 +28,6 @@ ALLOWED_MODULE_PATHS: frozenset[str] = frozenset(
# Relative imports only (relative to local_deep_research.web_search_engines)
# Absolute paths are NOT allowed for security reasons
".engines.full_search",
- ".engines.full_serp_search_results_old",
".engines.meta_search_engine",
".engines.parallel_search_engine",
".engines.search_engine_arxiv",
@@ -205,7 +204,11 @@ def get_safe_module_class(
# instead of the required relative form ".engines.search_engine_X".
_ABSOLUTE_PREFIX = "local_deep_research.web_search_engines"
if module_path and module_path.startswith(_ABSOLUTE_PREFIX):
+ original = module_path
module_path = module_path[len(_ABSOLUTE_PREFIX) :]
+ logger.debug(
+ f"Normalized absolute module path to relative form: {original!r} -> {module_path!r}"
+ )
# Validate both module path and class name against whitelists
if not validate_module_import(module_path, class_name):
diff --git a/src/local_deep_research/web_search_engines/search_engines_config.py b/src/local_deep_research/web_search_engines/search_engines_config.py
index 4234495f80..e2df935951 100644
--- a/src/local_deep_research/web_search_engines/search_engines_config.py
+++ b/src/local_deep_research/web_search_engines/search_engines_config.py
@@ -122,9 +122,10 @@ def search_config(
_ABSOLUTE_PREFIX = "local_deep_research.web_search_engines"
for engine_data in search_engines.values():
if isinstance(engine_data, dict):
- mp = engine_data.get("module_path")
- if isinstance(mp, str) and mp.startswith(_ABSOLUTE_PREFIX):
- engine_data["module_path"] = mp[len(_ABSOLUTE_PREFIX) :]
+ for key in ("module_path", "full_search_module"):
+ mp = engine_data.get(key)
+ if isinstance(mp, str) and mp.startswith(_ABSOLUTE_PREFIX):
+ engine_data[key] = mp[len(_ABSOLUTE_PREFIX) :]
search_engines["auto"] = _get_setting(
"search.engine.auto",
diff --git a/tests/security/test_absolute_module_paths_hook.py b/tests/security/test_absolute_module_paths_hook.py
index e29735801a..fefdb321cc 100644
--- a/tests/security/test_absolute_module_paths_hook.py
+++ b/tests/security/test_absolute_module_paths_hook.py
@@ -324,6 +324,32 @@ class TestCheckJsonFile:
)
assert hook_module.check_json_file(str(legit)) is True
+ def test_absolute_full_search_module_in_json_fails(self, tmp_path):
+ """A JSON file with absolute full_search_module should fail."""
+ bad = tmp_path / "bad_full_search.json"
+ bad.write_text(
+ json.dumps(
+ {
+ "full_search_module": "local_deep_research.web_search_engines.engines.full_search",
+ "full_search_class": "FullSearchResults",
+ }
+ )
+ )
+ assert hook_module.check_json_file(str(bad)) is False
+
+ def test_relative_full_search_module_in_json_passes(self, tmp_path):
+ """A JSON file with relative full_search_module should pass."""
+ ok = tmp_path / "ok_full_search.json"
+ ok.write_text(
+ json.dumps(
+ {
+ "full_search_module": ".engines.full_search",
+ "full_search_class": "FullSearchResults",
+ }
+ )
+ )
+ assert hook_module.check_json_file(str(ok)) is True
+
def test_module_path_in_list_of_dicts(self, tmp_path):
"""Should detect absolute paths in lists of engine configs."""
bad = tmp_path / "engines_list.json"
diff --git a/tests/settings/golden_master_settings.json b/tests/settings/golden_master_settings.json
index 848a05c8bf..3dc9248d66 100644
--- a/tests/settings/golden_master_settings.json
+++ b/tests/settings/golden_master_settings.json
@@ -6183,7 +6183,7 @@
"step": null,
"type": "SEARCH",
"ui_element": "text",
- "value": "FullSerpAPISearchResults",
+ "value": "FullSearchResults",
"visible": true
},
"search.engine.web.serpapi.full_search_module": {
@@ -6197,7 +6197,7 @@
"step": null,
"type": "SEARCH",
"ui_element": "text",
- "value": ".engines.full_serp_search_results_old",
+ "value": ".engines.full_search",
"visible": true
},
"search.engine.web.serpapi.module_path": {