Skip to content

refactor(crabbox): consolidate cloud-worker command plumbing - #159357

Merged
steipete merged 1 commit into
mainfrom
codex/crabbox-plugin-deslop
Sep 27, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/crabbox-plugin-deslop

Conversation

@steipete

@steipete steipete commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

The bundled Crabbox cloud-worker plugin repeated the same Crabbox CLI plumbing (non-zero exit → error, stdout extraction, JSON decoding, lease run argv) in a dozen places, and threaded an injectable argv builder through the warm-image manager even though only one production builder exists.

User Impact

No user-visible change. Cloud-worker provisioning, warm images, Doctor output, error messages, and persisted warm-image records are unchanged; the plugin is smaller and has one owner for Crabbox command results.

Why This Change Was Made

Part of a cloud-session stress/deslop pass. crabbox-worker-command.ts now owns command execution, result checking (crabboxCommandOutput), JSON decoding (parseCrabboxJson), error formatting, and the lease run argv; callers use it instead of re-implementing the checks. The separate crabbox-worker-command-error.ts module, the unused warm-image status key parameter, a one-line predicate wrapper, and the passthrough runArgs dependency are removed. Sandbox execution, version probes, catalog parsing, and lease guards keep their own contracts because their error/output rules differ.

Net production change: −21 lines across 15 files.

Evidence

  • node scripts/run-vitest.mjs extensions/crabbox: 20 files / 626 tests passed, plus 13 files / 221 tests passed (13 skipped) in the second shard.
  • typecheck extensions and typecheck extension tests (tsgo) passed; formatting and SDK-boundary checks passed.
  • Reviewed for behavior neutrality: error texts (Crabbox <action> failed with exit code …, … returned invalid JSON), CrabboxCheckpointCreateError for failed creates, and the empty-binary path of checkpoint deletion (still returns false) are preserved.

Unrelated CI failure

checks-node-compact-small-19 (run 36290393694) failed in src/plugin-sdk/session-store-runtime.conversation.test.ts with a teardown error (Agent database resource drainage failed / SqliteWorkerError: Shared-state admission requires the host broker). This PR only touches extensions/crabbox/src. Bounded reproduction: the file passed twice in isolation on an origin/main-based checkout (5/5 each); the failure appears order/shared-state dependent within that shard. No existing issue or PR matched. Re-running the failed job once.

@clawsweeper

clawsweeper Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@steipete
steipete marked this pull request as ready for review September 27, 2026 03:05
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 27, 2026
@clawsweeper

clawsweeper Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge. Reviewed September 27, 2026, 4:50 AM ET / 08:50 UTC (Revision 3).

ClawSweeper review

What this changes

The Crabbox cloud-worker plugin consolidates CLI result checks, JSON decoding, error formatting, and lease command arguments while removing unused warm-image helper plumbing.

Merge readiness

⛔ Needs changes before merge - 1 item remains

Keep open. The focused Crabbox cleanup is absent from current main, and source review found no blocking defect. The author's follow-up connects it to the merged cloud-session reliability work, addressing the prior scope concern; that connection should also appear in the PR body.

Priority: P3
Reviewed head: f127ffbfdbeb8c2ac63cb40f8165fb10b5688201

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The focused, net-smaller patch has useful validation and no identified correctness or security defect.
Proof confidence 🌊 off-meta tidepool Not applicable: The supplied MEMBER classification exempts this internal refactor from the external-contributor proof gate. The PR reports focused tests but no real CLI run; the inspected diff changes no stored warm-image record contract.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The supplied MEMBER classification exempts this internal refactor from the external-contributor proof gate. The PR reports focused tests but no real CLI run; the inspected diff changes no stored warm-image record contract.
Evidence reviewed 9 items Introduced command consolidation: The pinned PR delta moves lease arguments and error formatting into the command module and adds shared result and JSON helpers.
Specialized checkpoint failure retained: Failed checkpoint creation still constructs its specialized error before other failures use the shared command-result check.
Stored record shape retained: The capture-status projection keeps the same fields; the removed parameter was unused. No stored warm-image format change was identified.
Findings None None.
Security None None.

How this fits together

The Gateway sends cloud-worker requests to the bundled Crabbox plugin, which runs Crabbox CLI commands. Command results feed provisioning, warm-image management, enrollment diagnostics, and Doctor output.

flowchart LR
A[Gateway worker request] --> B[Crabbox plugin]
B --> C[Command handling]
C --> D[Crabbox CLI]
D --> E[Command result]
E --> F[Provisioning, warm images, and Doctor]
Loading

Before merge

Agent review details

Security

None.

PR surface

Source -21, Tests -2. Total -23 across 17 files.

View PR surface stats
Area Files Added Removed Net
Source 15 134 155 -21
Tests 2 0 2 -2
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 17 134 157 -23

Review metrics

None.

Technical review

Best possible solution:

Keep command handling plugin-local and preserve the existing lease, error, and warm-image contracts as the reliability work proceeds.

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

Not applicable: this PR addresses duplicated internal plumbing rather than a reported failing user flow; the duplication and consolidation are visible in source.

Is this the best way to solve the issue?

Yes. The shared command owner is a narrow way to remove the duplication, and the inspected callers retain their specialized error and storage behavior.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

No label changes.

Label justifications:

  • P3: This is focused internal cleanup with no reported user-visible behavior change.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The supplied MEMBER classification exempts this internal refactor from the external-contributor proof gate. The PR reports focused tests but no real CLI run; the inspected diff changes no stored warm-image record contract.

Evidence

What I checked:

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

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 (2 earlier review cycles)
  • reviewed 2026-09-27T03:11:36.209Z sha a2a7d4e :: blocked before merge. :: none
  • reviewed 2026-09-27T05:38:59.131Z sha a2a7d4e :: blocked before merge. :: none

@steipete

Copy link
Copy Markdown
Contributor Author

Maintainer-requested: this refactor is part of a cloud-session stress/deslop campaign I asked for (stress test, deslop, and improve the cloud session feature). It is scoped to the Crabbox plugin's command plumbing, behavior-preserving, and a prerequisite cleanup for the Crabbox reliability fixes landing alongside it (#159399).

Keep lease argv, command output checks, JSON syntax errors, and error formatting with the command owner. Remove injected argv builders and unused warm-image status plumbing without changing lifecycle, persistence, or Doctor contracts.
@steipete
steipete force-pushed the codex/crabbox-plugin-deslop branch from a2a7d4e to f127ffb Compare September 27, 2026 08:43
@steipete
steipete merged commit 581cc58 into main Sep 27, 2026
156 checks passed
@steipete
steipete deleted the codex/crabbox-plugin-deslop branch September 27, 2026 09:29
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 28, 2026
Keep lease argv, command output checks, JSON syntax errors, and error formatting with the command owner. Remove injected argv builders and unused warm-image status plumbing without changing lifecycle, persistence, or Doctor contracts.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extensions: crabbox P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M 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