Repository navigation
fix(build): allow retrying failed source builds - #160059
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 27, 2026, 11:31 PM ET / September 28, 2026, 03:31 UTC. ClawSweeper reviewWhat this changesThe source-build entry now reports failures through its process exit code, with process-level tests for failed builds and invalid arguments. Merge readiness✅ Ready for maintainer review Keep open. Current main still has the reported cleanup failure, and this focused PR addresses it. Source review found no blocking defect. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw's source-build script selects and runs artifact-producing steps. An ownership wrapper tracks build children and controls when another build may write generated artifacts. flowchart LR
A[Build command and profile] --> B[Artifact ownership wrapper]
B --> C[Selected build steps]
C --> D[Managed child process]
D --> E{Child work joined?}
E -->|Yes| F[Release claim and lock]
E -->|Unverified| G[Retain lock for inspection]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceTests +108, Other 0. Total +108 across 2 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: A joined failed build should preserve its exit code and diagnostics while releasing ownership for an immediate retry; unverified child work should continue retaining the lock. Do we have a high-confidence way to reproduce the issue? Yes, from source: run a failing build under inherited artifact ownership on pinned main and the immediate exit can strand its claim. The PR reports this pre-fix failure and after-fix success on Testbox; this review did not execute it. Is this the best way to solve the issue? Yes. Setting the exit code at the build entry preserves failure reporting while allowing the existing ownership cleanup to finish. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 7b2394da7a9d. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
What Problem This Solves
Failed source builds can leave distribution artifact ownership behind and block the next build, even after all build children have exited.
User Impact
Developers can retry a failed source build without manually removing a stale artifact lock. Failure exit codes and diagnostics stay unchanged. Crashes and unjoined children still retain ownership for inspection.
Why This Change Was Made
The build entry runs inside the inherited artifact owner's import wrapper. Calling
process.exitbypassed that wrapper'sfinallyand left a child claim behind. Settingprocess.exitCodelets the existing cleanup finish; the argument-error path also skips build work. No lock-recovery policy changes are needed.Found while validating #159933 and kept in this separate tooling fix.
Evidence
owner.jsonremained. After the repair, both release the lock and successfully reacquire ownership.pnpm test test/scripts/build-all-ownership.test.ts --maxWorkers=1passed both cases in 3.67s wall (2.26s Vitest duration). The existing build and distribution-ownership suites passed 119 tests in 24.10s wrapper time, including crash/unjoined retention controls. The new regression also passed in hosted CI in 1.065s test time.57f1abecc191ea0a54a9af93a6ccb97e6eb87700already fixes them; this branch incorporates it. The refreshednode scripts/check-changed.mjs -- scripts/build-all.mts test/scripts/build-all-ownership.test.tsand fullpnpm buildpassed on the rebased head. Build phase time was 7m38s; the combined completion command exited 0 in 13m45s.a19b6d66f460c959f01f64a0731bbda3f5d55bca, includingopenclaw/ci-gate.The focused proof used Blacksmith Testbox lease
tbx_01m3jzqp43s4p491q1tj27csdb. Completion gates usedtbx_01m3k0f639j097m2extz9vqe9z(run 36373369154) at candidatea19b6d66f460c959f01f64a0731bbda3f5d55bca; the rebase is patch-identical. Both leases are stopped. All tests, checks, and builds ran remotely throughscripts/crabbox-wrapper.mjs, with source bytes verified before execution.