Compare commits

...
4 Commits
Author SHA1 Message Date
nopozandRaresKeY d7ecdf113b ci: add CodeQL advanced setup to scan pull requests before merge (#5250)
* ci: add CodeQL advanced setup to scan pull requests before merge

* ci(codeql): preserve scheduled scans

Add a weekly advanced-setup scan and update the security CI guide so default setup remains disabled.

---------

Co-authored-by: RaresKeY <158580472+RaresKeY@users.noreply.github.com>
2026-07-21 10:18:06 -07:00
Boody c854b0b7c1 Merge pull request #5286 from tse-jeff/fix/snap-wsl2-gpu-passthrough
fix(docker): detect snap+WSL2 GPU passthrough incompatibility
2026-07-21 13:57:32 +03:00
RaresKeY 5e50a3eed5 docs(docker): polish WSL2 snap GPU guidance 2026-07-08 19:30:41 +00:00
Jeffery Tse dd68e2a1ac fix(docker): detect snap+WSL2 GPU passthrough incompatibility, document fix 2026-07-07 01:02:55 -04:00
4 changed files with 111 additions and 12 deletions
+41
View File
@@ -0,0 +1,41 @@
name: CodeQL
# Advanced setup so CodeQL also runs on pull requests (including from forks),
# surfacing findings before merge instead of only after a change lands on dev.
on:
push:
branches: [dev, main]
pull_request:
branches: [dev]
schedule:
- cron: "17 3 * * 1"
permissions:
contents: read
jobs:
analyze:
name: Analyze (${{ matrix.language }})
runs-on: ubuntu-latest
permissions:
security-events: write
actions: read
contents: read
strategy:
fail-fast: false
matrix:
language: [actions, javascript-typescript, python]
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
- name: Initialize CodeQL
uses: github/codeql-action/init@8aad20d150bbac5944a9f9d289da16a4b0d87c1e # v4.36.2
with:
languages: ${{ matrix.language }}
build-mode: none
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@8aad20d150bbac5944a9f9d289da16a4b0d87c1e # v4.36.2
with:
category: "/language:${{ matrix.language }}"
+6 -12
View File
@@ -7,10 +7,9 @@ benefit.
## What runs, and why
Most checks live in files under `.github/workflows/`. CodeQL is configured
through GitHub's code scanning default setup, so it appears as a dynamic GitHub
workflow instead of a checked-in workflow file. They run automatically; you do
not start them.
Most checks live in files under `.github/workflows/`. CodeQL uses the
checked-in advanced configuration in `.github/workflows/codeql.yml`. They run
automatically; you do not start them.
| Check | What it protects against | Blocks a merge? |
|---|---|---|
@@ -90,14 +89,9 @@ let the workflows run on one pull request first, then add them here.
2. Turn on **Dependency graph** (usually on by default for public repos) -- this
powers Dependency review and Dependabot.
3. Turn on **Dependabot alerts** and **Dependabot security updates**.
4. Under **Code scanning**, use **Set up -> Default** for CodeQL. GitHub then
runs CodeQL as a dynamic workflow without the fork-token limitations that
affect checked-in advanced workflows.
Do not also add a checked-in CodeQL workflow while default setup is enabled:
GitHub rejects advanced CodeQL uploads when default setup is active. If the
project later needs an advanced CodeQL workflow, disable default setup first
and keep only one CodeQL publishing path active.
4. Under **Code scanning**, keep **Default setup** disabled. CodeQL is
configured by `.github/workflows/codeql.yml`; enabling default setup at the
same time causes GitHub to reject uploads from the checked-in workflow.
## Keeping it current
+28
View File
@@ -196,6 +196,34 @@ docker compose exec odysseus nvidia-smi -L
For first-time local model testing on 8 GB laptop GPUs, start with GGUF/Q4 models on llama.cpp before trying GPTQ/AWQ models on vLLM or SGLang. This keeps the first run simpler while confirming GPU passthrough works.
**WSL2 + snap Docker.** If the NVIDIA check fails with this error, Docker may be
installed via snap:
```text
failed to fulfil mount request: open /usr/lib/wsl/lib/libdxcore.so: no such file or directory
```
Check with `snap list docker` or:
```bash
docker info --format '{{.DockerRootDir}}'
```
A Docker root under `/var/snap/docker/` means snap confinement can prevent
Docker from seeing WSL2's `/usr/lib/wsl/lib` GPU libraries even when the files
exist on the host. Reinstalling or reconfiguring `nvidia-container-toolkit` will
not fix that. Remove snap Docker, install the official apt-based Docker Engine
([Docker docs](https://docs.docker.com/engine/install/ubuntu/)), then configure
the NVIDIA runtime again:
```bash
sudo snap remove docker
sudo nvidia-ctk runtime configure --runtime=docker
sudo systemctl restart docker
```
Then re-run `scripts/check-docker-gpu.sh`.
Safety notes:
- The app never installs host GPU runtime automatically.
- The app never edits `.env` automatically.
+36
View File
@@ -214,6 +214,22 @@ _check_nvidia_smi() {
echo
}
# WSL2 snap Docker cannot see /usr/lib/wsl/lib/libdxcore.so from its confined
# namespace, so NVIDIA passthrough fails until the user switches to non-snap
# Docker. DockerRootDir identifies snap installs more reliably than snap(8).
_is_wsl() {
grep -qi microsoft /proc/version 2>/dev/null && return 0
[ -d /usr/lib/wsl ] && return 0
return 1
}
_is_docker_snap() {
case "$(docker info --format '{{.DockerRootDir}}' 2>/dev/null)" in
*/snap/docker/*|*/snap.docker/*) return 0 ;;
esac
return 1
}
# Returns 1 if Docker is unavailable (callers should stop further GPU checks).
_check_docker() {
_info "Checking Docker..."
@@ -258,6 +274,26 @@ _check_gpu_passthrough() {
echo
_fail "GPU passthrough failed. Check these steps in order:"
echo
if _is_wsl && _is_docker_snap; then
_warn "Detected: Docker installed via snap, running on WSL2."
_warn "This is a known incompatibility, not a toolkit/config problem:"
_warn " snap confines Docker's mount namespace, so it cannot see the"
_warn " WSL2-injected GPU library at /usr/lib/wsl/lib/libdxcore.so even"
_warn " though the file exists on the host. Installing/reconfiguring"
_warn " nvidia-container-toolkit will NOT fix this — the numbered"
_warn " steps below will not help until Docker itself is replaced."
echo
_info "Fix: remove snap Docker and install the official apt-based Docker"
_info "Engine instead (unsandboxed, can see /usr/lib/wsl/lib):"
echo
echo " sudo snap remove docker"
echo " # then follow: https://docs.docker.com/engine/install/ubuntu/"
echo " sudo nvidia-ctk runtime configure --runtime=docker"
echo " sudo systemctl restart docker"
echo
_info "Re-run this script afterward to confirm passthrough works."
echo
fi
echo " 1. Install NVIDIA Container Toolkit (if not already installed):"
echo " Arch: sudo pacman -S nvidia-container-toolkit"
echo " Debian: sudo apt install nvidia-container-toolkit"