@@ -5,9 +5,10 @@ description: Use the Crabbox wrapper for OpenClaw remote validation across Linux
55
66# Crabbox
77
8- Use the Crabbox wrapper when OpenClaw needs remote Linux proof for broad tests,
8+ OpenClaw agent sessions use the Crabbox wrapper by default for tests and
9+ computationally intensive work: builds, typechecks, lint fan-out, broad gates,
910CI-parity checks, secrets, hosted services, Docker/E2E/package lanes, warmed
10- reusable boxes, sync timing, logs/results, cache inspection, or lease cleanup.
11+ reusable boxes, sync timing, logs/results, cache inspection, and lease cleanup.
1112
1213Crabbox is the transport/orchestration surface. The actual backend can be:
1314
@@ -16,17 +17,18 @@ Crabbox is the transport/orchestration surface. The actual backend can be:
1617- Blacksmith Testbox through Crabbox: delegated provider,
1718 ` provider=blacksmith-testbox ` , ids like ` tbx_... ` , ` syncDelegated=true `
1819
19- For OpenClaw maintainer broad ` pnpm ` gates, Blacksmith Testbox through the
20- Crabbox wrapper is acceptable and often preferred when the standing Testbox
21- rules apply. Do not describe those runs as "AWS Crabbox"; report them as
22- Testbox-through-Crabbox with the ` tbx_... ` id and Actions run.
20+ Blacksmith Testbox through the Crabbox wrapper is the default OpenClaw agent
21+ backend for trusted maintainer code and heavy ` pnpm ` gates. The configured
22+ Blacksmith workflow hydrates provider and agent credentials, so never sync or
23+ run untrusted contributor/fork code there. Use secretless fork CI or
24+ sanitized direct AWS Crabbox for untrusted source. Do not describe
25+ Blacksmith runs as "AWS Crabbox"; report them as Testbox-through-Crabbox with
26+ the ` tbx_... ` id and Actions run.
2327
24- Use the repo ` .crabbox.yaml ` brokered AWS path when the task specifically needs
25- direct AWS Crabbox behavior, persistent direct-provider leases, ` --fresh-pr ` ,
26- ` --full-resync ` , environment forwarding, capture/download support, or provider
27- comparison. Use ` --provider blacksmith-testbox ` when the task needs OpenClaw
28- maintainer Testbox proof, prepared CI environment, broad/heavy pnpm gates, or
29- the user asks for Testbox/Blacksmith.
28+ Pass ` --provider aws ` when the task specifically needs direct AWS Crabbox
29+ behavior, persistent direct-provider leases, ` --fresh-pr ` , ` --full-resync ` ,
30+ environment forwarding, capture/download support, or provider comparison. Use
31+ ` --provider blacksmith-testbox ` for the default OpenClaw agent path.
3032
3133## First Checks
3234
@@ -51,16 +53,85 @@ pnpm crabbox:run -- --help | sed -n '1,120p'
5153 config pins hot ` eu-west-1a/b/c ` placement so Fast Snapshot Restore can apply.
5254 If warmup drifts well past the minute-scale path, verify image promotion,
5355 region/AZ placement, and FSR state before blaming OpenClaw.
54- - For broad OpenClaw maintainer ` pnpm ` gates, prefer the repo wrapper with
55- ` --provider blacksmith-testbox ` or the repo Testbox helpers when the standing
56- Testbox policy applies.
57- - Cold Testbox acquisition and hydration often take tens of seconds. When broad
58- remote proof is likely, immediately start
56+ - For trusted OpenClaw agent tests and computationally intensive work, use the
57+ repo wrapper with ` --provider blacksmith-testbox ` or the repo Testbox helpers.
58+ - Treat contributor/fork source as untrusted unless a maintainer explicitly
59+ approves credentialed execution after review. Run untrusted source only in
60+ secretless fork CI or sanitized direct AWS Crabbox. For every untrusted AWS
61+ run, launch an installed trusted Crabbox binary from a clean trusted ` main `
62+ checkout and fetch the remote PR with ` --fresh-pr ` ; never execute the
63+ untrusted checkout's wrapper or config locally. Set
64+ ` CRABBOX_ENV_ALLOW=CI ` to replace the repo's ` OPENCLAW_* ` /` NODE_OPTIONS `
65+ allowlist, pass ` --provider aws --no-hydrate ` , and use a fresh temporary
66+ remote ` HOME ` on a newly warmed lease dedicated to that untrusted source.
67+ Unset ` CRABBOX_AWS_INSTANCE_PROFILE ` and fail closed unless resolved
68+ ` aws.instanceProfile ` is empty. Before install/test, use trusted absolute-path
69+ tools to require an IMDSv2 token, prove the IAM credentials endpoint returns
70+ 404, and verify remote ` git rev-parse HEAD ` equals the full reviewed PR head
71+ SHA. Bind the lease to that SHA; stop and rewarm when the head changes. Do not
72+ inherit Tailscale: unset every ` CRABBOX_TAILSCALE* ` override, force
73+ ` --network public --tailscale=false ` , clear exit-node/LAN flags, and require
74+ ` crabbox inspect ` to report public networking with no Tailscale state before
75+ uploading any script. Execute PR code only through trusted
76+ ` scripts/crabbox-untrusted-bootstrap.sh ` , uploaded from clean ` main ` alongside
77+ ` --fresh-pr ` ; it installs pinned Node/pnpm and rejects a changed PR
78+ ` packageManager ` pin before install. Never reuse a trusted or previously
79+ hydrated lease. If the broker cannot provide
80+ the no-role proof or no remote PR exists, use secretless fork CI. Never use
81+ ` hydrate-github ` or a credential-hydrated Testbox workflow for untrusted code.
82+ - Cold Testbox acquisition and hydration often take about a minute. At the
83+ start of any task likely to change code or need tests/heavy proof, immediately
84+ start, after confirming the source is trusted,
5985 ` node scripts/crabbox-wrapper.mjs warmup --provider blacksmith-testbox --keep --timing-json `
60- in a background command session while inspecting, editing, and running
61- focused local tests. Poll later, reuse the returned ` tbx_... ` with
86+ in a background command session while inspecting and editing. Poll later,
87+ reuse the returned ` tbx_... ` with
6288 ` --provider blacksmith-testbox --id <tbx_id> ` , and stop it before handoff.
63- Do not warm speculatively when remote proof is unlikely.
89+ For untrusted source, switch to a clean trusted ` main ` checkout and pre-warm
90+ with the installed binary after the empty-instance-profile check below.
91+ Do not warm for read-only, docs-only, or clearly trivial work that will not
92+ run tests or heavy commands.
93+ - Run untrusted source only with the sanitized form below. The explicit
94+ allowlist prevents locally exported ` OPENCLAW_* ` credentials from crossing
95+ the SSH boundary; ` --no-hydrate ` and temporary ` HOME ` prevent auth-profile
96+ reuse:
97+
98+ ``` sh
99+ env -u CRABBOX_AWS_INSTANCE_PROFILE \
100+ crabbox config show --json | \
101+ jq -e ' .aws.instanceProfile == ""' > /dev/null
102+ env -u CRABBOX_AWS_INSTANCE_PROFILE \
103+ -u CRABBOX_TAILSCALE \
104+ -u CRABBOX_TAILSCALE_AUTH_KEY \
105+ -u CRABBOX_TAILSCALE_AUTH_KEY_ENV \
106+ -u CRABBOX_TAILSCALE_EXIT_NODE \
107+ -u CRABBOX_TAILSCALE_EXIT_NODE_ALLOW_LAN_ACCESS \
108+ -u CRABBOX_TAILSCALE_HOSTNAME_TEMPLATE \
109+ -u CRABBOX_TAILSCALE_TAGS \
110+ crabbox warmup \
111+ --provider aws \
112+ --network public \
113+ --tailscale=false \
114+ --tailscale-exit-node= \
115+ --tailscale-exit-node-allow-lan-access=false \
116+ --keep \
117+ --timing-json
118+ crabbox inspect --provider aws --id < cbx_id> --json | \
119+ jq -e ' .network == "public" and .tailscale == null' > /dev/null
120+ env -u CRABBOX_AWS_INSTANCE_PROFILE \
121+ CRABBOX_ENV_ALLOW=CI \
122+ crabbox run \
123+ --provider aws \
124+ --id < cbx_id> \
125+ --fresh-pr < owner/repo#number> \
126+ --no-hydrate \
127+ --timing-json \
128+ --script scripts/crabbox-untrusted-bootstrap.sh -- \
129+ < expected_head_sha> /usr/local/bin/pnpm test < path>
130+ # After all proof:
131+ env -u CRABBOX_AWS_INSTANCE_PROFILE \
132+ crabbox stop --provider aws < cbx_id>
133+ ```
134+
64135- Always report the actual provider and id. ` cbx_... ` means AWS Crabbox;
65136 ` tbx_... ` means Blacksmith Testbox through Crabbox. If the output only says
66137 ` blacksmith testbox list ` , use ` blacksmith testbox list --all ` before
@@ -75,15 +146,17 @@ pnpm crabbox:run -- --help | sed -n '1,120p'
75146 not leave it in remote shell history or logs. If no secret-safe injection path
76147 is available, say true live provider auth is blocked instead of silently using
77148 a fake key.
78- - Prefer local targeted tests for tight edit loops. Broad gates belong remote.
149+ - Agent-run tests, including targeted edit-loop tests, default to a pre-warmed
150+ remote box selected by source trust. Local test execution requires an
151+ explicit user request or a reported remote-provider blocker.
79152- Do not treat inherited shell env as operator intent. In particular,
80153 ` OPENCLAW_LOCAL_CHECK_MODE=throttled ` from the local shell is not permission
81154 to move broad ` pnpm check:changed ` , ` pnpm test:changed ` , full ` pnpm test ` , or
82155 lint/typecheck fan-out onto the laptop.
83156- Only use ` OPENCLAW_LOCAL_CHECK_MODE=throttled|full ` when the user explicitly
84157 asks for local proof in the current task. If Testbox is queued or capacity is
85- constrained, report the blocker and keep only targeted local edit-loop checks
86- running .
158+ constrained, report the blocker; do not silently move heavy work onto the
159+ laptop .
87160
88161## macOS And Windows Targets
89162
@@ -152,6 +225,7 @@ Changed gate:
152225
153226``` sh
154227pnpm crabbox:run -- \
228+ --provider aws \
155229 --idle-timeout 90m \
156230 --ttl 240m \
157231 --timing-json \
@@ -163,6 +237,7 @@ Full suite:
163237
164238``` sh
165239pnpm crabbox:run -- \
240+ --provider aws \
166241 --idle-timeout 90m \
167242 --ttl 240m \
168243 --timing-json \
@@ -179,6 +254,7 @@ Focused rerun:
179254
180255``` sh
181256pnpm crabbox:run -- \
257+ --provider aws \
182258 --idle-timeout 90m \
183259 --ttl 240m \
184260 --timing-json \
@@ -368,7 +444,7 @@ Efficient flow:
3684441 . Reproduce or prove the pre-fix symptom from the real user-facing entrypoint
369445 when feasible. If the issue cannot be reproduced, capture the exact command
370446 and observed behavior instead.
371- 2 . Patch locally and run narrow local tests for edit speed .
447+ 2 . Patch locally and run narrow tests on the pre-warmed remote box .
3724483 . Run one Crabbox E2E command that starts from the user-facing entrypoint:
373449 package install, Docker setup, onboarding, channel add, gateway start, or
374450 agent turn as appropriate.
@@ -387,8 +463,9 @@ Keep it efficient:
387463 top of that PR.
388464- Use ` --full-resync ` before replacing a warmed direct-provider lease when the
389465 remote workdir or sync fingerprint appears stale.
390- - Use one-shot Crabbox for a single proof; use a reusable Testbox only when
391- several commands must share built images, installed packages, or live state.
466+ - For agent code tasks, reuse the pre-warmed remote box across focused tests
467+ and heavy proof. Use a one-shot only when a single late proof is genuinely
468+ the task's only remote command.
392469- Prefer ` OPENCLAW_CURRENT_PACKAGE_TGZ ` with Docker/package lanes when testing a
393470 candidate tarball; prefer the repo's package helper instead of direct source
394471 execution when the bug might be packaging/install related.
@@ -448,13 +525,24 @@ Interactive CLI/onboarding:
448525
449526## Reuse And Keepalive
450527
451- For most Crabbox calls, one-shot is enough. Use reuse only when you need
452- multiple manual commands on the same hydrated box.
528+ Agent code tasks should pre-warm and reuse one remote box selected by source
529+ trust for focused tests and heavy proof. One-shot runs remain appropriate for a
530+ single late proof when early warmup was not warranted.
531+
532+ Reuse the lease, not stale source. Each command must sync the current checkout;
533+ use ` --no-sync ` only to rerun an unchanged, already-synced tree intentionally.
534+ Untrusted reuse still requires ` CRABBOX_ENV_ALLOW=CI ` ,
535+ ` --no-hydrate ` , and a fresh temporary remote ` HOME ` on every command. Reuse
536+ only a fresh lease dedicated to the same untrusted source; never a trusted or
537+ previously hydrated lease. Launch from the clean trusted ` main ` checkout and
538+ use ` --fresh-pr ` plus the same reviewed-SHA check on every run. Keep
539+ ` CRABBOX_AWS_INSTANCE_PROFILE ` unset for warmup, run, and cleanup. The lease is
540+ valid only for that reviewed SHA; stop and rewarm after any head change.
453541
454542If Crabbox returns a reusable id or you intentionally keep a lease:
455543
456544``` sh
457- pnpm crabbox: run -- -- id < cbx_id -or-slug> --no-sync -- timing-json --shell -- " pnpm test <path>"
545+ node scripts/ crabbox-wrapper.mjs run --provider < blacksmith-testbox-or-aws > -- id < id -or-slug> --timing-json --shell -- " corepack pnpm test <path>"
458546```
459547
460548Stop boxes you created before handoff:
@@ -549,8 +637,8 @@ Common Crabbox-only failures:
549637- Provider missing or old CLI: use ` ../crabbox/bin/crabbox ` from the sibling
550638 repo, or update/install Crabbox before retrying.
551639- Bad local config: inspect ` .crabbox.yaml ` , ` crabbox config show ` , and
552- ` crabbox whoami ` ; normal OpenClaw proof should use brokered AWS without
553- asking for cloud keys.
640+ ` crabbox whoami ` ; normal OpenClaw agent proof should use Blacksmith Testbox.
641+ Direct AWS is an explicit fallback and must use brokered auth, not raw keys.
554642- Slug/claim confusion: use the raw ` cbx_... ` / ` tbx_... ` id, or run one-shot
555643 without ` --id ` .
556644- Sync/timing bug: add ` --debug --timing-json ` ; capture the final JSON and the
@@ -563,21 +651,21 @@ Common Crabbox-only failures:
563651 Blacksmith runs, use ` blacksmith testbox list ` and stop only boxes you
564652 created.
565653- Testbox queued/capacity pressure: do not retry Blacksmith repeatedly. Rerun
566- once without ` --provider ` so ` .crabbox.yaml ` routes to brokered AWS, or report
567- the Blacksmith blocker if Testbox itself is the requested proof .
654+ once with ` --provider aws ` when direct AWS still proves the requested
655+ surface, or report the Blacksmith blocker if Testbox itself is required .
568656
569657If brokered AWS cannot dispatch, sync, attach, or stop, retry once with
570658` --debug ` and ` --timing-json ` :
571659
572660``` sh
573- pnpm crabbox:run -- --debug --timing-json -- \
661+ pnpm crabbox:run -- --provider aws -- debug --timing-json -- \
574662 pnpm test:changed
575663```
576664
577665Full suite:
578666
579667``` sh
580- pnpm crabbox:run -- --debug --timing-json -- \
668+ pnpm crabbox:run -- --provider aws -- debug --timing-json -- \
581669 pnpm test
582670```
583671
@@ -596,10 +684,10 @@ Raw Blacksmith footguns:
596684- Treat ` blacksmith testbox list ` as cleanup diagnostics, not a shared reusable
597685 queue.
598686
599- Use Blacksmith only when the task is specifically about Testbox, brokered AWS
600- is unavailable, or an explicit comparison is needed . If Blacksmith is down or
601- quota-limited, do not keep probing it; stay on brokered AWS and note the
602- delegated-provider outage.
687+ Use Blacksmith Testbox through Crabbox by default for OpenClaw agent tests and
688+ heavy work . If Blacksmith is down or quota-limited, do not keep probing it;
689+ switch to direct AWS only when that backend proves the same surface, and note
690+ the delegated-provider outage.
603691
604692## Blacksmith Backend Notes
605693
@@ -636,17 +724,17 @@ Important Blacksmith footguns:
636724blacksmith auth login --non-interactive --organization openclaw
637725```
638726
639- ## Brokered AWS
727+ ## Brokered AWS Fallback
640728
641- Use AWS for normal OpenClaw remote proof. The repo ` .crabbox.yaml ` already
642- selects brokered AWS, so omit ` --provider ` unless you are testing a different
643- provider deliberately .
729+ Use direct AWS when Testbox is unavailable, when the task needs direct-provider
730+ semantics, or when an explicit backend comparison is required. The repo
731+ ` .crabbox.yaml ` defaults to Blacksmith Testbox, so pass ` -- provider aws ` .
644732
645733``` sh
646- pnpm crabbox:warmup -- --class beast --market on-demand --idle-timeout 90m
647- pnpm crabbox:hydrate -- --id < cbx_id-or-slug>
648- pnpm crabbox:run -- --id < cbx_id-or-slug> --timing-json --shell -- " pnpm test:changed"
649- pnpm crabbox:stop -- < cbx_id-or-slug>
734+ pnpm crabbox:warmup -- --provider aws -- class beast --market on-demand --idle-timeout 90m
735+ pnpm crabbox:hydrate -- --provider aws -- id < cbx_id-or-slug>
736+ pnpm crabbox:run -- --provider aws -- id < cbx_id-or-slug> --timing-json --shell -- " pnpm test:changed"
737+ pnpm crabbox:stop -- --provider aws < cbx_id-or-slug>
650738```
651739
652740Install/auth for owned Crabbox if needed:
0 commit comments