~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.
Python academiaanthropicarxivbravedeep-researchencryptionhome-automationhomeserverlocallocal-deep-researchlocal-llmmistralollamaopenaipubmedresearchresearch-toolretrieval-augmented-generationsearxngself-hosted
ci(ui-tests): add per-shard retry with fresh server per attempt (#3628)
LearningCircuit2425c87d88a0
diff --git a/.github/workflows/docker-tests.yml b/.github/workflows/docker-tests.ymlindex b8c4695ffa..093405dfd9 100644--- a/.github/workflows/docker-tests.yml+++ b/.github/workflows/docker-tests.yml@@ -484,7 +484,10 @@ jobs:name: UI Tests (Puppeteer) [${{ matrix.shard }}]needs: build-test-imageif: ${{ inputs.strict-mode == true }}- timeout-minutes: 25+ # 3 attempts × 12-min per-attempt cap + cleanup + outer setup steps =+ # ~40 min absolute worst case. 45 gives the retry wrapper room to capture+ # final logs even if every attempt hits its cap.+ timeout-minutes: 45strategy:matrix:shard:@@ -538,97 +541,137 @@ jobs:export PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=truecd tests && npm ci- - name: Initialize test database- run: |- mkdir -p "$PWD/ci-data"- docker run --rm \- -v "$PWD":/app \- -v "$PWD/ci-data":/data \- -e TEST_ENV=true \- -e LDR_DATA_DIR=/data \- -e LDR_DB_KDF_ITERATIONS=1000 \- -w /app/src \- ${{ env.TEST_IMAGE }} \- python ../scripts/ci/init_test_database.py-- - name: Start application server in Docker- run: |- docker run -d \- --name ldr-server \- -p 5000:5000 \- -v "$PWD/ci-data":/data \- -e CI=true \- -e TEST_ENV=true \- -e FLASK_ENV=testing \- -e DISABLE_RATE_LIMITING=true \- -e SECRET_KEY=test-secret-key-for-ci \- -e LDR_DATA_DIR=/data \- -e LDR_DB_KDF_ITERATIONS=1000 \- ${{ env.TEST_IMAGE }} ldr-web-- # Wait for server to be ready- for i in {1..60}; do- if curl -f http://localhost:5000/api/v1/health 2>/dev/null; then- echo "Server is ready after $i seconds"- break- fi- if ! docker ps --filter "name=ldr-server" --filter "status=running" -q | grep -q .; then- echo "Server container died!"+ # Combined "init DB → start server → register user → run tests" in a+ # retry block so each attempt gets fresh server + DB state, equivalent+ # to GitHub's "Re-run failed jobs" but skipping the docker artifact+ # re-download (the tarball is bit-identical between attempts).+ #+ # 3 attempts because 14 independent shards each at ~98% success only+ # gives ~75% gate pass; 2 retries brings per-shard fail to ~0.0001%.+ # More than 3 starts hiding genuine bugs (a test that fails 3/3 is a+ # regression, not a flake).+ - name: Run UI tests with retry (fresh server per attempt)+ uses: nick-fields/retry@ad984534de44a9489a53aefd81eb77f87c70dc60 # v4.0.0+ env:+ SHARD: ${{ matrix.shard }}+ TEST_IMAGE: ${{ env.TEST_IMAGE }}+ with:+ timeout_minutes: 12+ max_attempts: 3+ retry_on: error+ shell: bash+ # Runs after a failed attempt, before the next. Snapshots the+ # server log under a numbered filename so failure forensics+ # survive even when a later attempt passes.+ on_retry_command: |+ mkdir -p /tmp/ldr-ci-logs+ ATTEMPT=$(( $(find /tmp/ldr-ci-logs -maxdepth 1 -name "server-${SHARD}-attempt-*.log" 2>/dev/null | wc -l) + 1 ))+ echo "::group::Cleanup after failed attempt ${ATTEMPT}"+ docker logs ldr-server > "/tmp/ldr-ci-logs/server-${SHARD}-attempt-${ATTEMPT}.log" 2>&1 || true+ docker stop ldr-server || true+ docker rm ldr-server || true+ sudo rm -rf "${GITHUB_WORKSPACE}/ci-data" || true+ echo "::endgroup::"+ command: |+ set -e+ mkdir -p "${GITHUB_WORKSPACE}/ci-data"++ echo "::group::Initialize test database"+ docker run --rm \+ -v "${GITHUB_WORKSPACE}":/app \+ -v "${GITHUB_WORKSPACE}/ci-data":/data \+ -e TEST_ENV=true \+ -e LDR_DATA_DIR=/data \+ -e LDR_DB_KDF_ITERATIONS=1000 \+ -w /app/src \+ "${TEST_IMAGE}" \+ python ../scripts/ci/init_test_database.py+ echo "::endgroup::"++ echo "::group::Start application server"+ docker run -d \+ --name ldr-server \+ -p 5000:5000 \+ -v "${GITHUB_WORKSPACE}/ci-data":/data \+ -e CI=true \+ -e TEST_ENV=true \+ -e FLASK_ENV=testing \+ -e DISABLE_RATE_LIMITING=true \+ -e SECRET_KEY=test-secret-key-for-ci \+ -e LDR_DATA_DIR=/data \+ -e LDR_DB_KDF_ITERATIONS=1000 \+ "${TEST_IMAGE}" ldr-web++ # --max-time bounds total request time; --connect-timeout bounds+ # TCP handshake. Without these, a hung connection would silently+ # eat the 12-min per-attempt budget instead of failing fast.+ for i in {1..60}; do+ if curl -fsS --connect-timeout 2 --max-time 5 http://localhost:5000/api/v1/health 2>/dev/null; then+ echo "Server is ready after $i seconds"+ break+ fi+ if ! docker ps --filter "name=ldr-server" --filter "status=running" -q | grep -q .; then+ echo "Server container died!"+ echo "Server log:"+ docker logs ldr-server+ exit 1+ fi+ echo "Waiting for server... ($i/60)"+ sleep 1+ done++ if ! curl -fsS --connect-timeout 2 --max-time 5 http://localhost:5000/api/v1/health 2>/dev/null; then+ echo "Server failed to start after 60 seconds"echo "Server log:"docker logs ldr-serverexit 1fi- echo "Waiting for server... ($i/60)"- sleep 1- done-- # Final check- if ! curl -f http://localhost:5000/api/v1/health 2>/dev/null; then- echo "Server failed to start after 60 seconds"- echo "Server log:"- docker logs ldr-server- exit 1- fi-- - name: Register CI test user- run: |- docker run --rm \- -v "$PWD":/app \- -e CI=true \- -e LDR_DB_KDF_ITERATIONS=1000 \- --network host \- -w /app/tests/ui_tests \- ${{ env.TEST_IMAGE }} \- node register_ci_user.js http://localhost:5000-- - name: Run UI tests- run: |- docker run --rm \- -v "$PWD":/app \- -e CI=true \- -e PUPPETEER_HEADLESS=true \- -e LDR_DB_KDF_ITERATIONS=1000 \- --network host \- -w /app/tests/ui_tests \- ${{ env.TEST_IMAGE }} \- sh -c "xvfb-run -a -s '-screen 0 1920x1080x24' node run_all_tests.js --shard=${{ matrix.shard }}"-- - name: Capture server logs on failure+ echo "::endgroup::"++ echo "::group::Register CI test user"+ docker run --rm \+ -v "${GITHUB_WORKSPACE}":/app \+ -e CI=true \+ -e LDR_DB_KDF_ITERATIONS=1000 \+ --network host \+ -w /app/tests/ui_tests \+ "${TEST_IMAGE}" \+ node register_ci_user.js http://localhost:5000+ echo "::endgroup::"++ echo "::group::Run UI tests for shard ${SHARD}"+ docker run --rm \+ -v "${GITHUB_WORKSPACE}":/app \+ -e CI=true \+ -e PUPPETEER_HEADLESS=true \+ -e LDR_DB_KDF_ITERATIONS=1000 \+ --network host \+ -w /app/tests/ui_tests \+ "${TEST_IMAGE}" \+ sh -c "xvfb-run -a -s '-screen 0 1920x1080x24' node run_all_tests.js --shard=${SHARD}"+ echo "::endgroup::"++ - name: Capture final server logs on failureif: failure()run: |mkdir -p /tmp/ldr-ci-logs- docker logs ldr-server > "/tmp/ldr-ci-logs/server-${{ matrix.shard }}.log" 2>&1 || true+ ATTEMPT=$(( $(find /tmp/ldr-ci-logs -maxdepth 1 -name "server-${{ matrix.shard }}-attempt-*.log" 2>/dev/null | wc -l) + 1 ))+ FINAL_LOG="/tmp/ldr-ci-logs/server-${{ matrix.shard }}-attempt-${ATTEMPT}-final.log"+ docker logs ldr-server > "$FINAL_LOG" 2>&1 || true{- echo "## 🪵 ldr-server logs [${{ matrix.shard }}] (last 200 lines)"+ echo "## 🪵 ldr-server logs [${{ matrix.shard }}] — final attempt (last 200 lines)"echo ""echo '```'- tail -n 200 "/tmp/ldr-ci-logs/server-${{ matrix.shard }}.log" || true+ tail -n 200 "$FINAL_LOG" || trueecho '```'echo ""- echo "Grepping for SQLAlchemy pool / DB session issues:"+ echo "Grepping for SQLAlchemy pool / DB session issues across all attempts:"echo '```'- grep -E "QueuePool|connection timed out|TimeoutError|cleanup_dead_threads|Failed to open database|DatabaseSessionError" "/tmp/ldr-ci-logs/server-${{ matrix.shard }}.log" | tail -n 50 || true+ grep -hE "QueuePool|connection timed out|TimeoutError|cleanup_dead_threads|Failed to open database|DatabaseSessionError" /tmp/ldr-ci-logs/server-"${{ matrix.shard }}"-attempt-*.log 2>/dev/null | tail -n 50 || trueecho '```'+ echo ""+ echo "Attempt logs preserved for upload:"+ find /tmp/ldr-ci-logs -maxdepth 1 -name "server-${{ matrix.shard }}-attempt-*.log" -printf '%TY-%Tm-%Td %TH:%TM %s\t%p\n' 2>/dev/null || true} >> "$GITHUB_STEP_SUMMARY"- name: Stop server@@ -651,7 +694,7 @@ jobs:uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1with:name: ui-tests-server-log-${{ matrix.shard }}- path: /tmp/ldr-ci-logs/server-${{ matrix.shard }}.log+ path: /tmp/ldr-ci-logs/server-${{ matrix.shard }}-attempt-*.logretention-days: 3if-no-files-found: ignore