Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
511 changes: 477 additions & 34 deletions .auto-sync/checks/validate_candidate.py

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions .auto-sync/checks/validate_candidate.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
#!/usr/bin/env bash
set -euo pipefail

# Loopwright's startLocalCommandGateServer copies validate_candidate.sh to ${workDir}/gate-script.sh
# and materializes the baseline tree plus candidate overlay at ${CANDIDATE_DIR}.
# Use SCRIPT_DIR for direct CLI runs and fall back to CANDIDATE_DIR when staged as gate-script.sh.
# Loopwright command.v1 mounts the check script's parent directory (.auto-sync/checks)
# read-only with whole-tree SHA-256 verification and passes the materialized candidate
# workspace via LOOPWRIGHT_CANDIDATE_DIR (plus baseline snapshot via LOOPWRIGHT_BASE_DIR).
CANDIDATE_DIR="${LOOPWRIGHT_CANDIDATE_DIR:-$PWD}"
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
if [[ -f "${SCRIPT_DIR}/validate_candidate.py" ]]; then
VALIDATOR="${SCRIPT_DIR}/validate_candidate.py"
else
VALIDATOR="${CANDIDATE_DIR}/.auto-sync/checks/validate_candidate.py"
VALIDATOR="${SCRIPT_DIR}/validate_candidate.py"
if [[ ! -f "${VALIDATOR}" ]]; then
echo "missing trusted validator script: ${VALIDATOR}" >&2
exit 1
fi

# Ensure the offline validator never inherits write-capable GitHub tokens.
# Ensure the offline validator never inherits write-capable GitHub tokens or writes bytecode.
unset GITHUB_TOKEN GH_TOKEN

exec "${PYTHON_BIN:-python3}" "${VALIDATOR}" --candidate-dir "${CANDIDATE_DIR}" "$@"
exec "${PYTHON_BIN:-python3}" -B "${VALIDATOR}" --candidate-dir "${CANDIDATE_DIR}" "$@"
16 changes: 16 additions & 0 deletions .auto-sync/digests.lock.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"version": 1,
"taskpack": "auto-sync",
"entries": [
{
"path": ".auto-sync/checks",
"kind": "directory",
"sha256": "6c9746d4f42a5d5f25d578dc91ca03d0e744b7bc23c523ca58eebf640b9de202"
},
{
"path": ".auto-sync/instructions.md",
"kind": "file",
"sha256": "1b154ac64438a2315acbc0ba31f832b9691e06bf4ef1716962eceb7ed93c6255"
}
]
}
6 changes: 3 additions & 3 deletions .auto-sync/instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ Protected or out-of-scope paths (NEVER edit):
- `gpustack_runner/` (including `gpustack_runner/runner.py.json`)
- `pack/dependencies.json`, `pack/prereleases.yaml`, `pack/.post_operation`
- `pack/resolve_dockerfile.sh`, `pack/expand_matrix.sh`, `pack/probe_dependencies.py`, `pack/collect_dependencies.py`, `pack/promote_support.py`, `pack/merge_runner.sh`, `pack/prune_runner.sh`, `pack/discard_runner.sh`, `pack/squash_expand_matrix.sh`, `pack/squash_image.sh`
- `pack/cuda/Dockerfile.voxbox`, `pack/cann/Dockerfile.mindie`, `pack/cann/mindie-atb-models_*.tar.gz`, `pack/cann/patches/hixl`, `pack/cann/patches/mindie.zip`
- `pack/corex`, `pack/dtk`, `pack/hggc`, `pack/maca`, `pack/musa`, `pack/shared`
- `.auto-sync/` (except `.auto-sync/proposal.json`), `.github/`, `.agents/`, `.claude/`, `AGENTS.md`, `tests/`, `docs/release-automation.md`, `docs/packaging.md`, `docs/dependency-metadata.md`, `docs/modules`
- `pack/cuda/Dockerfile.voxbox`, `pack/cann/Dockerfile.mindie`, `pack/cann/mindie-atb-models_*.tar.gz`, `pack/cann/patches/hixl/**`, `pack/cann/patches/mindie.zip`
- `pack/corex/**`, `pack/dtk/**`, `pack/hggc/**`, `pack/maca/**`, `pack/musa/**`, `pack/shared/**`
- `.auto-sync/**` (except `.auto-sync/proposal.json`; including `.auto-sync/taskpack.yaml`, `.auto-sync/digests.lock.json`, `.auto-sync/instructions.md`, `.auto-sync/checks/**`, and `.auto-sync/memory/**`), `.github/**`, `.agents/**`, `.claude/**`, `AGENTS.md`, `tests/**`, `docs/release-automation.md`, `docs/packaging.md`, `docs/dependency-metadata.md`, `docs/modules/**`

