--- name: test-release description: | Verify a released archon binary works end-to-end via a specific install path. Use when: cutting a new release, reproducing a user bug report on the released version, or validating that a hotfix binary actually works after a re-tag. Triggers: "test the release", "test 0.3.1 via brew", "verify the curl install", "smoke test the binary", "did the release binary work", "run /test-release", "verify the release". NOT for: testing dev work (use bun link directly), testing unreleased changes (build locally via scripts/build-binaries.sh first), or running the full validate suite (bun run validate is separate). argument-hint: "[brew|curl-mac|curl-vps] [optional: version to verify] [optional: vps-target]" --- # Test Release Automated smoke test for a released archon binary. Covers three install paths: - `brew` — Homebrew tap on macOS (tests the formula and checksums) - `curl-mac` — `curl install.sh` on macOS (tests the install script, sandboxed to a temp dir) - `curl-vps` — `curl install.sh` on a remote Linux VPS (tests the Linux binary and full install path) Every path installs the binary, runs a fixed smoke test suite, and cleans up. The dev `bun link` binary is never touched and remains the default `archon` on PATH throughout. **When NOT to use this skill:** - There is no release yet — build a local binary via `bash scripts/build-binaries.sh` and run it from `dist/binaries/` directly - You want to test the dev clone — use `bun run validate` or invoke source directly via `bun packages/cli/src/cli.ts` - You want to test the full server + web UI deploy flow — use the cloud-init from `deploy/cloud-init.yml` on a real VPS ## Local build for pre-release QA To build a binary locally with the exact same flags and constants that CI uses, invoke `scripts/build-binaries.sh` directly. The script supports two modes: ```bash # Multi-target mode (builds all 4 local platforms into dist/binaries/) VERSION=0.3.1 GIT_COMMIT=abc12345 bash scripts/build-binaries.sh # Single-target mode (matches one CI matrix job) VERSION=0.3.1 \ GIT_COMMIT=abc12345 \ TARGET=bun-darwin-arm64 \ OUTFILE=dist/test-archon-darwin-arm64 \ bash scripts/build-binaries.sh # Verify the binary — use the path from the mode you built: # multi-target → ./dist/binaries/archon-darwin-arm64 # single-target → the OUTFILE you passed above ./dist/test-archon-darwin-arm64 version # Expected: Archon CLI v0.3.1, Build: binary, Git commit: abc12345 ``` Run this **before tagging a release** to catch build-time-constant issues locally. The script is the canonical entry point — both local dev and the release workflow call it the same way, so a green local build means the CI build will exercise the same code path. ## Phase 1 — Determine scope Parse the arguments. The skill takes up to three: 1. **Install path** (`brew` | `curl-mac` | `curl-vps`): which install flow to exercise 2. **Expected version** (optional): the version tag the release should report, e.g. `0.3.1`. If not provided, fetch it: ```bash gh release list --repo coleam00/Archon --limit 1 --json tagName --jq '.[0].tagName' ``` 3. **VPS target** (only for `curl-vps`): SSH target in the form `user@host` or `host` (uses default SSH config) If any argument is missing, ask the user for clarification BEFORE doing anything. Never guess the install path or the expected version. Confirm the plan with the user before proceeding to Phase 2. Output should look like: ``` About to test: Path: brew (Homebrew tap on macOS) Version: 0.3.1 (expected) Cleanup: will uninstall after tests (brew uninstall + untap) If `archon-stable` symlink is detected in Phase 2, it will be restored at the end of Phase 5 by reinstalling the tap formula. Proceed? (y/N) ``` Do not continue without explicit confirmation. Release testing touches install state and the user should be aware. ## Phase 2 — Pre-flight Before touching anything: 1. Capture the current dev binary state for reference: ```bash which -a archon archon version 2>&1 | head -5 ``` Record the path and version of the dev binary so the final report can show "dev binary was untouched". 2. Verify prerequisites for the chosen path: - **brew**: `brew --version` must succeed. If not, abort with "Homebrew not installed — see https://brew.sh/" - **curl-mac**: `curl --version` must succeed (effectively always true on macOS) - **curl-vps**: `ssh 'uname -a'` must succeed. If not, abort with "Cannot SSH to ". Also verify `ssh 'command -v curl'` returns a path. 3. Confirm the release exists on GitHub: ```bash gh release view v --repo coleam00/Archon --json tagName,assets --jq '{tag: .tagName, assetCount: (.assets | length)}' ``` If the release does not exist or has no assets, abort with a clear message. Do not proceed to install a non-existent release. 4. **Detect persistent `archon-stable` install (brew path only).** If the user has renamed a prior brew install to `archon-stable` (the dual-homebrew pattern — see `~/.config/fish/functions/brew-upgrade-archon.fish`), Phase 5's `brew uninstall` will wipe it. Capture the state so Phase 5b can restore it: ```bash ARCHON_STABLE_WAS_INSTALLED="" if [ -L /opt/homebrew/bin/archon-stable ] || [ -L /usr/local/bin/archon-stable ]; then ARCHON_STABLE_WAS_INSTALLED="yes" echo "Detected persistent archon-stable — will restore after Phase 5 uninstall." fi ``` Export `ARCHON_STABLE_WAS_INSTALLED` into the environment used by Phase 5b. Only applies to the `brew` path — `curl-mac` and `curl-vps` don't go through brew and don't disturb `archon-stable`. ## Phase 3 — Install ### Path: brew ```bash brew tap coleam00/archon brew install coleam00/archon/archon BINARY="$(brew --prefix coleam00/archon/archon)/bin/archon" ``` Capture `$BINARY` for Phase 4. Verify the file exists and is executable. ### Path: curl-mac Install to a dedicated tmp directory so the dev `bun link` binary stays on PATH unchanged: ```bash INSTALL_DIR=/tmp/archon-test-release-$(date +%s) mkdir -p "$INSTALL_DIR" curl -fsSL https://raw.githubusercontent.com/coleam00/Archon/main/scripts/install.sh | INSTALL_DIR="$INSTALL_DIR" bash BINARY="$INSTALL_DIR/archon" ``` > **The env var must prefix `bash`, not `curl`.** In `VAR=x cmd1 | cmd2` the > assignment applies only to `cmd1`, so `INSTALL_DIR=… curl … | bash` sets it for > the *download* and leaves the *installer* on its `/usr/local/bin` default. The > failure is confusing rather than obvious: the script downloads and verifies the > checksum, then demands sudo and dies with > `sudo: a terminal is required to read the password`. Observed on the 0.7.1 test. > > `scripts/install.sh` carries the same broken form in its own header example > (`INSTALL_DIR=~/.local/bin curl -fsSL ... | bash`), so users copying it hit this > too. Fix both together; see issue #2436. Verify `$BINARY` exists and is executable. Capture the install directory for cleanup. ### Path: curl-vps Run the install script on the VPS: ```bash ssh 'curl -fsSL https://raw.githubusercontent.com/coleam00/Archon/main/scripts/install.sh | bash' ``` Determine where the binary landed — `install.sh` uses `/usr/local/bin/archon` by default, or `$HOME/.local/bin/archon` (or `$HOME/bin/archon`) when `/usr/local/bin` needs sudo and that folder is on PATH: ```bash ssh 'command -v archon' ``` Capture the remote path as `$REMOTE_BINARY`. For the rest of Phase 4, wrap every command as `ssh ''`. ### Capture SHA256 and version Immediately after install, capture: ```bash # Local paths (brew / curl-mac) shasum -a 256 "$BINARY" | awk '{print $1}' "$BINARY" version 2>&1 # Remote path (curl-vps) ssh "shasum -a 256 $REMOTE_BINARY || sha256sum $REMOTE_BINARY" | awk '{print $1}' ssh "$REMOTE_BINARY version" 2>&1 ``` Record both for the report. The SHA256 lets us confirm later that a user reporting a bug is running the exact same artifact we tested. ## Phase 4 — Smoke tests Run these in order against `$BINARY` (or `ssh $REMOTE_BINARY` for curl-vps). **Always use the full binary path, never the `archon` on PATH**, so there is no ambiguity about which binary is under test. Each test should capture the full command output for the final report. If a test fails, continue to the next test (so the report is complete) but mark the overall result as FAIL. ### Test 1 — Version reports correctly ```bash "$BINARY" version ``` **Pass criteria:** - Exit code 0 - Output contains `Archon CLI v` - Output contains `Build: binary` (not `Build: source (bun)`) - Output contains a `Git commit: ` line **Common failures:** - Exit code non-zero → pino-pretty crash (#960) or similar startup failure - Wrong version reported → binary is stale or the build script failed to update `bundled-build.ts` - `Build: source (bun)` → `BUNDLED_IS_BINARY` was not set to `true` during the build (regression of #979) - No `Git commit:` line → build script did not capture the commit ### Test 2 — Bundled workflows load From 0.12.0, release binaries ship without providers, and a config that names one fails to load until it's installed. Run `"$BINARY" provider add claude codex pi` (the ones the config uses) before this test. That is the documented upgrade step, and it is part of what this test checks. Create a temporary git repository so the CLI has something to operate on: ```bash TESTREPO=/tmp/archon-test-repo-$(date +%s) mkdir -p "$TESTREPO" cd "$TESTREPO" git init -q git commit -q --allow-empty -m init "$BINARY" workflow list ``` **Pass criteria:** - Exit code 0 - Output lists the bundled `sdlc` pack workflows: archon-triage, archon-investigate, archon-plan, archon-implement, archon-pr, archon-review, archon-deliver, archon-ship - No errors about missing workflow files or JSON parse failures **Common failures:** - Empty list → bundled defaults were not embedded in the binary (regression of the `isBinaryBuild` detection path) - `Not in a git repository` → working directory handling bug - Parse errors → the embedded JSON is corrupt or stale ### Test 3 — An agent node runs (SDK round trip) **Prerequisite.** A compiled binary needs Claude Code installed on the host. It finds the binary from `CLAUDE_BIN_PATH`, then `assistants.claude.claudeBinaryPath` in `~/.archon/config.yaml`, then the native installer's path (`~/.local/bin/claude`). Run `"$BINARY" provider add claude` first (see Test 2). Use a one-node workflow in `$TESTREPO`, not a bundled one: every bundled `sdlc` workflow needs a forge remote and refuses a repository without one (`no_forge_remote`), which is not what this test is about. ```bash mkdir -p "$TESTREPO/.archon/workflows" cat > "$TESTREPO/.archon/workflows/hello.yaml" <<'YAML' name: hello description: One agent node that says hello nodes: - id: say prompt: "Say hello and nothing else." YAML cd "$TESTREPO" "$BINARY" workflow run hello --no-worktree 2>&1 | tee /tmp/archon-test-hello.log ``` **Pass criteria:** - Exit code 0 - The Claude subprocess spawns (no `spawn EACCES`, `ENOENT` or `process exited with code 1` in the early output) - A response is produced; any response proves the SDK round trip **Common failures:** - `Claude Code not found` → no binary at any of the three places above. Install Claude Code or set `CLAUDE_BIN_PATH`. - `Module not found "/Users/runner/..."` → regression of #1210: the resolver was bypassed and the SDK's `import.meta.url` fallback leaked a build-host path. Investigate `packages/providers/src/claude/provider.ts` and the resolver. - `Credential preflight failed` / `Credit balance is too low` → the login, not the binary: check `archon doctor` - `unable to determine transport target for "pino-pretty"` → #960 regression, binary crashes on TTY - `package.json not found (bad installation?)` → #961 regression, `isBinaryBuild` detection broken ### Test 3b — The resolver says where it found Claude ```bash "$BINARY" doctor 2>&1 | grep -F 'Claude binary' ``` **Pass criteria:** - One line naming the path and its source, such as `Claude binary: (via autodetect, spawns OK)` - No `Module not found` stack trace that names the CI filesystem The resolver's failure path (nothing configured and no native install) cannot be shown on a host where Claude Code is installed, because autodetect finds it. Do not uninstall Claude Code to test it; the resolver's own tests cover that path. ### Test 4 — Env-leak guard strips sensitive keys from .env Create a second throwaway repo with a fake sensitive key and a one-node workflow. The node compares the key it sees with the planted value inside the run and prints only a fixed marker, never a value: ```bash LEAKREPO=/tmp/archon-test-leak-$(date +%s) mkdir -p "$LEAKREPO/.archon/workflows" cd "$LEAKREPO" git init -q git commit -q --allow-empty -m init printf 'ANTHROPIC_API_KEY=sk-ant-test-fake\n' > .env cat > .archon/workflows/env-leak-probe.yaml <<'YAML' name: env-leak-probe description: Reports whether the target repo's ANTHROPIC_API_KEY reached the run nodes: - id: probe bash: | if [ "${ANTHROPIC_API_KEY:-}" = "sk-ant-test-fake" ]; then echo "probe: LEAKED" elif [ -n "${ANTHROPIC_API_KEY:-}" ]; then echo "probe: OTHER" else echo "probe: CLEAN"; fi YAML ``` **Pass criteria** (current behaviour — the guard **strips** silently, it does not refuse): - Run on a fresh scratch Archon home with the planted value also exported to the CLI (`ANTHROPIC_API_KEY=sk-ant-test-fake`) and no `DATABASE_URL`, the probe workflow completes and prints `probe: CLEAN`. The release binary never loads the repo's `.env` itself, so the exported key is what the guard must strip: it removes every key the repo's `.env` names, whatever its source. `probe: LEAKED` means the guard let it through - No `[archon] stripped` line on stderr: the guard no longer prints on every command - `archon doctor` in the repo names this repo's `.env` and the planted key: `Target repo .env: 1 key from /.env is kept out of runs, …: ANTHROPIC_API_KEY` The probe is the security check: it observes the run itself. The doctor line only checks the operator-facing report. The scratch home keeps your own configured key from masking or standing in for the planted one, and keeps the run off your database. ```bash PROBE_HOME=$(mktemp -d) probe() { env -u DATABASE_URL ANTHROPIC_API_KEY=sk-ant-test-fake ARCHON_HOME="$PROBE_HOME" "$BINARY" "$@"; } probe workflow run env-leak-probe --no-worktree > /tmp/archon-test-leak.log 2>&1 leak_exit=$? probe doctor > /tmp/archon-test-leak-doctor.log 2>&1 rm -rf "$PROBE_HOME" # $LEAKREPO may be a symlinked path (/tmp -> /private/tmp on macOS); the binary # reports the resolved form, so compare against that. resolved_repo=$(cd "$LEAKREPO" && pwd -P) expected="Target repo .env: 1 key from ${resolved_repo}/.env is kept out of runs" if [ "$leak_exit" -ne 0 ]; then echo "FAIL: workflow exited $leak_exit — the guard strips and proceeds, it should not abort" elif ! grep -qx 'probe: CLEAN' /tmp/archon-test-leak.log; then echo "FAIL: the run saw a key. Probe said: $(grep -o 'probe: [A-Z]*' /tmp/archon-test-leak.log || echo nothing)" elif grep -qF '[archon] stripped' /tmp/archon-test-leak.log; then echo "FAIL: the per-command strip line is back on stderr" elif grep -F "$expected" /tmp/archon-test-leak-doctor.log | grep -qF ': ANTHROPIC_API_KEY'; then echo "PASS: the planted key stayed out of the run, and doctor reports it for this repo" else echo "FAIL: expected doctor line absent. Got:" grep -F 'Target repo .env' /tmp/archon-test-leak-doctor.log || echo " (no doctor line at all)" fi ``` The doctor assertion is pinned to **this** repo, **this** count and **this** key. A looser pattern such as `[1-9][0-9]* keys .*\.env` passes on **any** positive count from **any** path, so a report belonging to a different repository reads as success. > **History — do not re-assert the old criteria.** This test previously expected a > *refusal* (`Cannot add codebase` / `Cannot run workflow`, non-zero exit), which > was the #1036/#1038/#983 behaviour. The current design is the two-layer strip > guard: the target repo's `.env` is read, dangerous keys are removed from the > environment handed to Archon subprocesses, and the run continues. On the 0.7.1 > test the old assertions reported FAIL against a binary whose guard was working > correctly — it stripped exactly the 1 planted key. Verify the security property > (the key never reaches the subprocess), not the obsolete remediation text. **Common failures:** - The probe prints `LEAKED` → the guard is not active; the `.env` reaches runs - Doctor reports `skip` (no `.env` keys) → the file was not found or not parsed - Doctor names the wrong file or repo → path resolution regression Clean up the leak test repo: ```bash rm -rf "$LEAKREPO" ``` ### Test 5 — Isolation list works (sanity check) In the same `$TESTREPO`: ```bash "$BINARY" isolation list ``` **Pass criteria:** - Exit code 0 - No errors (the list may be empty if no worktrees have been created, which is fine) This catches regressions in the isolation subsystem that would not surface from the other tests. ### Test 5b — The forge plugin from this release installs and serves GitHub The release workflow builds `archon-forge-github` for every platform and attaches it to the release, but no other test runs it. Every bundled `sdlc` workflow and the software factory pack reach GitHub only through it. Pin the tag: without one, `plugin add` installs the latest release's plugin, which is not the one under test when you check an older release. ```bash FORGE_HOME=$(mktemp -d) forge() { env -u DATABASE_URL ARCHON_HOME="$FORGE_HOME" "$BINARY" "$@"; } forge plugin add coleam00/Archon/plugins/forge-github@v forge plugin list forge forge check --json --data '{"host":"github.com","operations":["pr.view","pr.create","pr.merge"]}' rm -rf "$FORGE_HOME" ``` **Pass criteria:** - `plugin add` reports `v` and a sha256 - `plugin list` shows `coleam00/Archon/plugins/forge-github` at `v` - `forge check` exits 0 with `"ok": true` (it needs `gh auth login` or `GH_TOKEN`) **Common failures:** - `plugin add` finds no asset → the release job did not attach `archon-forge-github--` - `unsupported_op` → the plugin build lags the engine's operation list - A failed metadata handshake → the plugin binary crashes at start, as a compiled binary can ### Test 6 — Cleanup test repos ```bash rm -rf "$TESTREPO" ``` For `curl-vps` path, also clean up any remote test repos created via SSH. ## Phase 5 — Uninstall **Always run uninstall, even if Phase 4 failed.** The goal is to leave the system in the same state as before the test. ### Path: brew ```bash brew uninstall coleam00/archon/archon brew untap coleam00/archon ``` Verify the dev binary is still the default: ```bash which -a archon # should show only the ~/.bun/bin/archon path, not a brew path archon version | head -1 # should match the dev version captured in Phase 2 ``` **Restore `archon-stable` if it existed before the test** (dual-homebrew pattern — see Phase 2 item 4): ```bash if [ -n "$ARCHON_STABLE_WAS_INSTALLED" ]; then echo "Restoring archon-stable (detected before test)..." brew tap coleam00/archon brew install coleam00/archon/archon BREW_BIN="$(brew --prefix)/bin" if [ -e "$BREW_BIN/archon" ]; then mv "$BREW_BIN/archon" "$BREW_BIN/archon-stable" echo "archon-stable restored: $(archon-stable version 2>/dev/null | head -1)" else echo "WARNING: brew install succeeded but $BREW_BIN/archon missing — check formula" fi fi ``` > **Note on the restored version**: this reinstalls from whatever the tap currently ships, which is typically the release you just tested (so `archon-stable` ends up at the newly-tested version). That's usually what the operator wants — you just verified the new release works, and you want `archon-stable` pointed at it. If you were testing an older version for back-version QA, the restored `archon-stable` will be the *current* tap formula, not the pre-test version. For that rare case, the operator should re-run `brew-upgrade-archon` manually after the test. ### Path: curl-mac ```bash rm -rf "$INSTALL_DIR" ``` ### Path: curl-vps ```bash ssh "sudo rm -f /usr/local/bin/archon || rm -f \$HOME/.local/bin/archon" ``` Optional: the user may want to LEAVE the VPS binary installed for ongoing QA. Ask before removing. ## Phase 6 — Report Produce a structured report with: - **Header**: release version tested, install path, timestamp, SHA256 of the tested binary - **Environment**: dev binary path + version (proof the dev install was not disturbed) - **Test results table**: one row per test with PASS / FAIL / SKIP - **Captured output**: for any FAIL, include the exact command, exit code, and last 20 lines of stderr/stdout - **Overall verdict**: PASS if all tests passed, FAIL if any test failed - **Next steps**: if FAIL, suggest concrete actions (file a hotfix issue, re-tag, check the build workflow, etc.) Example PASS report: ``` Test Release Report — archon v0.3.1 via brew ──────────────────────────────────────────── Tested at: 2026-04-08 15:42 UTC Binary SHA: e62eb73547b3740d56f242859b434a91d3830360a0d18f14de383da0fd7a0be6 Binary path: /opt/homebrew/Cellar/archon/0.3.1/bin/archon Dev binary: /Users/rasmus/.bun/bin/archon → ../install/.../cli.ts (unchanged) [PASS] Test 1 version reports 0.3.1, Build: binary, commit abc1234 [PASS] Test 2 workflow list returned 21 bundled workflows [PASS] Test 3 workflow run archon-investigate produced output [PASS] Test 4 env-leak guard stripped exactly the planted key [PASS] Test 5 isolation list executed without errors [PASS] Cleanup brew uninstall + untap clean, dev binary unchanged Overall: PASS This release is safe to announce. Next steps: - Update release notes on GitHub if not done already - Announce on whatever channels you use ``` Example FAIL report: ``` Test Release Report — archon v0.3.1 via curl-vps ──────────────────────────────────────────────── Tested at: 2026-04-08 15:42 UTC Binary SHA: 0cf83e15e6af228e3c3473467ca30fa7525b6d7069818d85f97a115ea703d708 Binary path: user@vps:/usr/local/bin/archon Dev binary: /Users/rasmus/.bun/bin/archon (unchanged) [PASS] Test 1 version reports 0.3.1, Build: binary [FAIL] Test 2 workflow list returned 0 workflows Command: archon workflow list Exit: 0 Output: Discovering workflows in: /tmp/archon-test-repo-1712590923 Found 0 workflow(s): [SKIP] Test 3 SDK test skipped because Test 2 failed [SKIP] Test 4 env-leak guard test skipped because Test 2 failed [PASS] Test 5 isolation list executed without errors [PASS] Cleanup VPS binary removed Overall: FAIL Likely cause: bundled workflows were not embedded in the binary. Check the build workflow for missing asset embedding, or verify that BUNDLED_WORKFLOWS in packages/workflows/src/defaults/bundled-defaults.ts was populated at build time. Next steps: 1. File a P0 hotfix issue with the captured output 2. Do NOT announce v0.3.1 until the hotfix ships as v0.3.2 3. Consider adding a CI guard that blocks releases if BUNDLED_WORKFLOWS is empty ``` ## Key behaviors - **Never touch the dev `bun link` binary.** Always use the installed binary path for Phase 4 tests. Verify before and after. - **Clean up on failure.** If Phase 4 fails mid-way, still run Phase 5 so the next run starts clean. - **Capture SHA256 immediately after install.** This lets bug reports reference the exact artifact under test. - **Explicit confirmation before install.** Never surprise the user by installing a second binary. - **Report the dev binary state in both preamble and postamble.** Proof that the test did not disturb the dev environment. - **Exit non-zero if any test failed.** The skill should propagate failure so automated wrappers (CI, scripts) can detect it. ## Related - `scripts/build-binaries.sh` — builds the binary artifacts that end up in releases - `.github/workflows/release.yml` — builds and publishes the binary on tag push - `homebrew/archon.rb` — Homebrew tap formula (updated per release) - `scripts/install.sh` — the curl install script - `scripts/install-local.sh` / `install-local.ps1` — local-file install harnesses (for pre-release QA of binaries built from a branch, not from GitHub releases) - `/release` skill — the release procedure itself (opposite side of the flow)