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: minor robustness improvements from PR #2595 review (#2618)

LearningCircuit24fe20a2dc95
diff --git a/src/local_deep_research/security/file_integrity/integrity_manager.py b/src/local_deep_research/security/file_integrity/integrity_manager.py
index d756f55010..2843a9e12f 100644
--- a/src/local_deep_research/security/file_integrity/integrity_manager.py
+++ b/src/local_deep_research/security/file_integrity/integrity_manager.py
@@ -194,33 +194,23 @@ class FileIntegrityManager:
"""
normalized_path = self._normalize_path(file_path)
- # First check if record exists
with get_user_db_session(self.username, self.password) as session:
record = (
session.query(FileIntegrityRecord)
.filter_by(file_path=normalized_path)
.first()
)
- has_record = record is not None
- if not has_record:
- logger.warning(
- f"[FILE_INTEGRITY] No record found for {file_path}, creating one"
- )
- try:
- self.record_file(file_path)
- return True, None
- except Exception as e:
- logger.exception("[FILE_INTEGRITY] Failed to create record")
- return False, f"Failed to create integrity record: {str(e)}"
-
- # Re-enter context for verification
- with get_user_db_session(self.username, self.password) as session:
- record = (
- session.query(FileIntegrityRecord)
- .filter_by(file_path=normalized_path)
- .first()
- )
+ if not record:
+ logger.warning(
+ f"[FILE_INTEGRITY] No record found for {file_path}, creating one"
+ )
+ try:
+ self.record_file(file_path)
+ return True, None
+ except Exception as e:
+ logger.exception("[FILE_INTEGRITY] Failed to create record")
+ return False, f"Failed to create integrity record: {str(e)}"
# Check if verification needed
if not force and not self._needs_verification(record, file_path):
diff --git a/src/local_deep_research/utilities/search_cache.py b/src/local_deep_research/utilities/search_cache.py
index 97b71e17a0..13ffd08be2 100644
--- a/src/local_deep_research/utilities/search_cache.py
+++ b/src/local_deep_research/utilities/search_cache.py
@@ -503,13 +503,16 @@ class SearchCache:
# Global cache instance
_global_cache = None
+_global_cache_lock = threading.Lock()
def get_search_cache() -> SearchCache:
"""Get global search cache instance."""
global _global_cache
if _global_cache is None:
- _global_cache = SearchCache()
+ with _global_cache_lock:
+ if _global_cache is None:
+ _global_cache = SearchCache()
return _global_cache
diff --git a/src/local_deep_research/web/queue/manager.py b/src/local_deep_research/web/queue/manager.py
index 9807b326bd..d09e17454b 100644
--- a/src/local_deep_research/web/queue/manager.py
+++ b/src/local_deep_research/web/queue/manager.py
@@ -71,7 +71,10 @@ class QueueManager:
# Notify queue processor about the new queued research
# Note: When using QueueManager, we don't have all parameters for direct execution
# So it will fall back to queue mode
- queue_processor.notify_research_queued(username, research_id)
+ try:
+ queue_processor.notify_research_queued(username, research_id)
+ except Exception as e:
+ logger.debug(f"Failed to notify queue processor: {e}")
return max_position + 1