feat(self-hosted): run Orchestrator on Linux arm64 hosts (#8901)

* feat(self-hosted): run Orchestrator on Linux arm64 hosts

Linux arm64 machines (cloud VMs such as AWS Graviton) could not run
Orchestrator: every Linux release artifact is x64, the bootstrap refused
anything but x86_64, and the only Linux build is the Electron app, which
needs a display and GUI libraries a headless server does not have.

Those machines do not need the GUI. They can run as a self-hosted remote
host, which only needs the daemon, the bundled Node ACP runtime and tmux.
build:host already packages exactly that, so:

- Add linux-arm64-host.yml, which builds and smoke-tests
  ao-host-linux-arm64.tar.gz natively on ubuntu-22.04-arm (same glibc
  baseline as the x64 build). build-artifacts.yml calls it for every
  release and merges its digest into digests.json; pull requests that
  touch the package's inputs build it too.
- setup-self-hosted.sh downloads and verifies that package on aarch64
  instead of exiting, through the same safe extraction as --bundle. A
  release without it fails with a hint to build from source.
- bootstrap-self-hosted.sh accepts aarch64 and fetches arm64 Go (pinned
  go.dev checksum) and Node for branch builds.
- Docs: self-hosted setup supports Ubuntu 24.04 on x64 or arm64.

Refs #8507

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(self-hosted): build arm64 host on daemon changes, document fallback

- linux-arm64-host.yml also runs for PRs that change backend/ (minus Go
  tests) or frontend/package.json: the daemon is built from backend/ and
  package.json holds the stamped version and build:* commands, so a break
  that only shows on arm64 surfaces before a release depends on it.
- The self-hosted guide, the in-app remote-access page and the remote-host
  skill say what to do on arm64 when a release predates the host package:
  rerun the bootstrap with --source-ref main.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* chore(self-hosted): trim comments to the reasons the code cannot show

Drop comments that restated the code or each other, and shorten the rest
to one line where they explain something non-obvious.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Dhruv SharmaandClaude Opus 5.5 authored and GitHub committed 2026-11-23 08:34:39 +05:30
1 parent acddfae8c6
commit b42095d543
10 files changed
+305 -39

No files matched your search

+10 -2
View File
@@ -3,7 +3,8 @@ name: Desktop build artifacts
# Dispatchable unsigned desktop build for an external release conductor.
# Builds the Electron app for all four platforms at a pinned ref with a
# caller-supplied version, uploads each installer as a short-lived run
# caller-supplied version, plus the headless Linux arm64 host package
# (linux-arm64-host.yml), uploads each as a short-lived run
# artifact, and emits a digests.json artifact (a flat JSON object mapping
# each artifact filename to its sha256 hex string) that the conductor reads
# to verify hashes before signing. Creates no release, references no secrets.
@@ -259,10 +260,17 @@ jobs:
retention-days: 1
if-no-files-found: error
# Not in the matrix: Linux arm64 has no desktop app, only the headless host package.
host-linux-arm64:
uses: ./.github/workflows/linux-arm64-host.yml
with:
ref: ${{ inputs.ref }}
version: ${{ inputs.version }}
# Merge the per-platform digest fragments into one digests.json artifact so
# a downstream consumer reads every expected hash from a single file.
digests:
needs: build
needs: [build, host-linux-arm64]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
+132
View File
@@ -0,0 +1,132 @@
name: Linux arm64 host package
# There is no arm64 Linux desktop app, so arm64 hosts install this headless
# package (daemon, Node ACP runtime, tmux) with setup-self-hosted.sh. Pull
# requests that touch its inputs build it too, so a break shows before a release.
on:
workflow_call:
inputs:
ref:
type: string
required: true
version:
type: string
required: true
pull_request:
paths:
- ".github/workflows/linux-arm64-host.yml"
- "backend/**"
- "!backend/**/*_test.go"
- "frontend/package.json"
- "frontend/acp-runtime/**"
- "frontend/scripts/build-acp-runtime*.mjs"
- "frontend/scripts/build-daemon.mjs"
- "frontend/scripts/build-host-bundle.mjs"
- "frontend/scripts/build-tmux.mjs"
- "frontend/scripts/go-version.mjs"
- "frontend/scripts/tmux-version.mjs"
- "scripts/setup-self-hosted.sh"
permissions:
contents: read
# run_id keeps release builds out of the cancel group; only PR runs share one.
concurrency:
group: linux-arm64-host-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: true
jobs:
build:
name: Build linux-arm64 host package
# Native, not cross-built: tmux compiles from source and Node is per-arch.
# 22.04 matches the x64 build's glibc baseline.
runs-on: ubuntu-22.04-arm
timeout-minutes: 30
env:
# build-daemon.mjs bakes it in, so `ao remote-host link` signs in with the
# desktop's WorkOS client.
VITE_WORKOS_CLIENT_ID: ${{ vars.VITE_WORKOS_CLIENT_ID }}
defaults:
run:
working-directory: frontend
shell: bash
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.ref }}
- uses: actions/setup-node@v4
with:
node-version: 24
- uses: actions/setup-go@v5
with:
go-version-file: backend/go.mod
cache-dependency-path: backend/go.sum
- name: Verify WorkOS build configuration
if: inputs.version != ''
run: |
if [ -z "$VITE_WORKOS_CLIENT_ID" ]; then
echo "::error::Repository variable VITE_WORKOS_CLIENT_ID is required for release artifacts." >&2
exit 1
fi
- name: Stamp version
if: inputs.version != ''
env:
BUILD_VERSION: ${{ inputs.version }}
run: |
node -e "const v=process.env.BUILD_VERSION.split('+')[0]; const fs=require('fs'); const p=require('./package.json'); p.version=v; fs.writeFileSync('./package.json', JSON.stringify(p,null,'\t')+'\n');"
- name: Install build tools
run: |
sudo apt-get update
sudo apt-get install -y build-essential file pkg-config
# No frontend `npm ci`: these scripts need only Node built-ins.
- name: Build host package
run: |
npm run build:daemon
npm run build:tmux
npm run build:acp-runtime
npm run build:host
- name: Smoke-test host package
run: |
set -euo pipefail
check="$RUNNER_TEMP/host-check"
mkdir -p "$check"
tar -xzf dist-host/ao-host-linux-arm64.tar.gz -C "$check"
resources="$check/resources"
info="$(file "$resources/daemon/ao")"
echo "$info"
[[ "$info" == *"ARM aarch64"* ]] || { echo "::error::daemon is not an arm64 binary" >&2; exit 1; }
expected="$(node -p "require('./package.json').version")"
actual="$("$resources/daemon/ao" version | awk '{print $1}')"
if [ "$actual" != "$expected" ]; then
echo "::error::ao version reports $actual, expected $expected" >&2
exit 1
fi
"$resources/daemon/ao" remote-host --help >/dev/null
"$resources/acp-runtime/node/bin/node" --version
"$resources/tmux/bin/tmux" -V
- name: Collect artifact and compute digest
run: |
set -euo pipefail
name="ao-host-linux-arm64.tar.gz"
mkdir -p dist-artifact
cp "dist-host/$name" "dist-artifact/$name"
hash="$(openssl dgst -sha256 "dist-artifact/$name" | awk '{print $NF}')"
jq -n --arg f "$name" --arg h "$hash" '{($f): $h}' > dist-artifact/linux-arm64-host.digest.json
echo "linux-arm64-host: $name sha256=$hash" >> "$GITHUB_STEP_SUMMARY"
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: linux-arm64-host
path: frontend/dist-artifact/ao-host-linux-arm64.tar.gz
# A week for PR builds, so someone can try one on an arm64 machine.
retention-days: ${{ inputs.version != '' && 1 || 7 }}
if-no-files-found: error
- name: Upload digest
uses: actions/upload-artifact@v4
with:
# build-artifacts.yml's digests job merges every digest-* artifact.
name: digest-linux-arm64-host
path: frontend/dist-artifact/linux-arm64-host.digest.json
retention-days: 1
if-no-files-found: error
@@ -44,8 +44,8 @@ ao remote-host require-device-credentials on|off
## Set up a fresh VM over SSH
The VM needs Ubuntu 24.04 x64, outbound internet, and a non-root user with
`sudo`. No inbound ports.
The VM needs Ubuntu 24.04 on x64 or arm64, outbound internet, and a non-root
user with `sudo`. No inbound ports.
1. Install Orchestrator and its service. With no terminal the installer skips sign-in and
prints pairing details; do not repeat its `Pairing code:` line. `pipefail` makes
@@ -55,7 +55,10 @@ The VM needs Ubuntu 24.04 x64, outbound internet, and a non-root user with
ssh USER@HOST 'set -o pipefail; curl -fsSL https://raw.githubusercontent.com/OrchestratorInc/agent-orchestrator/main/scripts/bootstrap-self-hosted.sh | bash'
```
This installs stable. For nightly, end it with `bash -s -- --nightly`.
This installs stable. For nightly, end it with `bash -s -- --nightly`. On
arm64, if it stops with `No verified release asset: ao-host-linux-arm64.tar.gz`,
that release predates arm64 support: end it with `bash -s -- --source-ref main`
to build from the main branch (several minutes).
2. Start the sign-in in the background, then read the link:
+10 -1
View File
@@ -5,7 +5,8 @@ AO account sign-in is required for desktop remote hosts; Cloud sandbox execution
## Set up a VM
You need a fresh Ubuntu 24.04 x64 machine with outbound internet and a
You need a fresh Ubuntu 24.04 machine, x64 or arm64 (for example an AWS
Graviton instance), with outbound internet and a
non-root user with `sudo`. No inbound ports: devices reach the VM through a
Cloudflare tunnel.
@@ -26,6 +27,14 @@ Cloudflare tunnel.
instead, end the command with `bash -s -- --nightly`. On an image without
curl, run `sudo apt-get install -y curl` first.
On arm64, if the installer stops with `No verified release asset:
ao-host-linux-arm64.tar.gz`, that release predates arm64 support. Build
from the main branch instead (this takes several minutes):
```bash
curl -fsSL https://raw.githubusercontent.com/OrchestratorInc/agent-orchestrator/main/scripts/bootstrap-self-hosted.sh | bash -s -- --source-ref main
```
3. Sign in. The installer ends with a sign-in link and a QR code. Open the link
on any device, or scan the QR code with your phone, check that the page
shows the same code as the terminal, and sign in to your AO account. The
+3 -2
View File
@@ -35,8 +35,9 @@ is never bypassed by publishing directly from this repository.
`.github/workflows/build-artifacts.yml` remains intentionally dispatchable. It
accepts an explicit public ref/SHA and version, builds the four supported
desktop targets, and uploads unsigned workflow artifacts plus their SHA-256
digests. It has read-only repository permissions, does not use release signing
desktop targets plus the headless Linux arm64 host package
(`ao-host-linux-arm64.tar.gz`, from `linux-arm64-host.yml`), and uploads
unsigned workflow artifacts plus their SHA-256 digests. It has read-only repository permissions, does not use release signing
secrets, and does not create, edit, or publish GitHub Releases.
The private conductor pins the immutable source SHA before dispatch and treats
+16
View File
@@ -181,6 +181,22 @@ run: |
expect(contents).toContain("frontend/.vite/renderer/main_window/assets/*.js.map");
});
it("builds the Linux arm64 host package natively in every release build", async () => {
const builder = await readFile(artifactBuilder, "utf8");
const host = await readFile(path.join(workflowsDirectory, "linux-arm64-host.yml"), "utf8");
expect(builder).toContain("uses: ./.github/workflows/linux-arm64-host.yml");
expect(builder).toContain("needs: [build, host-linux-arm64]");
expect(host).toContain("workflow_call:");
expect(host).toContain("runs-on: ubuntu-22.04-arm");
expect(host).toMatch(/permissions:\s*\n\s*contents:\s*read/);
expect(host).not.toContain("${{ secrets.");
// setup-self-hosted.sh downloads this exact asset name.
expect(host).toContain("name: linux-arm64-host\n path: frontend/dist-artifact/ao-host-linux-arm64.tar.gz");
expect(host).toContain("name: digest-linux-arm64-host");
expect(host).toContain("github.event.pull_request.number || github.run_id");
});
it("takes Teams for stable builds only from the VITE_AO_TEAMS repository variable", async () => {
const contents = await readFile(artifactBuilder, "utf8");
@@ -23,13 +23,13 @@ When both computers are signed in to the same AO account, you do not need the ad
## Connect a VM or other headless machine
On a fresh Ubuntu 24.04 x64 VM, sign in over SSH as a non-root user with `sudo` and run:
On a fresh Ubuntu 24.04 VM, x64 or arm64 (for example an AWS Graviton instance), sign in over SSH as a non-root user with `sudo` and run:
```bash
curl -fsSL https://raw.githubusercontent.com/OrchestratorInc/agent-orchestrator/main/scripts/bootstrap-self-hosted.sh | bash
```
This installs the latest stable AO; for the newest nightly, end the command with `bash -s -- --nightly`.
This installs the latest stable AO; for the newest nightly, end the command with `bash -s -- --nightly`. On arm64, if the installer stops with `No verified release asset: ao-host-linux-arm64.tar.gz`, that release predates arm64 support: end the command with `bash -s -- --source-ref main` to build from the main branch instead.
It installs AO as a service that keeps running after you log out, then prints a sign-in link and a QR code. Open the link on any device, or scan the code with your phone, check that the page shows the same code as the terminal, and sign in to your AO account. The VM joins your account the same way as a desktop, at a fixed address, and keeps none of your sign-in. Your desktops and phones signed in to that account list it within about 30 seconds; the desktop looks for new machines only while its window is open.
+16 -10
View File
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
# Fresh Ubuntu x64 entry point. The lower-level installer owns AO releases and service setup.
# Fresh Ubuntu (x64 or arm64) entry point. The lower-level installer owns AO releases and service setup.
set -euo pipefail
# Braced so bash reads the whole script before running any of it: a download
@@ -28,7 +28,13 @@ if "$nightly" && [[ -n "$source_ref" ]]; then
fi
[[ "$(id -u)" != 0 ]] || { printf '%s\n' 'Run as the host user, not root.' >&2; exit 1; }
[[ "$(uname -s):$(uname -m)" == Linux:x86_64 ]] || { printf '%s\n' 'This bootstrap supports Ubuntu x64 only.' >&2; exit 1; }
# go_sha256 is go.dev's official checksum of go${go_version}.linux-${go_arch}.tar.gz.
go_version=1.27.4
case "$(uname -s):$(uname -m)" in
Linux:x86_64) go_arch=amd64 node_arch=x64 go_sha256=7226736c2339719cda28fbf3a54d71aa63bcefe376e98cef00034268dab24840 ;;
Linux:aarch64|Linux:arm64) go_arch=arm64 node_arch=arm64 go_sha256=3392582988a273a87ab5043ee1b2c9c17a2c3c00580bf9326c47a2e0aaaeac92 ;;
*) printf '%s\n' 'This bootstrap supports Ubuntu on x64 or arm64 only.' >&2; exit 1 ;;
esac
command -v apt-get >/dev/null || { printf '%s\n' 'This bootstrap requires Ubuntu apt-get.' >&2; exit 1; }
[[ -z "$source_ref" || "$source_ref" =~ ^[a-zA-Z0-9][a-zA-Z0-9._/-]*$ ]] || {
printf '%s\n' 'Invalid source branch.' >&2; exit 2;
@@ -60,23 +66,23 @@ else
tools="$HOME/.local/ao-build-tools"
mkdir -p "$tools"
# Replace a cached Go older than the one backend/go.mod requires; keep a newer one.
go_version=1.27.4
cached_go="$(GOTOOLCHAIN=local "$tools/go/bin/go" env GOVERSION 2>/dev/null || true)"
if [[ "$(printf '%s\n' "$go_version" "${cached_go#go}" | sort -V | head -n1)" != "$go_version" ]]; then
rm -rf "$tools/go"
curl -fsSL "https://go.dev/dl/go${go_version}.linux-amd64.tar.gz" -o "$stage/go.tar.gz"
printf '%s %s\n' 7226736c2339719cda28fbf3a54d71aa63bcefe376e98cef00034268dab24840 "$stage/go.tar.gz" | sha256sum -c -
curl -fsSL "https://go.dev/dl/go${go_version}.linux-${go_arch}.tar.gz" -o "$stage/go.tar.gz"
printf '%s %s\n' "$go_sha256" "$stage/go.tar.gz" | sha256sum -c -
tar -xzf "$stage/go.tar.gz" -C "$tools"
fi
if [[ ! -x "$tools/node-v22.23.5-linux-x64/bin/node" ]]; then
curl -fsSL https://nodejs.org/dist/v22.23.5/node-v22.23.5-linux-x64.tar.xz -o "$stage/node.tar.xz"
node_dist="node-v22.23.5-linux-${node_arch}"
if [[ ! -x "$tools/$node_dist/bin/node" ]]; then
curl -fsSL "https://nodejs.org/dist/v22.23.5/$node_dist.tar.xz" -o "$stage/node.tar.xz"
curl -fsSL https://nodejs.org/dist/v22.23.5/SHASUMS256.txt -o "$stage/SHASUMS256.txt"
expected="$(awk '$2 == "node-v22.23.5-linux-x64.tar.xz" { print $1 }' "$stage/SHASUMS256.txt")"
expected="$(awk -v name="$node_dist.tar.xz" '$2 == name { print $1 }' "$stage/SHASUMS256.txt")"
[[ "$expected" =~ ^[0-9a-f]{64}$ ]] || { printf '%s\n' 'Node checksum missing.' >&2; exit 1; }
printf '%s %s\n' "$expected" "$stage/node.tar.xz" | sha256sum -c -
tar -xJf "$stage/node.tar.xz" -C "$tools"
fi
export PATH="$tools/go/bin:$tools/node-v22.23.5-linux-x64/bin:$PATH"
export PATH="$tools/go/bin:$tools/$node_dist/bin:$PATH"
git clone --depth 1 --single-branch --branch "$source_ref" https://github.com/OrchestratorInc/agent-orchestrator.git "$stage/source"
(
cd "$stage/source/frontend"
@@ -88,7 +94,7 @@ else
npm run build:host
)
installer="$stage/source/scripts/setup-self-hosted.sh"
bundle="$stage/source/frontend/dist-host/ao-host-linux-x64.tar.gz"
bundle="$stage/source/frontend/dist-host/ao-host-linux-${node_arch}.tar.gz"
fi
args=()
+26 -17
View File
@@ -1,5 +1,6 @@
#!/usr/bin/env bash
# Install AO's daemon resources from a desktop release or a locally built host bundle.
# Install AO's daemon resources from a release (the desktop app, or the Linux
# arm64 host package) or a locally built host bundle.
set -euo pipefail
usage() {
@@ -79,17 +80,14 @@ case "$platform:$arch" in
Darwin:arm64) asset='agent-orchestrator-darwin-arm64.zip' ;;
Darwin:x86_64) asset='agent-orchestrator-darwin-x64.zip' ;;
Linux:x86_64) asset='agent-orchestrator-linux-x64.AppImage' ;;
Linux:aarch64|Linux:arm64) if [[ -z "$bundle" ]]; then
printf 'No published desktop artifact for %s/%s; pass --bundle from a native build.\n' "$platform" "$arch" >&2
exit 1
fi ;;
# No arm64 Linux desktop app: releases carry the headless host package instead.
Linux:aarch64|Linux:arm64) asset='ao-host-linux-arm64.tar.gz' ;;
*) printf 'Unsupported host platform: %s/%s\n' "$platform" "$arch" >&2; exit 1 ;;
esac
command -v git >/dev/null || { printf '%s\n' 'git is required for Orchestrator projects and worktrees.' >&2; exit 1; }
if [[ -n "$bundle" ]]; then
[[ -f "$bundle" ]] || { printf 'Bundle not found: %s\n' "$bundle" >&2; exit 1; }
python3 - "$bundle" <<'PY'
extract_host_package() {
python3 - "$1" <<'PY'
import posixpath, sys, tarfile
with tarfile.open(sys.argv[1], 'r:gz') as archive:
for entry in archive:
@@ -103,8 +101,13 @@ with tarfile.open(sys.argv[1], 'r:gz') as archive:
elif not (entry.isfile() or entry.isdir()):
raise SystemExit(f'Unsafe host bundle entry: {name}')
PY
tar -xzf "$bundle" -C "$stage"
tar -xzf "$1" -C "$stage"
resources="$stage/resources"
}
if [[ -n "$bundle" ]]; then
[[ -f "$bundle" ]] || { printf 'Bundle not found: %s\n' "$bundle" >&2; exit 1; }
extract_host_package "$bundle"
else
command -v curl >/dev/null || { printf '%s\n' 'curl is required.' >&2; exit 1; }
metadata="$stage/release.json"
@@ -122,7 +125,9 @@ if sys.argv[3] == 'true':
release = max(candidates, key=lambda r: r['published_at'])
item = next((a for a in release.get('assets', []) if a['name'] == sys.argv[2]), None)
if not item or not re.fullmatch(r'sha256:[0-9a-f]{64}', item.get('digest') or ''):
raise SystemExit(f'No verified release asset: {sys.argv[2]}')
hint = ('; this release predates Linux arm64 support: build from source with'
' bootstrap-self-hosted.sh --source-ref main, or pass --bundle') if sys.argv[2].startswith('ao-host-') else ''
raise SystemExit(f'No verified release asset: {sys.argv[2]}{hint}')
print(f"Downloading Orchestrator release: {release['tag_name']}", file=sys.stderr)
print(item['browser_download_url'])
print(item['digest'][7:])
@@ -138,15 +143,19 @@ PY
actual="$(sha256sum "$archive" | awk '{print $1}')"
fi
[[ "$actual" == "$digest" ]] || { printf '%s\n' 'Release SHA-256 mismatch.' >&2; exit 1; }
if [[ "$platform" == Darwin ]]; then
ditto -x -k "$archive" "$stage/extracted"
if [[ "$asset" == *.tar.gz ]]; then
extract_host_package "$archive"
else
mkdir "$stage/extracted"
(cd "$stage/extracted" && chmod +x "$archive" && "$archive" --appimage-extract >/dev/null)
if [[ "$platform" == Darwin ]]; then
ditto -x -k "$archive" "$stage/extracted"
else
mkdir "$stage/extracted"
(cd "$stage/extracted" && chmod +x "$archive" && "$archive" --appimage-extract >/dev/null)
fi
mapfile_path="$(find "$stage/extracted" \( -path '*/resources/daemon/ao' -o -path '*/Resources/daemon/ao' \) -type f -print -quit)"
[[ -n "$mapfile_path" ]] || { printf '%s\n' 'Orchestrator daemon missing from release artifact.' >&2; exit 1; }
resources="$(dirname "$(dirname "$mapfile_path")")"
fi
mapfile_path="$(find "$stage/extracted" \( -path '*/resources/daemon/ao' -o -path '*/Resources/daemon/ao' \) -type f -print -quit)"
[[ -n "$mapfile_path" ]] || { printf '%s\n' 'Orchestrator daemon missing from release artifact.' >&2; exit 1; }
resources="$(dirname "$(dirname "$mapfile_path")")"
fi
ao="$resources/daemon/ao"
+84 -2
View File
@@ -15,7 +15,7 @@ done
printf '%s\n' '#!/bin/sh' 'case "$1" in' \
' -u) echo 1000 ;;' ' -un) echo ao ;;' 'esac' > "$tmp/bin/id"
printf '%s\n' '#!/bin/sh' 'case "$1" in' \
' -s) echo Linux ;;' ' -m) echo x86_64 ;;' 'esac' > "$tmp/bin/uname"
' -s) echo Linux ;;' ' -m) echo "${TEST_UNAME_M:-x86_64}" ;;' 'esac' > "$tmp/bin/uname"
printf '%s\n' '#!/bin/sh' 'case "$1" in' \
' status)' \
' if [ -n "${TEST_AO_BLOCK_FILE:-}" ]; then' \
@@ -150,6 +150,88 @@ PY
grep -q 'cannot be combined' "$tmp/out"
done
;;
release-arm64)
for tool in awk find shasum; do
ln -s "$(command -v "$tool")" "$tmp/bin/$tool"
done
COPYFILE_DISABLE=1 tar -czf "$tmp/host-package.tar.gz" -C "$tmp/pkg" resources
digest="$(shasum -a 256 "$tmp/host-package.tar.gz" | awk '{print $1}')"
python3 - "$tmp" "$digest" <<'PY'
import json, pathlib, sys
root = pathlib.Path(sys.argv[1])
appimage = {"name": "agent-orchestrator-linux-x64.AppImage", "browser_download_url": "https://example.test/x64", "digest": "sha256:" + "1" * 64}
host = {"name": "ao-host-linux-arm64.tar.gz", "browser_download_url": "https://example.test/arm64", "digest": "sha256:" + sys.argv[2]}
release = {"tag_name": "v1.0.0", "prerelease": False, "draft": False, "published_at": "2026-10-10T00:00:00Z"}
(root / "arm64.json").write_text(json.dumps(dict(release, assets=[appimage, host])))
(root / "arm64-missing.json").write_text(json.dumps(dict(release, assets=[appimage])))
PY
printf '%s\n' '#!/bin/sh' \
'while [ "$#" -gt 0 ]; do case "$1" in -o) out="$2"; shift 2 ;; https://*) url="$1"; shift ;; --retry) shift 2 ;; *) shift ;; esac; done' \
'echo "$url" >> "$TEST_CURL_LOG"' \
'case "$url" in' \
' */releases/latest) cp "$TEST_RELEASE_FIXTURES/$TEST_RELEASE_CASE.json" "$out" ;;' \
' https://example.test/arm64) cp "$TEST_RELEASE_FIXTURES/host-package.tar.gz" "$out" ;;' \
' *) exit 1 ;;' 'esac' > "$tmp/bin/curl"
chmod +x "$tmp/bin/curl"
for fixture in arm64 arm64-missing; do
result=0
env PATH="$tmp/bin" TEST_UNAME_M=aarch64 AO_HOST_INSTALL_DIR="$tmp/host-$fixture" \
TEST_RELEASE_FIXTURES="$tmp" TEST_RELEASE_CASE="$fixture" TEST_CURL_LOG="$tmp/$fixture.urls" \
/bin/bash "$script" --install-only > "$tmp/out" 2>&1 || result=$?
if [[ "$fixture" == arm64 ]]; then
[[ "$result" == 0 ]] || { cat "$tmp/out" >&2; exit 1; }
[[ -x "$(readlink "$tmp/host-$fixture/current")/resources/daemon/ao" ]]
grep -Fxq https://example.test/arm64 "$tmp/$fixture.urls"
else
[[ "$result" != 0 && ! -e "$tmp/host-$fixture/current" ]]
grep -q 'No verified release asset: ao-host-linux-arm64.tar.gz; this release predates Linux arm64 support' "$tmp/out" || { cat "$tmp/out" >&2; exit 1; }
fi
done
result=0
env PATH="$tmp/bin" TEST_UNAME_M=riscv64 AO_HOST_INSTALL_DIR="$tmp/host-riscv64" \
/bin/bash "$script" --install-only > "$tmp/out" 2>&1 || result=$?
[[ "$result" == 1 ]] && grep -q 'Unsupported host platform: Linux/riscv64' "$tmp/out" || { cat "$tmp/out" >&2; exit 1; }
;;
bootstrap-arch)
bootstrap="${script%/*}/bootstrap-self-hosted.sh"
ln -s /bin/bash "$tmp/bin/bash"
for tool in head sort; do
ln -s "$(command -v "$tool")" "$tmp/bin/$tool"
done
for tool in apt-get sudo systemctl cloudflared; do
printf '%s\n' '#!/bin/sh' 'exit 0' > "$tmp/bin/$tool"
chmod +x "$tmp/bin/$tool"
done
printf '%s\n' '#!/bin/sh' 'printf "%s\n" "$@" > "$TEST_INSTALL_ARGS"' > "$tmp/installer"
# The installer download succeeds; a branch build stops at its first toolchain download.
printf '%s\n' '#!/bin/sh' 'echo "$2" >> "$TEST_CURL_LOG"' \
'case "$2" in https://go.dev/*|https://nodejs.org/*) exit 1 ;; esac' \
'cp "$TEST_INSTALLER" "$4"' > "$tmp/bin/curl"
chmod +x "$tmp/bin/curl"
for machine in x86_64 aarch64 riscv64; do
run_bootstrap() {
env PATH="$tmp/bin" HOME="$tmp/home-$machine" TEST_UNAME_M="$machine" TEST_INSTALLER="$tmp/installer" \
TEST_INSTALL_ARGS="$tmp/args-$machine" TEST_CURL_LOG="$tmp/curl-$machine" \
/bin/bash "$bootstrap" "$@" > "$tmp/out" 2>&1
}
result=0
run_bootstrap || result=$?
if [[ "$machine" == riscv64 ]]; then
[[ "$result" == 1 ]] && grep -q 'supports Ubuntu on x64 or arm64 only' "$tmp/out" || { cat "$tmp/out" >&2; exit 1; }
[[ ! -e "$tmp/args-$machine" ]]
continue
fi
[[ "$result" == 0 && -f "$tmp/args-$machine" ]] || { cat "$tmp/out" >&2; exit 1; }
go_arch=amd64
[[ "$machine" == aarch64 ]] && go_arch=arm64
result=0
run_bootstrap --source-ref main || result=$?
[[ "$result" != 0 ]]
grep -q "^https://go.dev/dl/go[0-9.]*\.linux-$go_arch\.tar\.gz$" "$tmp/curl-$machine" || {
cat "$tmp/out" "$tmp/curl-$machine" >&2; exit 1;
}
done
;;
bad-tmux)
chmod -x "$tmp/pkg/resources/tmux/bin/tmux"
COPYFILE_DISABLE=1 tar -czf "$bundle" -C "$tmp/pkg" resources
@@ -432,6 +514,6 @@ PY
! grep -q 'Pair this host' "$tmp/out" || { cat "$tmp/out" >&2; exit 1; }
fi
;;
*) printf 'Usage: %s {release-channels|bootstrap-nightly|bad-tmux|no-systemd|inactive-systemd|prune|failed-restarts|failed-first-install|failed-readiness|failed-mac-bootstrap|failed-mac-readiness|failed-mac-first|relative-current|concurrent|interrupted|piped|tunnel-pairing|tunnel-pairing-code|tunnel-unavailable|tunnel-linked}\n' "$0" >&2; exit 2 ;;
*) printf 'Usage: %s {release-channels|bootstrap-nightly|release-arm64|bootstrap-arch|bad-tmux|no-systemd|inactive-systemd|prune|failed-restarts|failed-first-install|failed-readiness|failed-mac-bootstrap|failed-mac-readiness|failed-mac-first|relative-current|concurrent|interrupted|piped|tunnel-pairing|tunnel-pairing-code|tunnel-unavailable|tunnel-linked}\n' "$0" >&2; exit 2 ;;
esac
printf 'PASS %s\n' "$1"