# Fast path: run the release-gating checks and build every release artifact # on Blacksmith runners, outside the shared GitHub-hosted queue. Anyone with # write access (people or agents) may start it; nothing runs until Khaliq # approves the fast-path environment. # # It publishes nothing. npm publishing uses trusted publishing (OIDC bound to # publish.yml), so the fast path builds the workspace at the checked-in # version, packs agent-relay and every published @agent-relay/* package with # `npm pack`, builds the agent-relay-node release binaries and the bun # standalone binaries, and uploads all of it as workflow artifacts. No # dist-tag, git tag or GitHub release is created or moved. name: fast-path run-name: fast-path ${{ inputs.ref }} (${{ inputs.reason }}) on: workflow_dispatch: inputs: ref: description: Branch, tag or commit to build (a PR branch is fine) required: true default: main reason: description: Why this needs the fast path required: true permissions: contents: read concurrency: group: fast-path-${{ inputs.ref }}-${{ github.run_id }} cancel-in-progress: false env: NPM_CONFIG_FUND: false AGENT_RELAY_TELEMETRY_DISABLED: 1 CARGO_TERM_COLOR: always RUST_BACKTRACE: '1' jobs: gate: name: Approve and resolve ref environment: fast-path runs-on: blacksmith-4vcpu-ubuntu-2404 outputs: sha: ${{ steps.sha.outputs.sha }} version: ${{ steps.sha.outputs.version }} steps: - uses: actions/checkout@v4 with: ref: ${{ inputs.ref }} persist-credentials: false - id: sha run: | echo "sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT" echo "version=$(node -p "require('./package.json').version")" >> "$GITHUB_OUTPUT" # test.yml test: name: Test (${{ matrix.os }}) needs: gate runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: os: [blacksmith-8vcpu-ubuntu-2404, blacksmith-6vcpu-macos-15] steps: - uses: actions/checkout@v4 with: ref: ${{ needs.gate.outputs.sha }} persist-credentials: false - uses: actions/setup-node@v4 with: node-version: '22.14.0' - run: npm ci - name: Ensure rollup optional dependencies are installed run: npm install --no-save rollup || true - run: npm test windows-credential-acl: name: Windows credential ACL validation needs: gate runs-on: blacksmith-4vcpu-windows-2025 steps: - uses: actions/checkout@v4 with: ref: ${{ needs.gate.outputs.sha }} persist-credentials: false - uses: actions/setup-node@v4 with: node-version: '22.14.0' - name: Install dependencies without lifecycle scripts run: npm ci --ignore-scripts - name: Run Windows credential ACL tests run: >- npx vitest run packages/cloud/src/credential-directory-windows.test.ts packages/cloud/src/credential-directory-windows.native.test.ts --pool=forks --maxWorkers=1 - name: Verify concurrent Windows credential writes run: >- npx vitest run packages/cloud/src/workspace-store.test.ts --testNamePattern="preserves concurrent credential writes" --pool=forks --maxWorkers=1 lint: needs: gate runs-on: blacksmith-4vcpu-ubuntu-2404 steps: - uses: actions/checkout@v4 with: ref: ${{ needs.gate.outputs.sha }} persist-credentials: false - uses: actions/setup-node@v4 with: node-version: 22.14.0 - run: npm ci - name: Ensure rollup optional dependencies are installed run: npm install --no-save rollup || true - run: npm run lint - run: npm run format:check # relay-node-ci.yml (the live harness job is skipped) relay-node-checks: name: relay-node public source + contract drift needs: gate runs-on: blacksmith-4vcpu-ubuntu-2404 timeout-minutes: 30 defaults: run: working-directory: crates/relay-node steps: - uses: actions/checkout@v4 with: ref: ${{ needs.gate.outputs.sha }} persist-credentials: false - name: Check nothing internal is in the public source run: bash scripts/check-open-source.sh - uses: dtolnay/rust-toolchain@4360b52568e2003a75bf9bc1d59f33a8e3fc893c # stable - uses: Swatinem/rust-cache@49a0bdc70d2e1b713ca9e2869b211fcce03d3c1c # v2 with: workspaces: crates/relay-node cache-bin: false save-if: false - name: Regenerate the contract run: scripts/generate-contract.sh - name: Fail on drift run: git diff --exit-code -- contract/CoreContract.swift relay-node-test: name: relay-node ${{ matrix.name }} needs: gate runs-on: ${{ matrix.os }} timeout-minutes: 60 strategy: fail-fast: false matrix: include: - name: Linux x64 build + test os: blacksmith-8vcpu-ubuntu-2404 features: '' cache_key: '' - name: Linux x64 library build + test os: blacksmith-8vcpu-ubuntu-2404 features: --no-default-features cache_key: library - name: macOS arm64 build + test os: blacksmith-6vcpu-macos-15 features: '' cache_key: '' defaults: run: working-directory: crates/relay-node steps: - uses: actions/checkout@v4 with: ref: ${{ needs.gate.outputs.sha }} persist-credentials: false - uses: dtolnay/rust-toolchain@4360b52568e2003a75bf9bc1d59f33a8e3fc893c # stable - uses: Swatinem/rust-cache@49a0bdc70d2e1b713ca9e2869b211fcce03d3c1c # v2 with: workspaces: crates/relay-node key: ${{ matrix.cache_key }} cache-bin: false save-if: false - name: No relayhistory in the dependency tree if: matrix.features != '' run: | tree="$(cargo tree --locked -e normal,build)" if grep -qE '(^|[^a-z-])(ai-hist|history-provider-sources) v' <<<"$tree"; then echo "::error::The relay node depends on relayhistory." exit 1 fi - name: The library build really is without relay-cli if: matrix.features != '' run: | features="$(cargo tree --locked --no-default-features --depth 0 -f '{f}')" if grep -q 'relay-cli' <<<"$features"; then echo "::error::relay-cli is on in the build that must not have it: $features" exit 1 fi - name: Build if: matrix.features == '' run: cargo build --locked - name: Test env: FEATURES: ${{ matrix.features }} run: | export RUSTUP_HOME="${RUSTUP_HOME:-$HOME/.rustup}" CARGO_HOME="${CARGO_HOME:-$HOME/.cargo}" export HOME="$RUNNER_TEMP/relay-node-home" mkdir -p "$HOME" trust_override=false for name in SSL_CERT_FILE SSL_CERT_DIR; do if [ -n "${!name:-}" ]; then echo "$name=present"; trust_override=true; else echo "$name=absent"; fi done if [ "$trust_override" = true ]; then echo "::error::The isolated test process inherited a file trust override. Its value has not been printed or changed." exit 1 fi if [ "$RUNNER_OS" = Linux ]; then export CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUNNER='env -u SSL_CERT_FILE -u SSL_CERT_DIR' fi # shellcheck disable=SC2086 # FEATURES is empty or one flag cargo test --locked $FEATURES --lib relay::cloud_http::tests::tls_diagnostic_ -- --nocapture # shellcheck disable=SC2086 cargo test --locked $FEATURES -- --test-threads=4 relay-node-windows: name: relay-node Windows x64 build needs: gate runs-on: blacksmith-4vcpu-windows-2025 timeout-minutes: 60 defaults: run: shell: bash working-directory: crates/relay-node steps: - name: Allow long paths shell: pwsh working-directory: . run: | git config --global core.autocrlf false git config --global core.longpaths true - uses: actions/checkout@v4 with: ref: ${{ needs.gate.outputs.sha }} persist-credentials: false - uses: dtolnay/rust-toolchain@4360b52568e2003a75bf9bc1d59f33a8e3fc893c # stable - uses: Swatinem/rust-cache@49a0bdc70d2e1b713ca9e2869b211fcce03d3c1c # v2 with: workspaces: crates/relay-node cache-bin: false save-if: false - run: cargo build --locked - name: Test the platform file helpers run: 'cargo test --locked --lib platform::' - name: Test where the install lives run: 'cargo test --locked --lib -- install::' # publish.yml build-node, at the checked-in version. build-node: name: Build node (${{ matrix.suffix }}) needs: [gate, test, lint, relay-node-checks, relay-node-test] runs-on: ${{ matrix.os }} timeout-minutes: 60 strategy: fail-fast: false matrix: include: # Ubuntu 22.04 keeps the glibc floor at 2.35, as in publish.yml. - suffix: linux-x64 os: blacksmith-4vcpu-ubuntu-2204 target: x86_64-unknown-linux-gnu ext: '' smoke: true - suffix: linux-arm64 os: blacksmith-4vcpu-ubuntu-2204-arm target: aarch64-unknown-linux-gnu ext: '' smoke: true - suffix: darwin-arm64 os: blacksmith-6vcpu-macos-15 target: aarch64-apple-darwin ext: '' smoke: true - suffix: darwin-x64 os: blacksmith-6vcpu-macos-15 target: x86_64-apple-darwin ext: '' smoke: false - suffix: windows-x64 os: blacksmith-4vcpu-windows-2025 target: x86_64-pc-windows-msvc ext: .exe smoke: true defaults: run: shell: bash env: VERSION: ${{ needs.gate.outputs.version }} SUFFIX: ${{ matrix.suffix }} EXT: ${{ matrix.ext }} TARGET: ${{ matrix.target }} steps: - name: Allow long paths if: runner.os == 'Windows' run: | git config --global core.autocrlf false git config --global core.longpaths true - uses: actions/checkout@v4 with: ref: ${{ needs.gate.outputs.sha }} persist-credentials: false - uses: dtolnay/rust-toolchain@4360b52568e2003a75bf9bc1d59f33a8e3fc893c # stable with: targets: ${{ matrix.target }} - uses: Swatinem/rust-cache@49a0bdc70d2e1b713ca9e2869b211fcce03d3c1c # v2 with: workspaces: crates/relay-node key: release-${{ matrix.target }} cache-bin: false save-if: false - name: Build working-directory: crates/relay-node run: | AGENT_RELAY_PROBE_VERSION="$VERSION" cargo build --locked --release --target "$TARGET" \ --bin agent-relay-node - name: Package with a .sha256 sidecar run: | set -euo pipefail ASSET="agent-relay-node-${VERSION}-${SUFFIX}${EXT}" mkdir -p dist cp "crates/relay-node/target/${TARGET}/release/agent-relay-node${EXT}" "dist/${ASSET}" cd dist if command -v sha256sum >/dev/null 2>&1; then sha256sum "$ASSET" > "${ASSET}.sha256" else shasum -a 256 "$ASSET" > "${ASSET}.sha256" fi cat "${ASSET}.sha256" echo "ASSET=${ASSET}" >> "$GITHUB_ENV" - name: Smoke test (--version reports the version) if: matrix.smoke run: | set -euo pipefail reported="$("dist/${ASSET}" --version)" echo "$reported" [ "$reported" = "agent-relay-node ${VERSION}" ] || { echo "::error::expected agent-relay-node ${VERSION}"; exit 1; } - uses: actions/upload-artifact@v4 with: name: agent-relay-node-${{ matrix.suffix }}-${{ needs.gate.outputs.sha }} path: dist/* if-no-files-found: error # publish.yml build-standalone, at the checked-in version. build-standalone: name: Build standalone (${{ matrix.target }}) needs: [gate, test, lint] runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: include: - os: blacksmith-6vcpu-macos-15 target: bun-darwin-arm64 binary_name: agent-relay-darwin-arm64 expected_arch: arm64 - os: blacksmith-6vcpu-macos-15 target: bun-darwin-x64 binary_name: agent-relay-darwin-x64 expected_arch: x86_64 - os: blacksmith-4vcpu-ubuntu-2404 target: bun-linux-x64 binary_name: agent-relay-linux-x64 - os: blacksmith-4vcpu-ubuntu-2404 target: bun-linux-arm64 binary_name: agent-relay-linux-arm64 env: TARGET: ${{ matrix.target }} BIN: release-binaries/${{ matrix.binary_name }} VERSION: ${{ needs.gate.outputs.version }} steps: - uses: actions/checkout@v4 with: ref: ${{ needs.gate.outputs.sha }} persist-credentials: false - uses: oven-sh/setup-bun@v2 with: no-cache: true bun-version: latest - uses: actions/setup-node@v4 with: node-version: '22.14.0' - run: npm ci - run: npm run build - name: Bake PostHog key into built CLI env: AGENT_RELAY_POSTHOG_KEY: ${{ vars.POSTHOG_PROJECT_KEY }} run: node scripts/inject-posthog-key.mjs - name: Build standalone binary env: AGENT_RELAY_POSTHOG_KEY: ${{ vars.POSTHOG_PROJECT_KEY }} run: | mkdir -p release-binaries bun build \ --compile \ --minify \ --target="$TARGET" \ --external=better-sqlite3 \ --define="process.env.AGENT_RELAY_VERSION=\"${VERSION}\"" \ --define="process.env.AGENT_RELAY_POSTHOG_KEY=\"${AGENT_RELAY_POSTHOG_KEY:-}\"" \ ./packages/cli/dist/cli/index.js \ --outfile "$BIN" - name: Verify ssh2 is bundled into binary run: | if ! strings "$BIN" | grep -q 'ssh-userauth'; then echo "FATAL: ssh2 protocol symbols missing from $BIN" exit 1 fi echo "OK: ssh2 is bundled (ssh-userauth symbol present)" - name: Verify standalone MCP dispatches each request once if: matrix.target == 'bun-linux-x64' run: node scripts/verify-standalone-mcp-single-dispatch.mjs "$BIN" - name: Sign macOS binary if: startsWith(matrix.target, 'bun-darwin-') run: scripts/sign-macos-binary.sh "$BIN" - name: Verify Linux binary if: matrix.target == 'bun-linux-x64' run: | chmod +x "$BIN" "./$BIN" --version - name: Verify macOS binary if: startsWith(matrix.target, 'bun-darwin-') env: EXPECTED_ARCH: ${{ matrix.expected_arch }} run: scripts/verify-macos-binary.sh "$BIN" "$EXPECTED_ARCH" -- --version - name: Compress binary with gzip run: gzip -9 -k "$BIN" - uses: actions/upload-artifact@v4 with: name: ${{ matrix.binary_name }}-${{ needs.gate.outputs.sha }} path: | release-binaries/${{ matrix.binary_name }} release-binaries/${{ matrix.binary_name }}.gz if-no-files-found: error pack: name: Pack npm packages needs: [gate, test, windows-credential-acl, lint] runs-on: blacksmith-4vcpu-ubuntu-2404 steps: - uses: actions/checkout@v4 with: ref: ${{ needs.gate.outputs.sha }} persist-credentials: false - uses: actions/setup-node@v4 with: node-version: '22.14.0' - run: npm ci - name: Ensure rollup optional dependencies are installed run: npm install --no-save rollup || true - run: npm run build - name: Bake PostHog key into built CLI env: AGENT_RELAY_POSTHOG_KEY: ${{ vars.POSTHOG_PROJECT_KEY }} run: node scripts/inject-posthog-key.mjs - name: Verify PostHog key was baked in if: vars.POSTHOG_PROJECT_KEY != '' run: node scripts/inject-posthog-key.mjs --check - name: Pack @agent-relay/* packages run: | set -euo pipefail mkdir -p "$GITHUB_WORKSPACE/fast-path-packs" # The packages publish.yml publishes besides the main package. for pkg in cloud config cli-surface connect core-bridge utils sdk integration-prompts session events-shim spawn-placement; do (cd "packages/$pkg" && npm pack --ignore-scripts --pack-destination "$GITHUB_WORKSPACE/fast-path-packs") done # Same preparation as publish.yml publish-main before it packs agent-relay. - name: Install workspace dependencies for bundling run: npm ci --omit=dev --ignore-scripts - name: Clean publish artifacts before packing run: | set -euo pipefail find packages -mindepth 2 -type d \( \ -name node_modules -o \ -name .npm -o \ -name .cache -o \ -name .parcel-cache -o \ -name .turbo \ \) -prune -exec rm -rf {} + rm -rf .npm-tarball agent-relay-*.tgz - name: Pack agent-relay working-directory: packages/cli run: npm pack --ignore-scripts --pack-destination "$GITHUB_WORKSPACE/fast-path-packs" - uses: actions/upload-artifact@v4 with: name: npm-packages-${{ needs.gate.outputs.sha }} path: fast-path-packs/*.tgz if-no-files-found: error summary: name: Summary needs: [gate, pack, build-node, build-standalone, relay-node-windows] runs-on: blacksmith-4vcpu-ubuntu-2404 steps: - name: Summary env: REF: ${{ inputs.ref }} SHA: ${{ needs.gate.outputs.sha }} REASON: ${{ inputs.reason }} VERSION: ${{ needs.gate.outputs.version }} run: | { echo "### relay fast path" echo "- ref: \`$REF\` at \`$SHA\` (version $VERSION)" echo "- reason: $REASON" echo "- nothing published (npm trusted publishing is bound to publish.yml)" echo "- artifacts:" echo " - \`npm-packages-$SHA\` (agent-relay and 10 @agent-relay/* tarballs)" echo " - \`agent-relay-node--$SHA\` (linux x64/arm64, darwin arm64/x64, windows x64)" echo " - \`agent-relay--$SHA\` (bun standalone, darwin arm64/x64, linux x64/arm64)" } >> "$GITHUB_STEP_SUMMARY"