Skip to content

fix(crabbox): keep the setup failure reason and name its phase - #130425

Merged
steipete merged 1 commit into
mainfrom
steipete/crabbox-setup-failure-legibility
Aug 26, 2026
Merged

steipete merged 1 commit into
mainfrom
steipete/crabbox-setup-failure-legibility

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

A Crabbox cloud-worker provision that fails during setup can report an error that contains
none of the reason it failed.

Dispatching a Codex remote-exec session to a machine0 cloud-worker profile on a live
Gateway failed with:

Worker provider rejected profile: Crabbox setup failed with exit code 1: workspace owner
acquired wait=218ms recovered=false run context: run=run_b5ffd42c76eb portal=- logs=-
lease=cbx_b0b0d3f1d563 slug=openclaw-b379499e4e816b8f4ec082d9ffc3... <node stack tail>

That reads like a workspace-lock problem. It is not. The real message, captured live from the
worker, was:

Error: Codex remote-exec requires the exact official @openclaw/[email protected] plugin to be
installed by cloudWorkers profile setup

That sentence is exactly the actionable guidance the operator needs, and it was deleted before
the operator ever saw it. Two production defects combined:

  1. Middle truncation discarded the diagnosis. crabboxCommandDetail() kept the first ~254
    and last ~253 characters of combined output and dropped the middle. Crabbox always prints a
    fixed ~250-character run-context banner first, so head preservation was guaranteed to spend
    half the budget on boilerplate. In the real failure (8031 chars of stderr) the actionable
    line sat at collapsed index 2570 — squarely in the deleted middle.

  2. Three setup phases shared one anonymous label. Profile setup, desktop setup, and node
    enrollment setup all failed as Crabbox setup failed …, so the message never said which
    phase broke.

Per the repo's severity order, this is the worst class in play: the action ended with an
outcome the operator could not act on.

Why This Change Was Made

Truncation keeps the tail. A failing command's diagnosis is last; the Crabbox banner is
leading boilerplate. This also makes the pipeline self-consistent — the capture layer
(src/process/exec-output.ts) already retains each stream's suffix. The streams are joined
[stdout, stderr] so stderr, the more diagnostic stream for a failure, occupies the retained
tail instead of being pushed out by a chatty stdout. The 512-character budget is unchanged;
core re-truncates the composed message to 1024 UTF-16 units
(src/gateway/worker-environments/worker-error.ts), so 512 stays well inside it.

Phases are named. Each of the three setup calls now carries its own operator-facing label,
matching the sibling that already does this correctly: the shared SSH bootstrap in
src/gateway/worker-environments/bootstrap.ts labels its phases preflight / bundle transfer / install.

No behavior outside error formatting changes. The prepareCodex() assertion and its message
are untouched: refusing to install a plugin during enrollment is deliberate and documented
(docs/gateway/cloud-workers.md:191), and this change only makes its refusal legible.

User Impact

Operators debugging a failed cloud-worker provision now see which setup phase failed and the
end of that phase's output, where the reason lives. The same failure now reports:

Crabbox node enrollment setup failed with exit code 1: ... Error: Codex remote-exec requires
the exact official @openclaw/[email protected] plugin to be installed by cloudWorkers profile
setup at [eval]:1:399 ...

No config, schema, or protocol surface changes.

Evidence

Root cause was reproduced live on a real machine0 lease, not simulated.

Live root-cause reproduction (machine0, real lease). Warmed a real Crabbox machine0
lease, ran the gateway's own profile setup script through the same
crabbox run --no-sync --script-stdin path the provider uses, then replayed the generated node
enrollment command:

  • Profile setup succeeded, exit 0 in 49.5s — so the failing phase was never profile setup.
  • openclaw plugins inspect codex --json on the worker returned
    {"ok":false,"error":{"message":"Plugin not found: codex..."}} (57 stock plugins installed,
    no codex). That JSON parses cleanly, so prepareCodex() reached its plugin assertion and
    threw synchronously at eval top level — matching the
    evalFunction / evalTypeScript / eval_string frames in the original report.
  • Replaying the enrollment step reproduced the failure exactly: exit 1, 8031 chars of stderr,
    0 stdout.

The lease was destroyed afterwards (released lease=... action=destroy, crabbox list empty).

