Proposal: crabbox shard, parallel checkpoint fan-out with one merged suite verdict
Note: I would like to build this feature myself and will submit the PR. Please do not pick this up; I am filing the proposal first so maintainers can shape the design before any code exists.
cc @steipete
Problem
Command fan-out (#836) documents test sharding as its flagship example: crabbox checkpoint fork chk_... --count 3 -- pnpm test -- --shard '{{index}}/{{total}}' (docs/commands/checkpoint.md, "Command fan-out"). Today that example does not buy any wall-clock time. The fan-out loop is sequential: each iteration acquires the fork, runs its shard to completion through crabbox run --id <lease> --keep, and (without --keep) releases the lease before the next fork is created (internal/cli/checkpoint.go, the --count loop calling checkpointForkRecordOnce). Three shards therefore cost the full suite runtime plus three fork setups, which is slower than a single plain run.
Two follow-on gaps compound it:
- An error in shard i returns immediately, so later shards never run and there is no complete picture of the suite.
- There is no aggregation. Each shard attaches its JUnit summary to its own run record; nothing merges the shards into one verdict, so answering "did the suite pass" means manually walking N run ids through
crabbox results.
Everything expensive about parallel suite execution is already solved in the codebase: checkpoints capture warmed dependencies, fork fan-out provisions specialized copies with {{index}}/{{total}} templating, the run path records history and logs per lease, and the results pipeline parses JUnit locally into a TestResultSummary with per-case failures. What is missing is the orchestration: running the forks concurrently and folding their results into one answer.
Proposal
crabbox shard --count <n> --from <checkpoint-id> [run flags] -- <command...>
crabbox shard --count 8 --from chk_deps --junit junit.xml -- pnpm vitest --shard '{{index}}/{{total}}'
Behavior:
- Fork
--countleases from the checkpoint concurrently and run the templated command on every fork in parallel. The existing fan-out building blocks are reused unchanged: the fork flow from #836, the{{index}}/{{total}}/{{lease}}/{{slug}}template variables, and the normal run pipeline with an injected--id, so sync, history, logs, artifacts, and results behave exactly as forrun. - Stream all shards live with a stable per-shard prefix (
[3/8] ...) so interleaved output stays readable;--quietreduces it to per-shard status lines. - A failing shard does not abort the others; every shard runs to completion so the verdict is complete. (Question 2 below covers a fail-fast option.)
- With results wiring configured (
--junit,--results-auto, or repo config), each shard's JUnit is parsed locally through the existing results pipeline and the per-shard summaries are merged into one suite verdict: totals, suite time vs wall clock, and per-case failures with their shard index and run id, printed as a table plus--json. - The exit code aggregates across shards: nonzero if any shard's command failed, and
--fail-on-test-failureskeeps its documented meaning evaluated against the merged summary. - Cleanup is guaranteed: every fork the command created is released on success, failure, and Ctrl-C, with
--keepretaining forks under the existing fork keep semantics. A shard that fails to provision does not orphan its siblings.
Cost stance: this command intentionally holds --count leases at once, so the count is always explicit (no default fan-out), the plan (provider, type, count) is printed before provisioning, and nothing idles: forks exist only for the duration of their shard. A repo-config cap (shard.maxCount) bounds what a checkout may request.
Scope for the first PR: provider-neutral orchestration in internal/cli only, dispatched through the same fork flow #836 uses; no coordinator or worker changes; the merged verdict is printed locally, not stored (question 3). No automatic test splitting: the command template owns sharding via {{index}}/{{total}}, exactly as the current docs example shows. Delegated providers and checkpoints that cannot fork keep their existing clear errors. New internal/cli/shard.go plus tests and a command doc.
Questions for maintainers
- Command shape: a new
crabbox shard, orcheckpoint fork --parallelextending the #836 surface directly? - Should the default be run-all-shards-to-completion (full verdict), with
--fail-fastopting into cancel-remaining-on-first-failure, or the reverse? - Is a locally printed merged verdict the right v1, or should the merged summary also be recorded on the coordinator (for example a parent run record grouping the shard runs) from the start?
If the direction looks right I will follow up with a bounded PR including regression tests and a recorded before/after demo (serial fan-out vs parallel shards: wall clock and the merged verdict).
Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve. Reviewed July 3, 2026, 11:33 PM ET / 03:33 UTC.
Summary Keep open: current main only has sequential checkpoint command fan-out and per-run JUnit summaries; the requested parallel orchestration and merged suite verdict remain unimplemented and need maintainer product/API choices.
Reproducibility: not applicable. this is a feature proposal, not a bug report. Source inspection confirms current main has sequential command fan-out but no crabbox shard command, concurrent orchestration, or merged shard verdict.
Ways to help us reproduce this
- Add a screenshot or short recording showing the behavior.
- Add expected vs actual behavior.
Next step Maintainers need to answer the requested product/API questions before any implementation is safe to queue.
Review details
Best possible solution:
Keep this proposal open for maintainer direction, then let the contributor submit a bounded provider-neutral PR once the CLI/API and result-recording shape is settled.
Do we have a high-confidence way to reproduce the issue?
Not applicable; this is a feature proposal, not a bug report. Source inspection confirms current main has sequential command fan-out but no crabbox shard command, concurrent orchestration, or merged shard verdict.
Is this the best way to solve the issue?
Unclear until maintainers answer the command-shape and persistence questions. The provider-neutral internal/cli boundary looks consistent with repository policy, but an autonomous implementation should not choose the public CLI/config contract on its own.
AGENTS.md: found and applied where relevant.
Remaining risk / open question:
- The proposal intentionally leaves command shape, fail-fast default, and local-versus-coordinator merged result storage for maintainer decision.
- Any eventual PR will hold multiple leases concurrently, so cleanup on failure and interrupt needs focused tests and real provider proof before merge.
Codex review notes: model internal, reasoning high; reviewed against 3a8ff8de2ef2.
Label changes
Label changes:
- add
P3: This is a useful but speculative feature proposal with explicit product/API questions and no urgent regression. - add
impact:other: The issue affects remote test orchestration, wall-clock feedback, and aggregate suite verdict ergonomics, which do not fit the more specific impact labels. - add
issue-rating: 🌊 off-meta tidepool: Current issue advisory state selects this label. - add
clawsweeper:no-new-fix-pr: Current issue advisory state selects this label. - add
clawsweeper:fix-shape-clear: Current issue advisory state selects this label. - add
clawsweeper:needs-maintainer-review: Current issue advisory state selects this label. - add
clawsweeper:needs-product-decision: Current issue advisory state selects this label.
Label justifications:
P3: This is a useful but speculative feature proposal with explicit product/API questions and no urgent regression.impact:other: The issue affects remote test orchestration, wall-clock feedback, and aggregate suite verdict ergonomics, which do not fit the more specific impact labels.
Evidence reviewed
What I checked:
- Repository policy read: AGENTS.md was read in full; its provider-neutral core guidance is relevant to keeping this proposal inside generic CLI orchestration rather than provider-specific logic. (
AGENTS.md:1, 3a8ff8de2ef2) - Vision fit: VISION.md says core behavior stays provider-neutral, which matches the proposal's scoped v1 in internal/cli using existing fork/run paths. (
VISION.md:3, 3a8ff8de2ef2) - Sequential fan-out loop: checkpointFork loops from 1 to count and returns immediately on checkpointForkRecordOnce error, so shards are not run concurrently or collected into one verdict. (
internal/cli/checkpoint.go:756, 3a8ff8de2ef2) - Per-fork run dispatch: runCheckpointForkCommand expands the per-fork template and calls a.runCommand with --id and --keep for one lease at a time. (
internal/cli/checkpoint.go:892, 3a8ff8de2ef2) - Per-run result collection: The run path collects JUnit into a TestResultSummary for the single run and applies fail-on-test-failures there; it does not merge results across forked runs. (
internal/cli/run.go:1505, 3a8ff8de2ef2) - Docs describe command fan-out, not shard aggregation: The checkpoint docs document --count and command fan-out through crabbox run --id, but no parallel shard command or merged suite verdict. (
docs/commands/checkpoint.md:261, 3a8ff8de2ef2)
Likely related people:
- vincentkoc: GitHub PR metadata and git blame show this person authored the merged command fan-out slice that this proposal builds on. (role: recent fan-out contributor; confidence: high; commits: 5a8851538789; files:
internal/cli/checkpoint.go,internal/cli/checkpoint_test.go,docs/commands/checkpoint.md) - steipete: Git history attributes the current checkpoint fork scaffolding and JUnit result pipeline to Peter Steinberger-authored commits around the central files. (role: checkpoint and results area contributor; confidence: medium; commits: ef898c27570a, afab084fd40a, 761b49513d4d; files:
internal/cli/checkpoint.go,internal/cli/run.go,internal/cli/results.go)
How this review workflow works
- 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-reviewcomments, 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-reviewor@clawsweeper re-runon an open PR or issue to request a fresh review only. - Maintainers can also comment
@clawsweeper reviewto 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 explainto ask for more context, or@clawsweeper stopto stop active automation.
seems worthwhile
Ok thanks @steipete! I will try to build this, let me know about the questions I proposed above, if not ill just build the best one that would work.
Implemented and merged via https://github.com/openclaw/crabbox/pull/842. Landed on main at 991cd1cdeb30a292ba50dab6d19290999807d966.