Skip to content

Commit 44a6e76

Browse files
la14-1spawn-qa-bot
andauthored
fix(zeroclaw): direct binary download from pinned release to fix install timeout (#2554)
ZeroClaw's latest GitHub release (v0.1.9a) ships no binary assets. The --prefer-prebuilt bootstrap path hits a 404, falls back to Rust source compilation, and exceeds the 600s install timeout — causing zeroclaw to fail on all clouds (digitalocean, gcp, hetzner, sprite). Fix: replace the bootstrap invocation with a direct curl download from v0.1.7-beta.30 (the last release that ships linux-gnu prebuilt binaries) into ~/.local/bin. This completes in seconds vs ~20 minutes for a source build, and removes the swap-space setup step that was only needed for memory-intensive compilation. Also remove the now-unused ensureSwapSpace function and update the E2E verify check to also look in ~/.local/bin for the zeroclaw binary. -- qa/e2e-tester Co-authored-by: spawn-qa-bot <qa@openrouter.ai>
1 parent f5def41 commit 44a6e76

2 files changed

Lines changed: 22 additions & 46 deletions

File tree

packages/cli/src/shared/agent-setup.ts

Lines changed: 20 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,7 @@ async function setupZeroclawConfig(runner: CloudRunner, _apiKey: string): Promis
519519

520520
// Run onboard first to set up provider/key
521521
await runner.runServer(
522-
`source ~/.spawnrc 2>/dev/null; export PATH="$HOME/.cargo/bin:$PATH"; zeroclaw onboard --api-key "\${OPENROUTER_API_KEY}" --provider openrouter`,
522+
`source ~/.spawnrc 2>/dev/null; export PATH="$HOME/.local/bin:$HOME/.cargo/bin:$PATH"; zeroclaw onboard --api-key "\${OPENROUTER_API_KEY}" --provider openrouter`,
523523
);
524524

525525
// Patch autonomy settings in-place. `zeroclaw onboard` already generates
@@ -548,37 +548,6 @@ async function setupZeroclawConfig(runner: CloudRunner, _apiKey: string): Promis
548548

549549
// ─── Swap Space Setup ─────────────────────────────────────────────────────────
550550

551-
/**
552-
* Ensure swap space exists on the remote machine.
553-
* Used before memory-intensive builds (e.g., Rust compilation) on
554-
* resource-constrained instances (512 MB RAM). Idempotent — skips if
555-
* swap is already configured. Non-fatal if sudo is unavailable.
556-
*/
557-
async function ensureSwapSpace(runner: CloudRunner, sizeMb = 1024): Promise<void> {
558-
if (typeof sizeMb !== "number" || sizeMb <= 0 || !Number.isInteger(sizeMb)) {
559-
throw new Error(`Invalid swap size: ${sizeMb}`);
560-
}
561-
logStep(`Ensuring ${sizeMb} MB swap space for compilation...`);
562-
const script = [
563-
"if swapon --show 2>/dev/null | grep -q /swapfile; then",
564-
" echo '==> Swap already configured, skipping'",
565-
"else",
566-
` echo '==> Creating ${sizeMb} MB swap file...'`,
567-
` sudo fallocate -l ${sizeMb}M /swapfile 2>/dev/null || sudo dd if=/dev/zero of=/swapfile bs=1M count=${sizeMb} status=none`,
568-
" sudo chmod 600 /swapfile",
569-
" sudo mkswap /swapfile >/dev/null",
570-
" sudo swapon /swapfile",
571-
" echo '==> Swap enabled'",
572-
"fi",
573-
].join("\n");
574-
const result = await asyncTryCatchIf(isOperationalError, () => runner.runServer(script));
575-
if (result.ok) {
576-
logInfo("Swap space ready");
577-
} else {
578-
logWarn("Swap setup failed (non-fatal) — build may still succeed on larger instances");
579-
}
580-
}
581-
582551
// ─── OpenCode Install Command ────────────────────────────────────────────────
583552

584553
function openCodeInstallCmd(): string {
@@ -620,8 +589,9 @@ const NPM_GLOBAL_PATH_PERSIST =
620589

621590
// ─── Default Agent Definitions ───────────────────────────────────────────────
622591

623-
const ZEROCLAW_INSTALL_URL =
624-
"https://raw.githubusercontent.com/zeroclaw-labs/zeroclaw/a117be64fdaa31779204beadf2942c8aef57d0e5/scripts/bootstrap.sh";
592+
// Last zeroclaw release that shipped Linux prebuilt binaries (v0.1.9a has none).
593+
// Used for direct binary install to avoid a Rust source build timeout.
594+
const ZEROCLAW_PREBUILT_TAG = "v0.1.7-beta.30";
625595

626596
function createAgents(runner: CloudRunner): Record<string, AgentConfig> {
627597
return {
@@ -726,23 +696,29 @@ function createAgents(runner: CloudRunner): Record<string, AgentConfig> {
726696
cloudInitTier: "minimal",
727697
preProvision: detectGithubAuth,
728698
install: async () => {
729-
// Add swap before building — low-memory instances (e.g., AWS nano 512 MB)
730-
// OOM during Rust compilation if --prefer-prebuilt falls back to source.
731-
await ensureSwapSpace(runner);
732-
await installAgent(
733-
runner,
734-
"ZeroClaw",
735-
`curl --proto '=https' -LsSf ${ZEROCLAW_INSTALL_URL} | bash -s -- --install-rust --install-system-deps --prefer-prebuilt`,
736-
600, // 10 min: swap-backed compilation is slower than the 5-min default
737-
);
699+
// Direct binary install from pinned release (v0.1.9a "latest" has no assets,
700+
// causing the bootstrap --prefer-prebuilt path to 404-fail and fall back to
701+
// a Rust source build that exceeds the 600s install timeout).
702+
const directInstallCmd =
703+
`_ZC_ARCH="$(uname -m)"; ` +
704+
`if [ "$_ZC_ARCH" = "x86_64" ]; then _ZC_TARGET="x86_64-unknown-linux-gnu"; ` +
705+
`elif [ "$_ZC_ARCH" = "aarch64" ] || [ "$_ZC_ARCH" = "arm64" ]; then _ZC_TARGET="aarch64-unknown-linux-gnu"; ` +
706+
`else echo "Unsupported arch: $_ZC_ARCH" >&2; exit 1; fi; ` +
707+
`_ZC_URL="https://github.com/zeroclaw-labs/zeroclaw/releases/download/${ZEROCLAW_PREBUILT_TAG}/zeroclaw-\${_ZC_TARGET}.tar.gz"; ` +
708+
`_ZC_TMP="$(mktemp -d)"; ` +
709+
`curl --proto '=https' -fsSL "$_ZC_URL" -o "$_ZC_TMP/zeroclaw.tar.gz" && ` +
710+
`tar -xzf "$_ZC_TMP/zeroclaw.tar.gz" -C "$_ZC_TMP" && ` +
711+
`{ mkdir -p "$HOME/.local/bin" && install -m 755 "$_ZC_TMP/zeroclaw" "$HOME/.local/bin/zeroclaw"; } && ` +
712+
`rm -rf "$_ZC_TMP"`;
713+
await installAgent(runner, "ZeroClaw", directInstallCmd, 120);
738714
},
739715
envVars: (apiKey) => [
740716
`OPENROUTER_API_KEY=${apiKey}`,
741717
"ZEROCLAW_PROVIDER=openrouter",
742718
],
743719
configure: (apiKey) => setupZeroclawConfig(runner, apiKey),
744720
launchCmd: () =>
745-
"export PATH=$HOME/.cargo/bin:$PATH; source ~/.cargo/env 2>/dev/null; source ~/.spawnrc 2>/dev/null; zeroclaw agent",
721+
"export PATH=$HOME/.local/bin:$HOME/.cargo/bin:$PATH; source ~/.spawnrc 2>/dev/null; zeroclaw agent",
746722
},
747723

748724
hermes: {

sh/e2e/lib/verify.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -434,9 +434,9 @@ verify_zeroclaw() {
434434
local app="$1"
435435
local failures=0
436436

437-
# Binary check (requires cargo bin in PATH — cargo/env may not exist on all clouds)
437+
# Binary check (may be in ~/.local/bin or ~/.cargo/bin depending on install method)
438438
log_step "Checking zeroclaw binary..."
439-
if cloud_exec "${app}" "export PATH=\$HOME/.cargo/bin:\$PATH; source ~/.cargo/env 2>/dev/null; command -v zeroclaw" >/dev/null 2>&1; then
439+
if cloud_exec "${app}" "export PATH=\$HOME/.local/bin:\$HOME/.cargo/bin:\$PATH; source ~/.cargo/env 2>/dev/null; command -v zeroclaw" >/dev/null 2>&1; then
440440
log_ok "zeroclaw binary found"
441441
else
442442
log_err "zeroclaw binary not found"

0 commit comments

Comments
 (0)