~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(release-gate): CPU baseline smoke test under qemu-emulated CPUs (#4506)
LearningCircuitcc5388ef31f9
diff --git a/.github/workflows/release-gate.yml b/.github/workflows/release-gate.ymlindex a198fbe7d4..b3fb7f477a 100644--- a/.github/workflows/release-gate.yml+++ b/.github/workflows/release-gate.yml@@ -28,6 +28,17 @@ on:permissions: {} # Minimal top-level for OSSF Scorecard+# Serialize direct workflow_dispatch/schedule runs so two long gate runs+# (notably the qemu TCG emulation job) don't execute side by side. Runs+# triggered via workflow_call are unaffected: GitHub ignores top-level+# concurrency in a called workflow, and release.yml already serializes+# those through its own group. cancel-in-progress stays false — this gate+# is the only path to publishing, so an in-flight run must never be+# killed by a newer trigger.+concurrency:+ group: ${{ github.workflow }}-${{ github.ref }}+ cancel-in-progress: false+jobs:# ============================================# Existing security scans@@ -459,6 +470,142 @@ jobs:echo ""echo "✅ pip install verification passed — wheel is safe to publish"+ # ============================================+ # CPU baseline smoke test under qemu-emulated CPUs+ #+ # Catches dependency wheels that silently raise the x86-64+ # instruction-set baseline (e.g. AVX2) and would crash with SIGILL+ # at import time on older CPUs. Added after faiss-cpu 1.14.2 shipped+ # an AVX2 instruction in a static initializer that killed every+ # AVX-only deployment at container startup with exit code 132+ # (#4480, upstream facebookresearch/faiss#5296).+ #+ # Release-gate only by design: full-system TCG emulation is far too+ # slow for per-PR CI, and the failure mode only ships via dependency+ # bumps, which the gate sees before any release.+ # ============================================+ cpu-baseline-smoke:+ name: CPU Baseline Smoke (qemu)+ runs-on: ubuntu-latest+ timeout-minutes: 45+ permissions:+ contents: read++ steps:+ - name: Harden the runner (Audit all outbound calls)+ uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4+ with:+ egress-policy: audit++ - name: Checkout code+ uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3+ with:+ persist-credentials: false++ - name: Set up Python+ uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0+ with:+ # Keep in sync with requires-python in pyproject.toml — smoke-test+ # the wheels for the oldest interpreter the project supports.+ python-version: '3.12'++ - name: Install system dependencies (SQLCipher, qemu user-mode)+ run: |+ sudo apt-get update+ sudo apt-get install -y libsqlcipher-dev qemu-user+ # Fail here with a clear message rather than as a confusing+ # "command not found" inside the per-module loop below.+ command -v qemu-x86_64++ - name: Set up PDM+ uses: pdm-project/setup-pdm@973541a5febeafcfdadf8a51211435be6ecfd90f # v4.5+ with:+ # Keep in sync with requires-python in pyproject.toml (see above).+ python-version: '3.12'++ - name: Install locked production dependencies+ # lock --check first: the whole point is to test the exact wheels+ # the Docker image ships, so fail loudly if pdm.lock has drifted+ # from pyproject.toml instead of silently testing a stale set.+ # --no-self: only the dependency wheels matter here; skipping the+ # project build avoids needing the Vite frontend. pdm sync installs+ # the exact pins from pdm.lock — the same wheels the Docker image+ # ships.+ run: |+ pdm lock --check+ pdm sync --prod --no-self++ - name: Import native-heavy modules under emulated CPUs+ run: |+ set -euo pipefail++ # SIMD-heavy native extensions on the app's startup path. These+ # are the wheels with per-arch optimized builds, i.e. the ones+ # that can SIGILL on older CPUs. Pure-Python deps can't fail+ # this way and would only slow the emulation down.+ MODULES=(numpy pandas pyarrow sklearn faiss torch)++ # SandyBridge = AVX without AVX2 — the supported x86-64 floor+ # and the CPU class that hit #4480. Haswell = AVX2+FMA positive+ # control proving the dispatch path still selects the fast+ # kernels. Pre-AVX models (Nehalem/Westmere) are deliberately+ # absent: the pandas and scikit-learn wheels already require+ # AVX (verified to SIGILL on emulated Nehalem/Westmere), so+ # AVX is LDR's de-facto minimum and gating on older CPUs would+ # block every release. No AVX512 model: qemu TCG cannot emulate+ # AVX512, so an emulated Skylake-Server would just mask those+ # bits and retest the Haswell path.+ CPUS=(SandyBridge Haswell)++ # Keep emulated imports single-threaded — thread pools multiply+ # TCG overhead without adding coverage.+ export OMP_NUM_THREADS=1 OPENBLAS_NUM_THREADS=1 MKL_NUM_THREADS=1++ VENV_PY="$(pdm run python -c 'import sys; print(sys.executable)')"++ # Per-import ceiling so a hang surfaces as "timed out on+ # module X / CPU Y" (exit 124) instead of the job dying at its+ # 45-minute wall with no signal. The slowest module (torch)+ # imports in well under 2 minutes at typical ~30x TCG slowdown;+ # 300s leaves generous headroom.+ IMPORT_TIMEOUT=300++ echo "=== Native control run (host CPU) ==="+ # Proves each module imports at all, so any qemu failure below+ # is attributable to the emulated CPU's instruction set.+ for mod in "${MODULES[@]}"; do+ rc=0+ timeout "$IMPORT_TIMEOUT" "$VENV_PY" -c "import $mod" || rc=$?+ if [ "$rc" -ne 0 ]; then+ echo "::error::import $mod failed natively (exit $rc) — the module is broken regardless of CPU; the emulated runs below were not reached."+ exit 1+ fi+ echo "OK $mod (native)"+ done++ for cpu in "${CPUS[@]}"; do+ echo ""+ echo "=== Emulated CPU: $cpu ==="+ for mod in "${MODULES[@]}"; do+ rc=0+ timeout "$IMPORT_TIMEOUT" qemu-x86_64 -cpu "$cpu" "$VENV_PY" -c "import $mod" || rc=$?+ if [ "$rc" -ne 0 ]; then+ if [ "$rc" -eq 132 ]; then+ echo "::error::import $mod died with SIGILL (exit 132) on emulated $cpu — a dependency wheel executes instructions this CPU lacks. Find the offending package and pin it (see #4480 for the faiss-cpu precedent and debugging walkthrough)."+ elif [ "$rc" -eq 124 ]; then+ echo "::error::import $mod timed out after ${IMPORT_TIMEOUT}s on emulated $cpu — likely a hang specific to TCG emulation rather than an instruction-set issue."+ else+ echo "::error::import $mod failed (exit $rc) on emulated $cpu"+ fi+ exit 1+ fi+ echo "OK $mod ($cpu)"+ done+ done++ echo ""+ echo "✅ All native-heavy imports succeeded on every emulated CPU"+# ============================================# Check for open code scanning alerts# This runs after all SARIF uploads complete and fails if@@ -613,6 +760,9 @@ jobs:# comments for the v1.4.0 incident. Removing this dependency silently# allows broken wheels to be published to PyPI.- pip-install-check+ # CPU baseline smoke — catches dependency wheels that raise the+ # x86 instruction-set baseline and SIGILL on older CPUs (#4480)+ - cpu-baseline-smoke# Alert check (fails if any critical/high/medium alerts exist)- check-code-scanning-alertsif: always()@@ -671,6 +821,7 @@ jobs:check_result "${{ needs.journal-data-integration.result }}" || true# CRITICAL — DO NOT REMOVE: without this line, broken wheels pass the gatecheck_result "${{ needs.pip-install-check.result }}" || true+ check_result "${{ needs.cpu-baseline-smoke.result }}" || truecheck_result "${{ needs.check-code-scanning-alerts.result }}" || trueTOTAL=$((PASS_COUNT + FAIL_COUNT))@@ -920,6 +1071,22 @@ jobs:FAILED="true"fi+ # ============================================+ # CPU baseline smoke (qemu)+ # Catches dependency wheels compiled past the supported x86+ # baseline before they ship in a release (#4480).+ # ============================================+ echo ""+ echo "### CPU Baseline Compatibility"++ if [ "${{ needs.cpu-baseline-smoke.result }}" = "success" ]; then+ echo "✅ **CPU Baseline Smoke**: Passed — native imports OK on SandyBridge (AVX floor) and Haswell (AVX2)"+ else+ echo "❌ **CPU Baseline Smoke**: ${{ needs.cpu-baseline-smoke.result }} — ⚠️ A DEPENDENCY WHEEL CRASHES ON OLDER CPUs"+ echo " > Some wheel executes instructions (e.g. AVX2) not present on the emulated CPU. See the job log for which module/CPU, and #4480 for the faiss-cpu precedent."+ FAILED="true"+ fi+# ============================================# Code scanning alerts check# ============================================diff --git a/changelog.d/+cpu-baseline-smoke.misc.md b/changelog.d/+cpu-baseline-smoke.misc.mdnew file mode 100644index 0000000000..f9f380698b--- /dev/null+++ b/changelog.d/+cpu-baseline-smoke.misc.md@@ -0,0 +1 @@+The release gate now imports the SIMD-heavy native dependencies (numpy, pandas, pyarrow, scikit-learn, faiss, torch) under qemu-emulated SandyBridge (AVX without AVX2) and Haswell (AVX2) CPUs. This catches dependency wheels that silently raise the x86-64 instruction-set baseline and would crash with SIGILL on older CPUs — the failure mode that shipped in v1.7.0 when faiss-cpu 1.14.2 executed an AVX2 instruction at import time on AVX-only hosts (#4480). Building the gate surfaced that AVX is already LDR's de-facto minimum CPU requirement: the pandas and scikit-learn wheels crash on pre-AVX CPUs (Nehalem/Westmere era, pre-2011), so those are not part of the gate. The check runs only in the release gate, not on every PR, since full CPU emulation is slow and the failure mode can only ship via dependency bumps.