Repository navigation
fix(crabbox): keep the setup failure reason and name its phase - #130425
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 26, 2026, 5:57 PM ET / 21:57 UTC. ClawSweeper reviewWhat this changesThe PR keeps the trailing diagnostic output from failed Crabbox setup commands and identifies whether profile, desktop, or node-enrollment setup failed. Regression provenancePossible regression — probable (reproduction; reviewed change). No predecessor PR is attributed. Merge readinessThe 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 Review scores
Verification
Live VerificationCommand: Result: PASS (completed) Assertions:
How this fits togetherCrabbox 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]
Before merge
Agent review detailsSecurityNone. PR surfaceSource -4, Tests +60. Total +56 across 4 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest 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. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
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.
3cc4434 to
9b1071a
Compare
|
Merged via squash.
|
* 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
…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.
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-execsession to amachine0cloud-worker profile on a liveGateway failed with:
That reads like a workspace-lock problem. It is not. The real message, captured live from the
worker, was:
That sentence is exactly the actionable guidance the operator needs, and it was deleted before
the operator ever saw it. Two production defects combined:
Middle truncation discarded the diagnosis.
crabboxCommandDetail()kept the first ~254and 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.
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 whichphase 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 retainedtail 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.tslabels its phasespreflight/bundle transfer/install.No behavior outside error formatting changes. The
prepareCodex()assertion and its messageare 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:
No config, schema, or protocol surface changes.
Evidence
Root cause was reproduced live on a real
machine0lease, not simulated.Live root-cause reproduction (machine0, real lease). Warmed a real Crabbox
machine0lease, ran the gateway's own profile setup script through the same
crabbox run --no-sync --script-stdinpath the provider uses, then replayed the generated nodeenrollment command:
openclaw plugins inspect codex --jsonon 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 andthrew synchronously at eval top level — matching the
evalFunction/evalTypeScript/eval_stringframes in the original report.0 stdout.
The lease was destroyed afterwards (
released lease=... action=destroy,crabbox listempty).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:
After — the phase is named and the actionable instruction survives:
Known bound: at the unchanged 512-character budget the retained tail starts a few characters
into that sentence (
... exact official ...rather thanrequires 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:
Validation.
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.setupor the image to installthe official
@openclaw/codexplugin — that is documented atdocs/gateway/cloud-workers.md:191and is not machine0-specific. Enrollment deliberately refuses to install plugins itself,
which is why asserting-and-failing is correct behavior here.