agentleFS
egeominottiegeominotti/bunqueue/.agents/skills/bunqueue-running-machine-gates/SKILL.md

bunqueue-running-machine-gates

Skill601 starsChanged 18 days agoMITView on GitHub

Runs the bunqueue OrbStack Machine gate with scripts/machine-gate.sh. Use when a candidate or release needs its Linux validation on Ubuntu 24.04 or Debian 13 Machines, when asked to validate on OrbStack, orb create or a clean Linux host rather than Docker, when machine-gate.sh exits non-zero or an older manifest shows the retired exit 3, when copying a snapshot of the tree into an isolated Machine, or when reading or rerunning a manifest under artifacts/machines. Not a replacement for bun run test:sandbox, and not for Docker sandbox failures (bunqueue-running-gates).

  • Reads credentials

The file

We split this skill into the rules it gives an agent

4 rules. About 0 are common, 1 is distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Run it in the background (about 30 minutes.

    line 50
  2. Distinctive:

    Read the manifest, then copy its verdict, totals and path into the evidence.

    line 65
  3. Very specific:

    If node: command not found ever appears in a Machine's unit log again, a test started depending on Node: fix that test the same way, never …

    line 149
  4. Very specific:

    After an interrupt, let the gate finish (up to the 60 s settle window plus the log copies).

    line 178

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Running the OrbStack Machine gate

The rules are in CLAUDE.md and docs/testing.md: repository tests run in isolated OrbStack Machines by default (a macOS-host run is diagnostic only); the final Linux gate is a fresh Ubuntu 24.04 Machine on the native architecture, plus Debian 13 for every release; --isolated --isolate-network, never a mount, a forwarded SSH agent or a secret; CI's Bun and the frozen lockfile; and the Machines supplement the sandboxes, never replace them. The scripts do all of it on the macOS host; run the first one rather than typing the steps:

  • scripts/machine-gate.sh: the entry point (snapshot, workers, cleanup, verdict);
  • scripts/machine-worker.sh: one Machine, from orb create to a finished run inside it;
  • scripts/machine-steps.sh: the steps inside a Machine;
  • scripts/machine-cleanup.sh: stops the workers, copies the logs back and deletes the Machines, on every exit path;
  • scripts/machine-verdict.sh: the manifest and the exit code.
  • scripts/machine-process.sh: shared bounded process-tree termination; scripts/machine-claims.sh: atomic host-wide Machine-name claims held through cleanup.
  • Bounded calls reuse the shared command runner and its owned process-group lifetime, retaining the deadline until output pipes close and stopping silent descendants even when the command launcher already exited.
  • scripts/machine-evidence.sh: validates the final result summaries independently of step exit receipts.

Run it

  1. Freeze the candidate: stage it, then git diff --check and git diff --cached --check must be clean (the Machine gets no .git, so whitespace is checked on the host). Record the tree with git write-tree.
  2. Preview, which creates nothing:

    bash .agents/skills/bunqueue-running-machine-gates/scripts/machine-gate.sh --dry-run --tree <hash>
  3. Run it in the background (about 30 minutes; the Machines run in parallel). The default is Ubuntu 24.04 and Debian 13, the release scope; outside a release --distros ubuntu:24.04 is the gate:

    bash .agents/skills/bunqueue-running-machine-gates/scripts/machine-gate.sh --tree <hash>

    It prints every step that starts or finishes, with its exit code, on stderr (one poll every 30 s) and, at the end, the exit code and artifacts/machines/<run-id>/manifest.md. orb create, the package install, the Bun download and each copy are stopped after 15 minutes each (exit 4). OrbStack list/info/version and established SSH control queries are bounded to 30 seconds (BUNQUEUE_MACHINE_CONTROL_SECONDS shortens this for tests); a timeout stops the owned command tree before returning infrastructure failure.

  4. Read the manifest, then copy its verdict, totals and path into the evidence.

--steps takes a subset for diagnosis; the verdict is then DIAGNOSTIC (exit 5). --keep leaves the Machines running for debugging, also with a DIAGNOSTIC verdict; delete them yourself with orb delete -f <name>.

Each name is claimed atomically before its list/create checks across cooperating worktrees, under /tmp/bunqueue-machine-claims-$UID (tests override BUNQUEUE_MACHINE_CLAIM_ROOT). Cleanup releases only its own token after confirmed deletion, or if creation was never attempted. Uncertain and kept Machines retain their claim: inspect the name with orb list and reconcile it before removing that claim directory. A failed create retains its settling marker even for non-timeout errors, since the daemon may still complete the request.

Any failed copy of gate-out/ or gate-runner.log leaves COPY_INFRA in the Machine's artifact directory. A passing receipt also needs every requested step log and the runner log; a partial transfer cannot establish PASS. An interrupted --keep run exits 4 because its Machines remain present.

Step exit zero also needs complete, nonempty final result summaries: Bun test counts for unit/tinyfs, suites and assertions for TCP/embedded, both typecheck project completion markers, and format completion. Reported test/error counters produce FAIL (1); absent or inconsistent summaries produce infrastructure failure (4), even when steps.tsv claims success.

Exit codes

ExitVerdictWhat it means
0PASSevidence: every step passed in every Machine. Release evidence only with both Ubuntu 24.04 and Debian 13; with Ubuntu 24.04 alone, evidence for a candidate (the manifest's Scope line says which)
5DIAGNOSTICpassed, but not evidence: a step subset, no Ubuntu 24.04 Machine, or --keep
1FAILa real failure: read the step log the manifest names; classify as in bunqueue-running-gates
4INFRASTRUCTURE FAILUREno evidence (OrbStack, whitespace, secret scan, an existing Machine name, creation, isolation, SSH, copy, hash mismatch, timeout), or a Machine not deleted, an interrupted create that never appeared, or no recorded cleanup: that outranks an interrupt
130INTERRUPTEDSIGTERM or SIGINT, and every Machine was deleted: nothing is claimed. If cleanup could not delete everything the exit is 4
2usage errorfix the options
3retirednever returned since 2026-11-13: it was the known node gap (below); an older manifest that says 3 stays valid for its tree, and --classify now reads that run as 1

--classify <run-dir> (the same as machine-verdict.sh <run-dir>) re-reads a run directory, prints its manifest and exits with the code the run ended with, without starting a Machine.

Interrupts and cleanup

machine-cleanup.sh runs on every exit path: success, failure, die, SIGTERM and SIGINT. It signals each live worker so its command supervisor terminates its owned group without racing a second tree controller. A control query can defer the worker trap until its 30 s deadline; after that bound plus 5 s, an unresponsive worker tree is frozen top-down before termination. It signals only children of the gate: a worker that already exited is dropped from the list, because its pid may belong to another process by then. It waits up to 60 s for a create the OrbStack daemon may still finish after its CLI is gone, copies back gate-out/ and gate-runner.log from every Machine the run created, and deletes them: orb delete -f is repeated, up to five times, until orb list no longer shows the name, because the CLI can fail (it has panicked) after the daemon deleted the Machine, and can be stopped before it did. run.env records cleanup=, a cleanup_note= that says which Machines' logs were copied and which were not, and delete_exit= with every attempt's exit code; cleanup.log and delete.log stay in the run directory. If an interrupted create has still not appeared after that wait, it may appear later: the run is recorded as not-deleted with the names, exits 4, and you check orb list and delete them by hand. A Machine whose name already exists is never created, touched or deleted, and a failing orb list is an infrastructure failure, never "the name is free". Cleanup ignores further signals, and runs every rsync and orb call in a session of its own: a repeated Ctrl-C signals the terminal's whole process group, and on real OrbStack it killed the copy and the delete although the cleanup shell ignored it. It is bounded (a 60 s settle window plus, per Machine, two 120 s copies, five 120 s deletes, 30 s list queries and termination grace). test/agent-skills-machine-lifecycle.test.ts proves all of this with a fake OrbStack.

So an interrupt during orb create does not return at once: the gate waits the settle window, then exits 130 only when every Machine the run started creating is confirmed deleted. In every other case the exit is 4, with the names to check.

Node in the Machines

The Machines carry Bun and no Node, and the gate installs no node->bun shim. test/repro-docker-version-gate-errors.test.ts and test/repro-release-source-commit.test.ts run CI's version-gate bash, which calls node -p; until 2026-11-13 six of their tests failed there with node: command not found, and the gate reported that known gap as exit 3 after rerunning them with a shim. Each file now links a node to the running Bun (process.execPath) first on the PATH of the bash it spawns, so they pass in a Bun-only Machine as they do in the sandbox and in CI, and test/repro-ci-script-tests-without-node.test.ts runs both with node absent. The gate therefore has no exception: any unit failure is a real failure (exit 1). If node: command not found ever appears in a Machine's unit log again, a test started depending on Node: fix that test the same way, never the gate.

Evidence

OrbStack Machines (machine-gate.sh exit 0, artifacts/machines/<run-id>/manifest.md) on
staged tree <hash>: Ubuntu 24.04 and Debian 13, arm64, Bun <version>: unit
<n> pass / 0 fail / <n> skip, tcp <n>/<n>, embedded <n>/<n>, typecheck and format
clean, tinyfs <n> / 0; Machines deleted.

Doing it by hand, and what each manifest field means: references/manual-procedure.md.

What stands behind the scripts, as of 2026-11-13 (OrbStack 2.2.5, macOS 27.2.1, arm64, on 3e08f75b, before the changes of that day's review):

Proven on real OrbStackProven with fakes only
The canonical run: exit 3 (the node gap, since retired) in 24 min 41 s; in both Machines unit 11871 pass / 6 fail / 399 skip, tcp 69/69 suites and 553/553, embedded 43/43 and 349/349, tinyfs 9 / 0A create that appears after the settle window (exit 4, not deleted)
SIGTERM and SIGINT during orb create, during provisioning and during the steps: exit 130, no Machine and no process leftA failing or slow orb list
A step subset and --keep: exit 5; an existing Machine name: exit 4, the Machine untouchedThe rule that only children of the gate are signalled
The gap: six node-dependent tests failed, 22 / 0 with the shim; the fix in the tests is proven on the host with node absent, not yet on OrbStackExit 0 and exit 1 (no real log ended that way), and the other infrastructure failures
The 15-minute bounds, the repeated delete and the detached cleanup: written after the real run, which showed the need; not yet rerun on OrbStack
An amd64 host

Gotchas

  • After an interrupt, let the gate finish (up to the 60 s settle window plus the log copies). A second, harder kill (kill -9) skips the cleanup and can leave a Machine that the daemon creates later; read the exit code, and after a 4 run orb list.
  • Started with & from a non-interactive shell (an agent's background command), the gate ignores SIGINT: that is the shell's rule for background jobs. Stop it with SIGTERM (kill <pid>), which runs the same cleanup.
  • The snapshot is git archive <tree>: untracked files are not in it, even intended ones. Stage them, or build a tree from a temporary index (manual procedure, step 1).
  • orb push cannot write an isolated Machine; the copy is rsync over OrbStack's SSH endpoint (MACHINE@orb), so rsync is installed in the Machine first. The SSH key stays on macOS, with ForwardAgent=no and ClearAllForwardings=yes.
  • Debian 13 has no curl by default and the Bun installer needs unzip; the worker installs ca-certificates curl jq openssl procps rsync unzip.
  • The unit suite needs bun run build:client first, as in CI and Dockerfile.test; machine-steps.sh runs it as its own step.
  • The Machines keep the macOS host's local time zone with TZ unset, unlike the sandbox (TZ=UTC). The manifest records it; a date-dependent failure that only a Machine shows is an environment finding to investigate, not noise.
  • Requested resources are not effective resources: OrbStack clamps a Machine to its global limits, so the manifest records the cgroup cpu.max and memory.max.
  • A translated amd64 Machine on Apple Silicon is diagnostic only; the gate always creates Machines of the host's native architecture.
  • Running the Machines while a sandbox runs on the same host shares the OrbStack VM's CPUs. Results stay valid, but compare durations only between quiet runs.
  • The Machines and containers share OrbStack's kernel: strong process and filesystem isolation, not a separate-kernel boundary.
  • --isolate-network is not a network sandbox. Measured on OrbStack 2.2.5: a Machine created with it cannot reach host.orb.internal or the gateway, but it reached a listener in the sibling Machine and the Mac's LAN address, and it has the internet (the gate installs packages and Bun through it). Only the Docker sandbox runs tests without a network; never treat a Machine as offline.
  • create.log, rsync.log and delete.log hold little more than (exit N) lines: orb and rsync print nothing when they are not on a terminal. The exit codes are the record.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.