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.

ci: run the main pytest step as two passes to stay under runner memory (#7758)

LearningCircuita8e6f33f2f6a
diff --git a/.github/workflows/docker-tests.yml b/.github/workflows/docker-tests.yml
index 91ad888019..509be06746 100644
--- a/.github/workflows/docker-tests.yml
+++ b/.github/workflows/docker-tests.yml
@@ -286,40 +286,68 @@ jobs:
# - `-t` allocates a pty so docker treats stdout as line-buffered
# Without this combination, hangs are invisible — the runner shows
# zero output until the timeout-minutes backstop kills the job.
- docker run --rm -t \
- -v "$PWD":/app \
- -e CI=true \
- -e GITHUB_ACTIONS=true \
- -e LDR_TESTING_WITH_MOCKS=true \
- -e LDR_DISABLE_RATE_LIMITING=true \
- -e PYTHONUNBUFFERED=1 \
- -e LDR_NEWS_SCHEDULER_ENABLED=false \
- -e PYTHONPATH=/app/src \
- -e REQUIRE_GITLEAKS=1 \
- -e GITLEAKS_PATH=/app/.ci-gitleaks-bin/gitleaks \
- -e OPENROUTER_API_KEY="${OPENROUTER_API_KEY}" \
- -w /app \
- ${{ env.TEST_IMAGE }} \
- sh -c "git config --global --add safe.directory /app && \
- git merge-base origin/main HEAD >/dev/null && \
- python -m pytest tests/ \
- --cov=src \
- --cov-report=xml:coverage/coverage.xml \
- --cov-report=html:coverage/htmlcov \
- --junitxml=coverage/pytest.xml \
- --cov-fail-under=50 \
- --tb=short \
- --no-header \
- --color=no \
- -v \
- --durations=20 \
- -o faulthandler_timeout=60 \
- -n auto \
- -m 'not integration and not fd_canary and not serial and not nonroot' \
- --ignore=tests/ui_tests \
- --ignore=tests/infrastructure_tests \
- --ignore=tests/api_tests_with_login \
- --ignore=tests/fuzz"
+ #
+ # The suite runs as two passes, each in a fresh container with fresh
+ # xdist workers. Worker RSS grows over the tests it runs (caches,
+ # allocator fragmentation; ~1 GB per ~2,500 tests measured locally),
+ # and one pass over the whole tree let the two workers of a hosted
+ # runner reach the memory ceiling: both were killed at the same
+ # instant ("node down: Not properly terminated"), or the run froze
+ # at 97% until the job timeout. Splitting halves what each worker
+ # accumulates without changing what runs. Pass 1 writes only the
+ # .coverage data file, with no fail-under gate on that partial data;
+ # pass 2 appends to it and emits the reports and the fail-under gate
+ # over the combined data. Both passes always run, and the step fails
+ # if either does.
+ PASS2_DIRS="tests/security tests/web tests/news tests/research_library"
+ run_pass() {
+ docker run --rm -t \
+ -v "$PWD":/app \
+ -e CI=true \
+ -e GITHUB_ACTIONS=true \
+ -e LDR_TESTING_WITH_MOCKS=true \
+ -e LDR_DISABLE_RATE_LIMITING=true \
+ -e PYTHONUNBUFFERED=1 \
+ -e LDR_NEWS_SCHEDULER_ENABLED=false \
+ -e PYTHONPATH=/app/src \
+ -e REQUIRE_GITLEAKS=1 \
+ -e GITLEAKS_PATH=/app/.ci-gitleaks-bin/gitleaks \
+ -e OPENROUTER_API_KEY="${OPENROUTER_API_KEY}" \
+ -w /app \
+ ${{ env.TEST_IMAGE }} \
+ sh -c "git config --global --add safe.directory /app && \
+ git merge-base origin/main HEAD >/dev/null && \
+ python -m pytest $1 \
+ --cov=src \
+ $2 \
+ --tb=short \
+ --no-header \
+ --color=no \
+ -v \
+ --durations=20 \
+ -o faulthandler_timeout=60 \
+ -n auto \
+ -m 'not integration and not fd_canary and not serial and not nonroot' \
+ --ignore=tests/ui_tests \
+ --ignore=tests/infrastructure_tests \
+ --ignore=tests/api_tests_with_login \
+ --ignore=tests/fuzz"
+ }
+ PASS1_IGNORES=""
+ for d in $PASS2_DIRS; do PASS1_IGNORES="$PASS1_IGNORES --ignore=$d"; done
+ rm -f .coverage
+ rc1=0
+ run_pass "tests/ $PASS1_IGNORES" \
+ "--cov-report= --cov-fail-under=0 --junitxml=coverage/pytest-pass1.xml" || rc1=$?
+ rc2=0
+ run_pass "$PASS2_DIRS" \
+ "--cov-append \
+ --cov-report=xml:coverage/coverage.xml \
+ --cov-report=html:coverage/htmlcov \
+ --junitxml=coverage/pytest.xml \
+ --cov-fail-under=50" || rc2=$?
+ echo "pass 1 exit: $rc1, pass 2 exit: $rc2"
+ [ "$rc1" -eq 0 ] && [ "$rc2" -eq 0 ]
# fd_canary tests (#3816 FD-leak guards) are CPU-bound real-event-loop
# spins. Under coverage tracing + '-n auto' contention they exceeded the