Before/after on the real captured bytes. Running that exact 8031-char stderr through the
production formatter:

Before — the reason is absent; only the fixed banner survives:

Crabbox setup failed with exit code 1: workspace owner acquired wait=212ms recovered=false
run context: run=run_4241a40b22f5 portal=- logs=- lease=cbx_0a52cf884f68 slug=amber-crayfish
provider=machine0 target=linux type=large ssh=ubuntu@... workdir= ...

After — the phase is named and the actionable instruction survives:

Crabbox node enrollment setup failed with exit code 1: ... exact official
@openclaw/[email protected] plugin to be installed by cloudWorkers profile setup at [eval]:1:399
at runScriptInThisContext (node:internal/vm:209:10) ...

Known bound: at the unchanged 512-character budget the retained tail starts a few characters
into that sentence (... exact official ... rather than requires the exact official ...),
because roughly half the window is Node stack frames. The operator-actionable content is
present; widening the budget was deliberately left out of this change.

Regression tests fail before the production change. Added first, then verified:

× identifies the failed 'profile setup' phase
× identifies the failed 'desktop setup' phase
× identifies the failed 'node enrollment setup' phase
× preserves the node enrollment diagnosis after the Crabbox banner and setup noise
Test Files  1 failed (1)

Validation.

node scripts/run-vitest.mjs extensions/crabbox
Test Files  5 passed (5)
     Tests  200 passed (200)

node scripts/check-changed.mjs — green (format, tsgo extensions + extension tests, lint,
knip dead-code, database-first guard, import cycles).

Autoreview (codex / gpt-5.6-sol / high): clean, no accepted or actionable findings.

Production LOC. Net −4 production lines (+16 / −20); tests +60.

Notes for reviewers

This change makes the failure legible; it does not change the underlying requirement. Codex
remote-exec on a cloud worker requires the profile's settings.setup or the image to install
the official @openclaw/codex plugin — that is documented at docs/gateway/cloud-workers.md:191
and is not machine0-specific. Enrollment deliberately refuses to install plugins itself,
which is why asserting-and-failing is correct behavior here.

@clawsweeper

clawsweeper Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@steipete
steipete marked this pull request as ready for review August 26, 2026 21:23
@openclaw-barnacle openclaw-barnacle Bot added the maintainer Maintainer-authored PR label Aug 26, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 26, 2026
@clawsweeper

clawsweeper Bot commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 26, 2026, 5:57 PM ET / 21:57 UTC.

ClawSweeper review

What this changes

The PR keeps the trailing diagnostic output from failed Crabbox setup commands and identifies whether profile, desktop, or node-enrollment setup failed.

Regression provenance

Possible regression — probable (reproduction; reviewed change). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 1 item remains

The focused diagnostic repair is correct on the reviewed head; keep this maintainer-labeled PR open until exact-head CI completes and normal maintainer review lands.

Priority: P2
Reviewed head: 9b1071acd37a2dc49d393e7936dc3ba3bbc1f623

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) Strong live root-cause evidence, focused owner-boundary repair, and targeted regression coverage support a high-confidence patch review.
Proof confidence 🦞 diamond lobster (5/6) Not applicable: Not applicable as a maintainer-authored PR; the body nevertheless documents a real machine0 lease reproduction and before/after diagnostic output.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: Not applicable as a maintainer-authored PR; the body nevertheless documents a real machine0 lease reproduction and before/after diagnostic output.
Evidence reviewed 7 items Diagnostic owner change: The formatter now orders stdout before stderr and retains the safe UTF-16 suffix, preserving late failure diagnostics within the existing detail bound.
Phase propagation: All three provision setup callers pass distinct phase labels into the shared setup-and-cleanup owner, so command-start and command-exit failures use the same phase name.
Regression coverage: The focused provider tests cover each setup phase and a long machine0-style stderr diagnosis after banner and stdout noise.
Findings None None.
Security None None.

Live Verification

Command: node scripts/run-vitest.mjs extensions/crabbox

Result: PASS (completed)

