bunqueue-running-gates
Skill601 starsChanged 18 days agoMITView on GitHub
Selects, runs and reads the bunqueue validation gates. Use when about to commit a bunqueue change or asked which gate it needs, when bun run test:sandbox, test:model or test:sandbox:sdk fails or shows anomalies, when a test passes on the host but fails in the container, when reading a report, totals or KPIs under artifacts/test-sandbox, when a change lands after a green gate, or when watching CI after a push. Covers failure classification and model replay by seed. Not for OrbStack Machine runs (bunqueue-running-machine-gates) or benchmarks.
- Commits and pushes
In this repository11 other files it gives its agents.
- AGENTS.mdAGENTS.md
- skills/bunqueue/agents.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- sdk/CLAUDE.mdCLAUDE.md
- bunqueue-devSkill
- bunqueue-fixing-bugsSkill
- bunqueue-releasingSkill
- bunqueue-running-machine-gatesSkill
- bunqueue-working-autonomouslySkill
- bunqueue-working-sessionsSkill
- bunqueueSkill
The file
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 2 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
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
- could be automatic: a setting could enforce it
- Very specific: line 46
Start the gate in the background and do not edit the worktree until it finishes.
- Distinctive: line 49
When it ends, git write-tree again.
- Distinctive: line 130
Wait for it with a bound (a push run takes roughly 10 to 20 minutes.
- Very specific: line 182
Do not rerun a run that reached the release jobs (tag, GitHub release, Docker, npm): a rerun repeats them, and those are the user's to …
- Very specific: line 188
After an sdk/ change, check the SDK jobs too.
≈ “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.
Files
Running the bunqueue gates
Which gate is mandatory, and when, is stated in CLAUDE.md and AGENTS.md; the rationale and every command are in docs/testing.md. This skill is how to run them so the result is evidence for the tree you commit.
Choose the gates
| The change touches | Run |
Any code: src/, test/, scripts/, bench/, examples/, config, Dockerfiles, workflows | bun run test:sandbox |
Lifecycle, persistence/recovery, scheduling, dependencies, dedup, leases, limits, counters, temporal indexes, jobIndex | bun run test:model first, then the sandbox |
Anything under sdk/ | bun run test:sandbox:sdk as well as the sandbox |
| Always | bun run typecheck, bun run format:check, git diff --check and git diff --cached --check |
| Final Linux validation of a candidate | a fresh Ubuntu 24.04 OrbStack Machine on the native architecture, plus Debian 13 for every release (bunqueue-running-machine-gates) |
| Only docs or state files, after a green gate | prove the delta and rerun the tests that read them (below) |
| Anything, once it is pushed | watch the CI run of the pushed commit until it is green (below) |
Repository tests run in isolated OrbStack Machines by default, iteration included: a run on the macOS host is diagnostic only (CLAUDE.md). The Machines supplement the sandboxes and never replace them.
Sandbox success requires a zero exit code, no reported failures or test errors, and complete valid nonempty results. Failed Docker cleanup fails the suite and retains ownership for retry; invalid baseline reports are ignored. See harness reliability.
Freeze the tree, then run
The sandbox builds the working tree as it is when docker build reads the context,
uncommitted and untracked allow-listed files included. Evidence names one tree, so:
- Stage everything the change contains, then check that nothing is left outside the
index:
git status --porcelainshows only staged entries (first column), andgit diff --quietsucceeds. - Record the tree:
git write-tree(it writes a tree object, never the index). - Start the gate in the background and do not edit the worktree until it finishes.
bun run test:sandboxtakes about 9 minutes; the SDK sandbox takes longer and snapshots the worktree when it starts, not when the first sandbox started. - When it ends,
git write-treeagain. The same hash means the result covers the tree; a different hash means a delta to prove or a gate to rerun.
Read the result
Open artifacts/test-sandbox/<timestamp>/summary.md (SDK:
artifacts/test-sandbox-sdk/<timestamp>/summary.md) and report more than the exit
code: per-suite pass / fail / skip totals, the Anomalies column, duration against the
baseline, peak memory and PIDs, and the slowest tests. Field meanings, the JSON files
and retained containers: references/artifacts.md.
Evidence line for feature_list.json and the skeptic:
bun run test:sandbox on staged tree <hash>: unit <n> pass / 0 fail / <n> skip,
tcp <n> / 0, embedded <n> / 0, anomalies none, artifacts/test-sandbox/<timestamp>/Classify a failure
- Image build failed, or a test fails with
ENOENTunder/workspacewhile the host passes: a file the test reads is not in the image. Add it to both Dockerfile.test (aCOPY) andDockerfile.test.dockerignore(an allow-list entry); either one alone is not enough. - Fails only in the parallel run: rerun with
BUNQUEUE_TEST_SEQUENTIAL=1 bun run test:sandbox. Passing sequentially means contention: still a test to harden (timing assumptions, fixed sleeps), not proof of a product bug. - Environment, not product: a binary that is missing in one environment (the
OrbStack Machines have no
node), host-only state, a translated architecture. Name the environment difference and prove the test passes where it exists. - Real: reproduce it with a focused test and switch to bunqueue-fixing-bugs.
Memory growth in the KPIs is a signal to investigate, not proof of a leak: unit tests share one process. Confirm with a focused repeated-process, post-GC reproduction.
The model campaign
bun run test:model runs the fast-check model against a real TCP broker and SQLite.
On failure keep the printed seed, path and size, and replay exactly:
BUNQUEUE_MODEL_SEED=<seed> BUNQUEUE_MODEL_PATH=<path> BUNQUEUE_MODEL_SIZE=<size> bun run test:modelDecide whether the model or the engine is wrong (docs/testing.md);
an engine bug gets a deterministic test/repro-model-*.test.ts before any fix. Never
weaken an invariant to get a green run.
Prove a post-gate delta
A late changelog line or progress note after a green gate does not always need another 9-minute run, but it needs proof that nothing executable changed. Run it, do not read it:
bash .agents/skills/bunqueue-running-gates/scripts/gate-delta.sh --gated <hash from git write-tree>scripts/gate-delta.sh exits 0 (no delta), 3 (docs-only: it lists the focused tests to rerun), 1 (code changed: rerun the gate) or 4 (Git error). The image comparison and what counts as docs-only: references/post-gate-deltas.md.
After the push: watch CI
A push is not finished when git push returns. The work item is done when the CI run
of the pushed commit is green (CLAUDE.md,
AGENTS.md): two pushes once went out with a red
run that nobody opened, and a later one needed a rerun for a flaky job. The push itself
still needs the user's authorization; watching only reads.
Find the run of the commit you pushed, by its full SHA:
gh run list --commit "$(git rev-parse HEAD)" --json databaseId,workflowName,status,conclusion gh run list --branch main --limit 1 --workflow CI --json databaseId,headSha,status,conclusionThe second command is the newest
CIrun onmain: check that itsheadShais your commit before trusting it.Wait for it with a bound (a push run takes roughly 10 to 20 minutes; a publication run waits for an approval and takes longer). Run the script rather than typing the loop:
bash .agents/skills/bunqueue-running-gates/scripts/ci-watch.sh --sha "$(git rev-parse HEAD)"scripts/ci-watch.sh takes
--sha <full sha>or--run <id>, gives up after--timeoutseconds (default 2700) and exits 0 (GREEN), 1 (FAILED), 3 (FLAKY: green only after a rerun) or 4 (NO VERDICT:ghmissing or failing, no run, a cancelled run, a run waiting for an approval, or still running at the timeout). It never reruns, cancels or approves anything. The same by hand:id=<run id> for poll in $(seq 1 90); do # 90 x 30 s = 45 minutes, then stop waiting [ "$(gh run view "$id" --json status --jq .status)" = completed ] && break sleep 30 done gh run view "$id" --json status,conclusion,jobs \ --jq '{status, conclusion, failed: [.jobs[] | select(.conclusion == "failure") | .name]}'Red (exit 1): read the failed steps before deciding anything:
gh run view <id> --log-failed | tail -n 120Flake or regression? One attempt cannot tell, and neither can a single red matrix leg: the Python 3.9 SDK job failed on three pushes in a row while every other leg was green, because the runner image had lost Python 3.9. Signs of a regression or a broken runner: the log names something the commit changed, the same job is red on earlier commits (
gh run list --branch main --workflow CI --limit 5), or it fails locally. Signs of a flake: a timing or race assertion in a test the commit does not touch (a docs-only commit, for example). Then rerun the failed jobs once:gh run rerun <id> --failed bash .agents/skills/bunqueue-running-gates/scripts/ci-watch.sh --run <id>- Exit 3, green on the rerun: CI is green and the flake is real. Add a
not-startedwork item naming the test, the job, the run id and the attempt, with "reproduce first" in its description (a stress loop in the environment that failed);postgres-lifecycle-race-flakeis the model. A flake is never silently ignored and never rerun a second time. - Exit 1 again: a job that fails in every attempt is a regression or a broken
runner.
mainis red: say so, then fix it with a reproducing test first (bunqueue-fixing-bugs).
Do not rerun a run that reached the release jobs (tag, GitHub release, Docker, npm): a rerun repeats them, and those are the user's to request (bunqueue-releasing).
- Exit 3, green on the rerun: CI is green and the flake is real. Add a
- Record it in the evidence:
CI run <id> (attempt <n>) on <sha>: GREEN (ci-watch.sh exit 0), <url>, or the flake's work item id next to an exit 3.
After an sdk/ change, check the SDK jobs too. On a push they are not a run of their
own: CI calls the SDK workflow, so they are the Official SDKs / ... jobs of the
CI run that ci-watch.sh already judges, and a red one makes that run FAILED. The
SDK workflow runs by itself only on its weekly schedule and on a manual dispatch;
watch such a run with --workflow SDK (ci-watch.sh --sha <full sha> --workflow SDK,
or gh run list --workflow SDK --limit 3 to find it). Without such a run for the
commit, --workflow SDK waits until the timeout and exits 4.
Gotchas
- Live CI watching requires the repository's pinned Bun as well as
gh; help and dry-run remain read-only previews. The timeout covers queries, retry waits and attempt history; unavailable history cannot downgrade a known FAILED verdict. bounded-command.ts uses skill-eval-process.ts to terminate the owned CLI group, escalating from TERM to KILL after 100 ms. gh run list --branch main --limit 1alone returns the newest run of any workflow: anissue_commentrun of the Claude Code workflow, concludedskipped, is often newer than CI. Filter with--workflow CI, or list by--commit.gh run list --commitwants the full 40-character SHA; for an abbreviated one it returns an empty list, which reads as "no run yet".gh run watch <id>has no time bound and a green rerun looks like any green run:ci-watch.shis bounded and reports the rerun as exit 3.bun run test:sandboxis matched by nothing else:test:sandbox:sdk, a hostbun testor./init.sh --fullon a different tree do not replace it.- Without Docker the native commands are diagnostic only; report the missing sandbox as a blocker instead of committing.
- The unit container is not the host: Bun's
nodethere is a fallback shim, the user isbun,TZ=UTC, there is no network and no.git. A test that shells out togit,nodeor the network must handle that. bunfig.tomlignoresartifacts/**at the repository root: a test file placed there is never discovered, and stale copies kept there never run.- The image tag
bunqueue-test:localis shared: the next sandbox run anywhere on the machine overwrites it, so extract/workspacefor a comparison before starting another run. - Benchmarks never run in the sandbox or a Machine; they are native macOS only.
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
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.

