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.

refactor: decouple rate limiting from CI environment detection

LearningCircuit1d78bcf200e7
diff --git a/.github/workflows/api-tests.yml b/.github/workflows/api-tests.yml
index a53de56192..70551b238e 100644
--- a/.github/workflows/api-tests.yml
+++ b/.github/workflows/api-tests.yml
@@ -67,6 +67,7 @@ jobs:
- name: Start server for API unit tests
run: |
export LDR_USE_FALLBACK_LLM=true
+ export DISABLE_RATE_LIMITING=true
export PYTHONPATH=$PWD/src:$PYTHONPATH
echo "Starting server for API unit tests..."
pdm run python -m local_deep_research.web.app 2>&1 | tee server.log &
@@ -146,6 +147,7 @@ jobs:
# Try running the server directly with Python to see the error
echo "Attempting direct Python startup..."
+ export DISABLE_RATE_LIMITING=true
pdm run python -m local_deep_research.web.app 2>&1 | tee server_direct.log &
DIRECT_PID=$!
sleep 2
diff --git a/.github/workflows/critical-ui-tests.yml b/.github/workflows/critical-ui-tests.yml
index 7e61a31776..7dab56eb99 100644
--- a/.github/workflows/critical-ui-tests.yml
+++ b/.github/workflows/critical-ui-tests.yml
@@ -87,7 +87,7 @@ jobs:
env:
FLASK_ENV: testing
TEST_ENV: true
- CI: true
+ DISABLE_RATE_LIMITING: true
SECRET_KEY: test-secret-key-for-ci
run: |
mkdir -p data/encrypted_databases
diff --git a/.github/workflows/extended-ui-tests.yml b/.github/workflows/extended-ui-tests.yml
index 51b11abd18..5384db081f 100644
--- a/.github/workflows/extended-ui-tests.yml
+++ b/.github/workflows/extended-ui-tests.yml
@@ -59,7 +59,7 @@ jobs:
- name: Start server
run: |
export LDR_USE_FALLBACK_LLM=true
- export CI=true
+ export DISABLE_RATE_LIMITING=true
export PYTHONPATH=$PWD/src:$PYTHONPATH
pdm run python -m local_deep_research.web.app &
echo $! > server.pid
diff --git a/.github/workflows/ui-tests.yml b/.github/workflows/ui-tests.yml
index 3c2f36b6a1..7c8b08c8a2 100644
--- a/.github/workflows/ui-tests.yml
+++ b/.github/workflows/ui-tests.yml
@@ -66,7 +66,7 @@ jobs:
- name: Start application server
run: |
export LDR_USE_FALLBACK_LLM=true
- export CI=true
+ export DISABLE_RATE_LIMITING=true
export PYTHONPATH=$PWD/src:$PYTHONPATH
echo "Starting web server..."
pdm run python -m local_deep_research.web.app 2>&1 | tee server.log &
diff --git a/src/local_deep_research/settings/env_registry.py b/src/local_deep_research/settings/env_registry.py
index 7cadfbffff..d1d5c41818 100644
--- a/src/local_deep_research/settings/env_registry.py
+++ b/src/local_deep_research/settings/env_registry.py
@@ -79,31 +79,23 @@ def is_rate_limiting_enabled() -> bool:
True if rate limiting should be enabled, False otherwise
Logic:
- - If ENABLE_RATE_LIMITING=true, always enable (even in CI)
- - If in CI without the flag, disable
- - If not in CI, enable
+ - If DISABLE_RATE_LIMITING=true, disable rate limiting
+ - Otherwise, enable rate limiting (default)
+
+ Note:
+ This function intentionally does NOT check CI environment.
+ Rate limiting control should be explicit via the dedicated flag.
"""
import os
from loguru import logger
- enable_flag = os.environ.get("ENABLE_RATE_LIMITING", "").lower()
- ci_env = os.environ.get("CI", "false").lower()
-
- # Debug logging to understand what's happening
- logger.debug(
- f"Rate limiting check: CI={ci_env}, ENABLE_RATE_LIMITING={enable_flag}"
- )
-
- if enable_flag == "true":
- logger.debug("Rate limiting ENABLED due to ENABLE_RATE_LIMITING=true")
- return True
+ disable_flag = os.environ.get("DISABLE_RATE_LIMITING", "").lower()
- is_ci = ci_env in ("true", "1", "yes")
- if is_ci:
- logger.debug("Rate limiting DISABLED due to CI environment")
+ if disable_flag in ("true", "1", "yes"):
+ logger.debug("Rate limiting DISABLED due to DISABLE_RATE_LIMITING=true")
return False
- logger.debug("Rate limiting ENABLED (not in CI)")
+ logger.debug("Rate limiting ENABLED (default)")
return True