[test] starting test/vitest/vitest.extensions.config.ts

 RUN  v4.1.11 /tmp/clawsweeper-live-proof-130425-bpExq4/target

 ✓  extensions  extensions/crabbox/index.test.ts (3 tests) 111ms
 ✓  extensions  extensions/crabbox/src/crabbox-worker-provider.test.ts (165 tests) 444ms
 ✓  extensions  extensions/crabbox/src/crabbox-worker-inspect.test.ts (1 test) 1ms
 ✓  extensions  extensions/crabbox/src/doctor.test.ts (5 tests) 8ms
 ✓  extensions  extensions/crabbox/src/crabbox-worker-warm-image.test.ts (26 tests) 3487ms
     ✓ reuses captured images across managers, setup environment values, and setup environment order  450ms

 Test Files  5 passed (5)
      Tests  200 passed (200)
   Start at  21:58:03
   Duration  12.71s (transform 23.34s, setup 3.78s, import 25.91s, tests 4.05s, environment 1ms)

[test] passed 1 Vitest shard in 19.20s
[test] starting test/vitest/vitest.extensions.config.ts

 RUN  v4.1.11 /tmp/clawsweeper-live-proof-130425-bpExq4/target

 ✓  extensions  extensions/crabbox/index.test.ts (3 tests) 34ms
 ✓  extensions  extensions/crabbox/src/crabbox-worker-provider.test.ts (165 tests) 348ms
 ✓  extensions  extensions/crabbox/src/crabbox-worker-inspect.test.ts (1 test) 1ms
 ✓  extensions  extensions/crabbox/src/doctor.test.ts (5 tests) 7ms
 ✓  extensions  extensions/crabbox/src/crabbox-worker-warm-image.test.ts (26 tests) 2939ms
     ✓ reuses captured images across managers, setup environment values, and setup environment order  360ms

 Test Files  5 passed (5)
      Tests  200 passed (200)
   Start at  21:58:23
   Duration  7.97s (transform 8.84s, setup 2.07s, import 13.78s, tests 3.33s, environment 1ms)

[test] passed 1 Vitest shard in 14.39s

Assertions:

  • PASS expect_output: Test Files

How this fits together

Crabbox provisions Gateway cloud workers through several setup commands before returning a usable worker lease. Failed command output is redacted, bounded, and surfaced through provider errors to the operator.

flowchart LR
  A[Cloud-worker profile] --> B[Crabbox provisioning]
  B --> C[Profile desktop and enrollment setup]
  C --> D[Redacted command output]
  D --> E[Phase-labeled provider error]
  E --> F[Gateway operator diagnostics]
Loading

Before merge

  • Resolve merge risk (P1) - Exact-head CI was still in progress in the supplied PR state, so merge readiness is not yet established.
Agent review details

Security

None.

PR surface

Source -4, Tests +60. Total +56 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 2 16 20 -4
Tests 2 68 8 +60
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 84 28 +56

Review metrics

Metric Value Why it matters
Production versus tests production −4, tests +60 The bug fix removes the split truncation path while adding behavior-level coverage for all setup phases and long diagnostic tails.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Retain the tail-oriented, redacted formatter and the three explicit setup phases, then merge after the current head has green required checks.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Retain the tail-oriented, redacted formatter and the three explicit setup phases, then merge after the current head has green required checks.

Do we have a high-confidence way to reproduce the issue?

Yes. The PR records a real machine0 lease reproduction, and the current-main baseline confirms that its middle-truncation path can discard a diagnosis placed after the leading banner.

Is this the best way to solve the issue?

Yes. The change repairs the formatting owner while preserving the existing 512-character bound and passes each setup phase through one canonical error path.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 99a2434f7b89.

Labels

Label changes:

  • remove proof: sufficient: Current real behavior proof status is not_applicable, not sufficient.

Label justifications:

  • P2: The fix improves a bounded cloud-worker provisioning diagnostic without changing provisioning, configuration, or authorization behavior.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: Not applicable as a maintainer-authored PR; the body nevertheless documents a real machine0 lease reproduction and before/after diagnostic output.

Evidence

What I checked:

Likely related people:

  • steipete: The accessible, shallow history attributes the reviewed setup-flow and formatter changes to this contributor; deeper pre-PR history could not be retrieved in this checkout. (role: available Crabbox file-history contributor; confidence: low; commits: 9b1071acd37a; files: extensions/crabbox/src/crabbox-worker-command-error.ts, extensions/crabbox/src/crabbox-worker-provider.ts)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (1 earlier review cycle)
  • reviewed 2026-08-26T21:34:01.294Z sha 3cc4434 :: needs maintainer review before merge. :: none