## 2. Incremental Release-Line Chasing Policy

Expand Down
17 changes: 12 additions & 5 deletions .auto-sync/taskpack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,17 @@ spec:
goal:
candidate: Research upstream GPUStack Runner releases across cuda/vllm, cuda/sglang, rocm/vllm, rocm/sglang, cann/vllm, and cann/sglang, update writable recipes, patches, matrix, support docs, and .auto-sync/proposal.json, and pass all static candidate checks.
noChange: Confirm subscribed upstream GPUStack Runner releases match the current catalog and support records with no eligible release-line advancement and settle cleanly as no_change.
execution:
mode: strict
digests:
pinDigests: true
scope:
writable:
- .auto-sync/proposal.json
- pack/matrix.yaml
- pack/cuda
- pack/rocm
- pack/cann
- pack/cuda/**
- pack/rocm/**
- pack/cann/**
- docs/support-records.md
- docs/supported-runners.md
- README.md
Expand All @@ -21,7 +25,7 @@ spec:
- pack/cann/Dockerfile.mindie
- pack/cann/mindie-atb-models_2.3.0_linux-amd64_py3.11_torch2.1.0-abi0.tar.gz
- pack/cann/mindie-atb-models_2.3.0_linux-arm64_py3.11_torch2.1.0-abi0.tar.gz
- pack/cann/patches/hixl
- pack/cann/patches/hixl/**
- pack/cann/patches/mindie.zip
instructions:
- .auto-sync/instructions.md
Expand Down Expand Up @@ -59,7 +63,10 @@ spec:
parameters:
script: .auto-sync/checks/validate_candidate.sh
timeoutSeconds: 300
allowReadOnlyGitHubToken: true
allowReadOnlyGitHubToken: false
toolchainPaths:
- /usr/local/bin
- /usr/bin
env:
- PACK_RUN_URL
- PYTHON_BIN
Expand Down
38 changes: 30 additions & 8 deletions .github/workflows/auto-sync.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Runner Auto Sync
name: Auto Sync

on:
schedule:
Expand Down Expand Up @@ -65,19 +65,33 @@ jobs:
ref: ${{ github.event.repository.default_branch }}
fetch-depth: 0
persist-credentials: false
- name: Verify main ref
id: main_ref
env:
EVENT_NAME: ${{ github.event_name }}
DISPATCH_REF: ${{ github.ref }}
DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
run: |
set -euo pipefail
if [[ "${EVENT_NAME}" == "workflow_dispatch" && "${DISPATCH_REF}" != "refs/heads/${DEFAULT_BRANCH}" ]]; then
echo "Refusing workflow_dispatch from '${DISPATCH_REF}'; dispatch Auto Sync from refs/heads/${DEFAULT_BRANCH}." >&2
exit 1
fi
MAIN_SHA="$(git rev-parse --verify 'HEAD^{commit}')"
echo "sha=${MAIN_SHA}" >> "${GITHUB_OUTPUT}"
- name: Fetch PR head
if: github.event_name == 'issue_comment'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_NUMBER: ${{ github.event.issue.number }}
EXPECTED_MAIN_SHA: ${{ steps.main_ref.outputs.sha }}
SERVER_URL: ${{ github.server_url }}
run: |
set -euo pipefail
if [[ ! "${PR_NUMBER}" =~ ^[1-9][0-9]*$ ]]; then
echo "Invalid pull request number '${PR_NUMBER}' in issue_comment payload." >&2
exit 1
fi
MAIN_SHA="$(git rev-parse --verify 'HEAD^{commit}')"
if [[ -n "${GH_TOKEN}" ]]; then
AUTH_B64="$(printf 'x-access-token:%s' "${GH_TOKEN}" | base64 | tr -d '\r\n')"
GIT_CONFIG_COUNT=1 \
Expand All @@ -89,26 +103,34 @@ jobs:
git -c core.hooksPath=/dev/null fetch --no-tags --no-recurse-submodules origin \
"+refs/pull/${PR_NUMBER}/head:refs/remotes/origin/pr/${PR_NUMBER}"
fi
if [[ "$(git rev-parse --verify 'HEAD^{commit}')" != "${MAIN_SHA}" ]]; then
if [[ "$(git rev-parse --verify 'HEAD^{commit}')" != "${EXPECTED_MAIN_SHA}" ]]; then
echo "HEAD moved unexpectedly during pull request head fetch." >&2
exit 1
fi
if [[ -n "$(git status --porcelain)" ]]; then
echo "Working tree became dirty after pull request object fetch." >&2
exit 1
fi
- name: Setup uv
if: ${{ !inputs.dry-run }}
uses: astral-sh/setup-uv@v7
with:
version: "0.8.24"
enable-cache: true
python-version: "3.10"
- name: Install dependencies
if: ${{ !inputs.dry-run }}
run: |
make prepare
uv sync --locked --all-packages
- name: Cache research tools
if: ${{ !inputs.dry-run }}
uses: actions/cache@v4
with:
path: ${{ runner.temp }}/auto-sync-tools
key: auto-sync-tools-v1-${{ runner.os }}-${{ runner.arch }}-ghmcp-2.0.1-crane-0.21.9
- name: Setup research tools
if: ${{ !inputs.dry-run }}
run: |
set -euo pipefail
tool_dir="$RUNNER_TEMP/auto-sync-tools"
Expand Down Expand Up @@ -156,21 +178,21 @@ jobs:
uses: gpustack/loopwright@main
with:
taskpack-path: .auto-sync/taskpack.yaml
mode: candidate
mode: auto
allow-privileged-execution: 'false'
allow-workflow-writes: 'false'
event-name: ${{ github.event_name }}
event-path: ${{ github.event_path }}
run-root: ${{ runner.temp }}/loopwright-runs
run-id: auto-sync-${{ github.run_id }}-${{ github.run_attempt }}
storage-profile: actions-basic
allow-custom-base-url: 'true'
provider-token-env: LOOPWRIGHT_PROVIDER_TOKEN
github-app-id: ${{ secrets.CI_GPUSTACK_LOOPWRIGHT_APP_ID || vars.CI_GPUSTACK_LOOPWRIGHT_APP_ID }}
github-app-private-key: ${{ secrets.CI_GPUSTACK_LOOPWRIGHT_APP_PRIVATE_KEY }}
output: json,github-step-summary
dry-run: ${{ inputs.dry-run && 'true' || 'false' }}
force: ${{ inputs.force && 'true' || 'false' }}
upstream-records: ${{ inputs.dry-run && '[{"upstreamId":"vllm","status":"available","version":"v0.0.0-dry-run"}]' || '' }}
force: ${{ (inputs.force || inputs.pack-run-url != '') && 'true' || 'false' }}
env:
GITHUB_SHA: ${{ steps.main_ref.outputs.sha }}
LOOPWRIGHT_PROVIDER_TOKEN: ${{ secrets.CI_GPUSTACK_LOOPWRIGHT_LLM_AUTH_TOKEN || secrets.CI_GPUSTACK_CODEREVIEW_LLM_AUTH_TOKEN || secrets.CI_GPUSTACK_RUNNER_AUTOSYNC_LLM_AUTH_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PACK_RUN_URL: ${{ inputs.pack-run-url }}
Expand Down
6 changes: 3 additions & 3 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Start with the guide for the affected contract:
| Supported versions and platforms | [Supported runners](docs/supported-runners.md) | `gpustack_runner/runner.py.json`, `pack/matrix.yaml`, `docs/support-records.md` |
| Recipes and image production | [Packaging](docs/packaging.md) | `pack/<backend>/Dockerfile.<service>`, `resolve_dockerfile.sh`, `expand_matrix.sh`, `.github/workflows/pack.yml` |
| Installed dependencies | [Dependency metadata](docs/dependency-metadata.md) | `pack/dependencies.json`, `probe_dependencies.py`, `collect_dependencies.py`, `promote_support.py`, `merge_runner.sh` |
| Release proposals and PR revisions | [Release automation](docs/release-automation.md) | `.auto-sync/taskpack.yaml`, `.auto-sync/instructions.md`, `.auto-sync/checks/validate_candidate.py`, `.github/workflows/auto-sync.yml` |
| Release proposals and PR revisions | [Release automation](docs/release-automation.md) | `.auto-sync/taskpack.yaml`, `.auto-sync/digests.lock.json`, `.auto-sync/instructions.md`, `.auto-sync/checks/validate_candidate.py`, `.github/workflows/auto-sync.yml` |

Confirm the checkout, branch, uncommitted changes, and relevant dependency versions before editing.
Search local source with `rg`. An index or guide points to evidence; it does not prove current behavior.
Expand Down Expand Up @@ -82,8 +82,8 @@ Run `make package` or Pack only when image production is explicitly authorized.

Use `loopwright step next --taskpack .auto-sync/taskpack.yaml` (with the portable `loopwright-step` skill from `gpustack/loopwright`) for local upstream discovery or an authorized `/auto-sync` revision; see [Release automation](docs/release-automation.md#local-verification).
Use [runner-release](.agents/skills/runner-release/SKILL.md) to cut package releases (tag, notes, promotion) and to align README and supported-runners documentation with published support records.
The `sync` job in `.github/workflows/auto-sync.yml` invokes `gpustack/loopwright@main` with `.auto-sync/taskpack.yaml` and `.auto-sync/instructions.md`.
The taskpack also owns `.auto-sync/proposal.json`, `.auto-sync/checks/`, and `.auto-sync/memory/`.
The `sync` job in `.github/workflows/auto-sync.yml` invokes `gpustack/loopwright@main` (`mode: auto`) with `.auto-sync/taskpack.yaml` and `.auto-sync/instructions.md`.
The taskpack also owns `.auto-sync/proposal.json`, `.auto-sync/digests.lock.json`, `.auto-sync/checks/`, and `.auto-sync/memory/`.
Loopwright runs the author in an isolated candidate workspace with mediated `read`, `write`, `edit`, `bash`, and `delete` tools.
It enforces writable and protected scope with `scope.v1`, checks `.auto-sync/proposal.json` with `json-artifact.v1`, and runs `.auto-sync/checks/validate_candidate.sh` with `command.v1` before publishing or updating an `auto-sync/*` PR.
The agent cannot merge, publish images, invoke Pack, or edit its controlling policy.
Expand Down
14 changes: 9 additions & 5 deletions docs/release-automation.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,17 @@ Static checks do not prove runtime or GPU compatibility.

## Architecture

`.github/workflows/auto-sync.yml` runs a single `sync` job using `gpustack/loopwright@main`.
`.github/workflows/auto-sync.yml` runs a single `sync` job using `gpustack/loopwright@main` in `mode: auto` with `allow-privileged-execution: 'false'` and `allow-workflow-writes: 'false'`.
The job runs weekly on Sunday at 13:07 UTC, or by manual dispatch or an authorized PR command.
It checks out the trusted default branch and supplies these files to Loopwright:
When subscribed upstream releases match `.auto-sync/proposal.json` (and neither `force` nor `pack-run-url` is set), `mode: auto` runs check-only `no_change` verification with zero model calls; otherwise it dispatches `candidate` mode.
It checks out and verifies the trusted default branch and supplies these files to Loopwright:

- `.auto-sync/taskpack.yaml`: a `loopwright.dev/v1alpha1` `Taskpack` defining upstreams, scope, read-only MCP servers (`github` stdio and `deepwiki` HTTP), execution limits, checks, publication, and model configuration (authenticated via `LOOPWRIGHT_PROVIDER_TOKEN`).
- `.auto-sync/taskpack.yaml`: a `loopwright.dev/v1alpha1` Taskpack 2.0 manifest declaring `spec.execution` (`mode: strict`, `digests.pinDigests: true`), explicit `/**` and single-file scope globs, upstreams, read-only MCP servers (`github` stdio and `deepwiki` HTTP), execution limits, checks, publication, and model configuration (authenticated via `LOOPWRIGHT_PROVIDER_TOKEN`).
- `.auto-sync/digests.lock.json`: deterministic SHA-256 lockfile pinning `.auto-sync/instructions.md` and the `.auto-sync/checks` directory tree (`loopwright digest sync --taskpack .auto-sync/taskpack.yaml --repo .`).
- `.auto-sync/instructions.md`: the author instructions, limited to 24,576 UTF-8 bytes. They directly consolidate upgrade rules for all six recipes.
- `.auto-sync/proposal.json`: the canonical proposal artifact inside the protected `.auto-sync/` control root, exposed as an exact single-file writable entry.
- `.auto-sync/memory/`: protected root for Loopwright taskpack memory. Verified facts and failure observations for `auto-sync` live under `.auto-sync/memory/auto-sync/` (`index.json` and `entries/<id>.md`) and are proposed through a separate `loopwright/memory/auto-sync/main` pull request.
- `.auto-sync/checks/validate_candidate.sh` and `validate_candidate.py`: deterministic candidate checks.
- `.auto-sync/checks/validate_candidate.sh` and `validate_candidate.py`: deterministic offline candidate checks mounted read-only as a SHA-256-verified directory under `command.v1` (with `$LOOPWRIGHT_CANDIDATE_DIR` and `$LOOPWRIGHT_BASE_DIR`).
- `.auto-sync/checks/lint_workflows.py`: workflow linting.

Loopwright runs the author in an isolated candidate workspace with mediated `read`, `write`, `edit`, `bash`, and `delete` tools, plus read-only MCP tools from `github-mcp-server` (`mcp__github__*`) and DeepWiki (`mcp__deepwiki__*`) and pinned `crane` for manifest inspection.
Expand Down Expand Up @@ -110,10 +112,12 @@ Run from the repository root:
make prepare && uv sync --locked --all-packages
LOOPWRIGHT_CANDIDATE_DIR="$PWD" uv run bash .auto-sync/checks/validate_candidate.sh
uv run pytest tests/gpustack_runner tests/pack
uv run python .auto-sync/checks/lint_workflows.py .github/workflows/auto-sync.yml .github/workflows/pack.yml .github/workflows/ci.yml
uv run python -B .auto-sync/checks/lint_workflows.py .github/workflows/auto-sync.yml .github/workflows/pack.yml .github/workflows/ci.yml
uv run mkdocs build --strict
```

When editing `.auto-sync/instructions.md` or files under `.auto-sync/checks/`, refresh `.auto-sync/digests.lock.json` with `loopwright digest sync --taskpack .auto-sync/taskpack.yaml --repo .` and verify parity with `loopwright digest sync --taskpack .auto-sync/taskpack.yaml --repo . --check --json`.

To drive `.auto-sync/taskpack.yaml` locally through an external coding agent without provider API secrets, install the portable `loopwright-step` skill (`npx skills add gpustack/loopwright --skill loopwright-step`), step the manifest with `loopwright step next --taskpack .auto-sync/taskpack.yaml --repo "$PWD" --run-root <outside-dir> --run-id <run-id> --json`, and export the verified overlay after terminal settlement with `loopwright inspect --run-root <outside-dir> --run-id <run-id> --output <export-dir> --json`; see [Loopwright Coding Agents](https://docs.gpustack.ai/loopwright/latest/docs/operations/coding-agents/).

The tests and static checks run offline. They do not build images or validate GPU execution.
Expand Down
Loading
Loading