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.

Add debug output to failing API tests to diagnose CI failures

LearningCircuitb7eb99ecc40e
diff --git a/src/local_deep_research/web/api.py b/src/local_deep_research/web/api.py
index 79a1d36552..bb2bd59317 100644
--- a/src/local_deep_research/web/api.py
+++ b/src/local_deep_research/web/api.py
@@ -184,13 +184,18 @@ def api_quick_summary():
"temperature": 0.7 # Optional: LLM temperature
}
"""
+ logger.debug("API quick_summary endpoint called")
data = request.json
+ logger.debug(f"Request data: {data}")
+
if not data or "query" not in data:
+ logger.debug("Missing query parameter")
return jsonify({"error": "Query parameter is required"}), 400
# Extract query and optional parameters
query = data.get("query")
params = {k: v for k, v in data.items() if k != "query"}
+ logger.debug(f"Query: {query}, params: {params}")
# Get username from session or g object
from flask import g, session
diff --git a/tests/api_tests/test_api_basic.py b/tests/api_tests/test_api_basic.py
index 90d262c87b..7e149ddc7b 100644
--- a/tests/api_tests/test_api_basic.py
+++ b/tests/api_tests/test_api_basic.py
@@ -58,6 +58,10 @@ class TestBasicAPI:
"temperature": 0.7,
}
+ print(
+ f"\n[DEBUG] Sending request to /api/v1/quick_summary with payload: {payload}"
+ )
+
# Send request with proper format
response = authenticated_client.post(
"/api/v1/quick_summary",
@@ -65,6 +69,19 @@ class TestBasicAPI:
content_type="application/json",
)
+ print(f"[DEBUG] Response status code: {response.status_code}")
+ print(
+ f"[DEBUG] Response data: {response.data.decode()[:500]}"
+ ) # First 500 chars
+
+ if response.status_code == 500:
+ # Print full error details for debugging
+ try:
+ error_data = json.loads(response.data)
+ print(f"[DEBUG] Error response JSON: {error_data}")
+ except:
+ print(f"[DEBUG] Raw error response: {response.data.decode()}")
+
# The API should accept the request format
# It might return 200 with processing started, or 400 if there's a validation error
assert response.status_code in [200, 202, 400]
diff --git a/tests/api_tests/test_comprehensive_apis.py b/tests/api_tests/test_comprehensive_apis.py
index b75a6add01..6884b68c14 100644
--- a/tests/api_tests/test_comprehensive_apis.py
+++ b/tests/api_tests/test_comprehensive_apis.py
@@ -52,9 +52,14 @@ class TestComprehensiveAPIs:
assert "types" in data
# Get available models
+ print("\n[DEBUG] Testing /settings/api/available-models")
response = authenticated_client.get("/settings/api/available-models")
+ print(f"[DEBUG] Response status: {response.status_code}")
assert response.status_code == 200
data = json.loads(response.data)
+ print(f"[DEBUG] Response keys: {list(data.keys())}")
+ if "models" not in data:
+ print(f"[DEBUG] Full response: {data}")
assert "models" in data
# Get available search engines
diff --git a/tests/api_tests/test_research_creation.py b/tests/api_tests/test_research_creation.py
index 0dd9bf9096..71f2a9e137 100644
--- a/tests/api_tests/test_research_creation.py
+++ b/tests/api_tests/test_research_creation.py
@@ -52,12 +52,17 @@ class TestResearchCreation:
"mode": "quick",
}
+ print(f"\n[DEBUG] Sending minimal research request: {research_data}")
response = authenticated_client.post(
"/api/start_research",
json=research_data,
content_type="application/json",
)
+ print(f"[DEBUG] Response status: {response.status_code}")
+ if response.status_code != 200:
+ print(f"[DEBUG] Response data: {response.data.decode()[:500]}")
+
assert response.status_code == 200
data = json.loads(response.data)
assert "research_id" in data or (
diff --git a/tests/api_tests/test_simple_auth.py b/tests/api_tests/test_simple_auth.py
index 179a1681e8..60ebccbfa4 100644
--- a/tests/api_tests/test_simple_auth.py
+++ b/tests/api_tests/test_simple_auth.py
@@ -100,9 +100,16 @@ class TestSimpleAuth:
assert data["authenticated"] is True
# Logout
+ print("\n[DEBUG] Testing logout endpoint with GET method")
response = authenticated_client.get(
"/auth/logout", follow_redirects=True
)
+ print(f"[DEBUG] Logout response status: {response.status_code}")
+ print(f"[DEBUG] Logout response headers: {dict(response.headers)}")
+ if response.status_code != 200:
+ print(
+ f"[DEBUG] Logout response data: {response.data.decode()[:500]}"
+ )
assert response.status_code == 200
# Check we're no longer authenticated