A Crabbox cloud-worker setup failure could report none of the reason it
failed. crabboxCommandDetail kept the first ~254 and last ~253 characters
and dropped the middle, but Crabbox always prints a fixed ~250-character
run-context banner first, so head preservation spent half the budget on
boilerplate. In a live machine0 failure the actionable line sat at
collapsed index 2570 and was deleted; the operator saw a banner and a
Node stack tail that read like a workspace-lock problem.

Keep the tail instead: a failing command's diagnosis is last, and the
capture layer in src/process/exec-output.ts already retains each stream's
suffix. Join [stdout, stderr] so stderr occupies the retained window
rather than being pushed out by a chatty stdout. The 512-character budget
is unchanged and stays inside core's 1024-unit bound.

Profile, desktop, and node enrollment setup also all failed as
"Crabbox setup failed", so the message never said which phase broke.
Each now carries its own label, matching the shared SSH bootstrap in
src/gateway/worker-environments/bootstrap.ts.

Net -4 production lines.
@steipete
steipete force-pushed the steipete/crabbox-setup-failure-legibility branch from 3cc4434 to 9b1071a Compare August 26, 2026 21:51
@clawsweeper clawsweeper Bot removed the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Aug 26, 2026
@steipete
steipete merged commit f2d344d into main Aug 26, 2026
94 checks passed
@steipete
steipete deleted the steipete/crabbox-setup-failure-legibility branch August 26, 2026 22:06
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Aug 26, 2026
* origin/main: (275 commits)
  fix(ai): require explicit compatible-provider endpoints (#130453)
  test(control-ui): guard the hand-mirrored theme --bg copies (#130444)
  fix(onboard): preserve the saved skills package manager (#130438)
  improve(worker): diagnose admission-deadline failures and widen daemon revalidation budget (#130435)
  fix(plugins): align diffs external install metadata (#130362)
  refactor(models): consolidate config normalization (#130439)
  fix(browser): accept common keyboard aliases (#130401)
  fix(release): refresh IMAP plugin baselines (#130351)
  fix(tests): type sticky model agent fixtures (#130441)
  fix(qa): track current Slack progress cards (#130354)
  feat(ui): refine the mobile composer (#130308)
  fix(ui): clarify gateway disconnect status in tab title (#130364)
  test(qa): await gateway startup before network probes (#130353)
  fix(qa): run Buzz profile scenarios with pooled credentials (#130316)
  fix(crabbox): keep the setup failure reason and name its phase (#130425)
  fix: dashboard tools target the wrong Gateway after admission (#130112)
  fix(ui): distinguish inherited model defaults from session pins (#120805)
  feat(feishu): let agents resend received stickers (#130374)
  refactor(models): prepare selection policy once (#130413)
  fix(ui): make dashboard side panels enter split view (#130426)
  ...

# Conflicts:
#	test/scripts/docker-build-helper.test.ts
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 27, 2026
…law#130425)

A Crabbox cloud-worker setup failure could report none of the reason it
failed. crabboxCommandDetail kept the first ~254 and last ~253 characters
and dropped the middle, but Crabbox always prints a fixed ~250-character
run-context banner first, so head preservation spent half the budget on
boilerplate. In a live machine0 failure the actionable line sat at
collapsed index 2570 and was deleted; the operator saw a banner and a
Node stack tail that read like a workspace-lock problem.

Keep the tail instead: a failing command's diagnosis is last, and the
capture layer in src/process/exec-output.ts already retains each stream's
suffix. Join [stdout, stderr] so stderr occupies the retained window
rather than being pushed out by a chatty stdout. The 512-character budget
is unchanged and stays inside core's 1024-unit bound.

Profile, desktop, and node enrollment setup also all failed as
"Crabbox setup failed", so the message never said which phase broke.
Each now carries its own label, matching the shared SSH bootstrap in
src/gateway/worker-environments/bootstrap.ts.

Net -4 production lines.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extensions: crabbox maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant