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: address AI reviewer feedback

LearningCircuit896aa3f618ec
diff --git a/src/local_deep_research/benchmarks/web_api/benchmark_service.py b/src/local_deep_research/benchmarks/web_api/benchmark_service.py
index f238691268..e7d62bfa42 100644
--- a/src/local_deep_research/benchmarks/web_api/benchmark_service.py
+++ b/src/local_deep_research/benchmarks/web_api/benchmark_service.py
@@ -271,10 +271,8 @@ class BenchmarkService:
def _run_benchmark_thread(self, benchmark_run_id: int):
"""Main benchmark execution thread."""
# IMPORTANT: This runs in a background thread, so we cannot access the user database
- # Memory queue has been removed as part of queue consolidation (issue #596)
- # Benchmark tracking will need to be updated to use the new queue system
- # For now, we'll skip queue tracking in benchmarks
- memory_tracker = None
+ # TODO: Queue tracking for benchmarks needs to be re-implemented with the new queue system
+ # See issue #596 for queue consolidation details
try:
# Get the benchmark data that was passed to us
@@ -325,7 +323,6 @@ class BenchmarkService:
set_settings_context(settings_context)
# Extract all the data we need
- config_hash = benchmark_data["config_hash"]
datasets_config = benchmark_data["datasets_config"]
search_config = benchmark_data["search_config"]
evaluation_config = benchmark_data["evaluation_config"]
@@ -342,21 +339,6 @@ class BenchmarkService:
total_examples = len(task_queue) + len(existing_results)
completed_examples = len(existing_results)
- # Update task metadata in memory tracker
- # Use a unique task ID to avoid conflicts
- task_id = f"benchmark_{benchmark_run_id}_{int(datetime.now(UTC).timestamp())}"
- # Queue tracking temporarily disabled (memory_queue removed)
- if memory_tracker:
- memory_tracker.add_task(
- task_id=task_id,
- username=benchmark_data.get("username", "benchmark_user"),
- task_type="benchmark",
- )
-
- # Update status to processing
- if memory_tracker:
- memory_tracker.update_task_status(task_id, "processing")
-
# Track progress in memory
progress_info = {
"total_examples": total_examples,
@@ -453,13 +435,9 @@ class BenchmarkService:
)
if was_cancelled:
- if memory_tracker:
- memory_tracker.update_task_status(task_id, "cancelled")
status = BenchmarkStatus.CANCELLED
message = "Benchmark cancelled by user"
else:
- if memory_tracker:
- memory_tracker.update_task_status(task_id, "completed")
status = BenchmarkStatus.COMPLETED
message = "Benchmark completed successfully"
@@ -491,15 +469,6 @@ class BenchmarkService:
except Exception as e:
logger.exception(f"Benchmark run {benchmark_run_id} failed")
- # Update memory tracker
- try:
- if "task_id" in locals():
- if memory_tracker:
- memory_tracker.update_task_status(task_id, "failed")
- except Exception:
- logger.exception(
- "Failed to update task status in memory tracker"
- )
# Store failure info for later database update
if benchmark_run_id in self.active_runs:
self.active_runs[benchmark_run_id]["completion_info"] = {
diff --git a/src/local_deep_research/web/queue/processor_v2.py b/src/local_deep_research/web/queue/processor_v2.py
index 0cadb8147c..9f0b063873 100644
--- a/src/local_deep_research/web/queue/processor_v2.py
+++ b/src/local_deep_research/web/queue/processor_v2.py
@@ -336,8 +336,8 @@ class QueueProcessorV2:
logger.exception(
f"Error processing queue for {user_session}"
)
- # On error, remove the user to avoid infinite loops
- users_to_remove.append(user_session)
+ # Don't remove on error - the _process_user_queue method
+ # determines whether to keep checking based on error type
# Only remove users whose queues are now empty
with self._users_lock:
@@ -368,7 +368,7 @@ class QueueProcessorV2:
logger.debug(
f"No password available for user {username}, skipping queue check"
)
- return True # Remove from checking
+ return True # Remove from checking - session expired
# Open the user's encrypted database
try:
@@ -376,7 +376,7 @@ class QueueProcessorV2:
engine = db_manager.open_user_database(username, password)
if not engine:
logger.error(f"Failed to open database for user {username}")
- return True # Remove from checking
+ return False # Keep checking - could be temporary DB issue
# Get a session and process the queue
with get_user_db_session(username) as db_session:
@@ -433,7 +433,7 @@ class QueueProcessorV2:
except Exception:
logger.exception(f"Error processing queue for user {username}")
- return True # Remove from checking on error
+ return False # Keep checking - errors might be temporary
def _start_queued_researches(
self,
@@ -625,9 +625,6 @@ class QueueProcessorV2:
# In processor_v2, we can update directly if we have database access
# or queue it for later processing
operation_id = str(uuid.uuid4())
- if not hasattr(self, "pending_operations"):
- self.pending_operations = {}
-
self.pending_operations[operation_id] = {
"username": username,
"operation_type": "progress_update",
@@ -663,9 +660,6 @@ class QueueProcessorV2:
report_path: Optional path to error report
"""
operation_id = str(uuid.uuid4())
- if not hasattr(self, "pending_operations"):
- self.pending_operations = {}
-
self.pending_operations[operation_id] = {
"username": username,
"operation_type": "error_update",
@@ -696,9 +690,6 @@ class QueueProcessorV2:
Returns:
Number of operations processed
"""
- if not hasattr(self, "pending_operations"):
- return 0
-
# Find pending operations for this user
operations_to_process = []
for op_id, op_data in list(self.pending_operations.items()):