Repository navigation
fix(build): concurrent checks lose generated declarations - #132340
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 29, 2026, 3:50 AM ET / 07:50 UTC. ClawSweeper reviewWhat this changesThis PR makes build, declaration-generation, TypeScript-check, and dependent lint commands share checkout-local ownership so concurrent cleanup cannot remove declarations still being consumed. Merge readinessKeep open for maintainer review: this is a focused repair for a build-tooling race that current main does not yet contain, with no concrete correctness finding in the introduced patch. Priority: P2 Review scores
Verification
How this fits togetherBuild and validation entrypoints generate and consume declarations under the checkout’s output directories. This change places a common ownership boundary around cleanup, generation, caching, and consumers so concurrent commands cannot invalidate one another’s inputs. flowchart LR
A[Build and check commands] --> B[Checkout ownership lock]
B --> C{Ownership available?}
C -->|Yes| D[Generate or restore declarations]
D --> E[Compile and lint consumers]
E --> F[Release after child cleanup]
C -->|Busy or unverified| G[Wait or fail closed]
Decision needed
Why: The code intentionally changes the operational failure mode of established build commands; that availability-versus-integrity policy needs maintainer acceptance rather than an automated choice. Before merge
Agent review detailsSecurityNone. PR surfaceTests +564, Docs +16, Other -87. Total +493 across 23 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain one checkout-rooted owner for all artifact writers and consumers, with the documented fail-closed recovery behavior, once exact-head CI and the fs-safe contract review confirm the intended operational tradeoff. Do we have a high-confidence way to reproduce the issue? Yes. The introduced barrier-controlled regression exercises a declaration writer and real tsdown cleanup in the original concurrent order, including subdirectory entrypoints. Is this the best way to solve the issue? Yes in architecture: a single checkout-rooted owner covers the producer and consumers instead of adding consumer guards or retries. The exact fs-safe release/reclaim behavior still merits maintainer confirmation before merge. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 6b1eacad9381. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (4 earlier review cycles)
|
|
Land-ready at For this maintainer landing, the documented fail-closed policy is intentional and accepted: output integrity takes precedence over automatically reclaiming an owner whose detached writers cannot be disproved. Normal joined work releases promptly; an unverified exit retains ownership for the documented manual recovery. This is a bounded build-tooling availability tradeoff, not a new application configuration or database migration. The latest ClawSweeper review covers this exact head and requests policy acceptance plus direct dependency verification, not a corrective patch. Immediately before preparation I personally reread installed Final local commands and results:
Earlier integration evidence remains in the PR body: cold and cache-restoring full builds with a competing real QA lint command, 123 plugin boundary compiles plus a negative canary, and 445 Linux tests with an uncached 13-phase build and all dependency/export scans. Linux proof used configured Blacksmith Testbox, lease CI history was repaired, not bypassed. Run 33233027043 exposed Linux zombie-group misclassification and opaque export dispatch; both were fixed in the owner. Later runs hit main-added failures already corrected by the Gateway fixture fix in PR 132406, the QA suppression-inventory fix in PR 132394, and the shared media-test extraction in PR 132444. The last was already in flight, so it was awaited rather than duplicated. All three repair commits remain patch-identical across those main refreshes; this PR adds none of those upstream test/inventory changes. The checkout-root review finding was independently reproduced and fixed in the shared owner and cleanup guard, not by adding consumer workarounds. The regression uses the reachable subdirectory compiler and nested-entry paths; normal lint preparation remains cwd-relative, so no new subdirectory lint interface or synthetic bypass was introduced. Declaration contents/layout are unchanged, and full builds still do not replace boundary preparation. No fake declarations, dependency edits, new flags/configuration, suppressions, or increased execution/test budgets. Tooling +996/−1083, net −87; tests/support +863/−299, net +564; docs +16. Historical deletion timing and earlier local compiler-stall causes remain untraced; Windows process fault injection was not run locally. The separate standalone runtime-staging audit remains a follow-up, and the frozen Code Mode repair was not modified. |
|
@clawsweeper re-review The new head |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
4161234 to
e586911
Compare
e586911 to
b59556f
Compare
b59556f to
6770311
Compare
|
Merged via squash.
|
…32340) * fix(build): concurrent checks lose generated declarations * fix(build): join exited tools through canonical CLI entries * fix(build): share artifact ownership across checkout subdirectories
Closes #132333 — concurrent builds delete declarations used by active checks.
Additional instructions
Same-repository branch; maintainers can push follow-up changes.
What Problem This Solves
Concurrent build and validation commands in one checkout could delete declarations that an active compiler or lint process still needed. The reported symptom was
TS2307foropenclaw/plugin-sdk/qa-channel-protocolduring package-boundary preparation.The historical logs establish overlap and the compiler failure, not the exact deletion timing. A separate barrier-controlled regression demonstrated real tsdown cleanup deleting a native-compiler declaration while its writer remained active.
Why This Change Was Made
One checkout-local owner now spans cleanup, generation, build-cache restoration/finalization, and dependent compile/lint consumption. Its fs-safe lock lives outside all cleaned output roots. This removes both dist-local locks and duplicate boundary process supervision rather than compensating with declarations, retries, or consumer guards.
Nested commands execute their normal CLI under private inherited ownership, retaining separate Node heaps and explicit shard concurrency. Completion claims retain the lock if a nested wrapper dies before its detached compiler joins. Live owners may run beyond the old ten-minute lock-acquisition deadline; compiler/build execution deadlines are unchanged. Abandoned or unverifiable ownership fails closed without PID/age-based reclamation. Normal release uses fs-safe's exact owner-snapshot recheck.
Real Linux CI exposed a related supervisor defect:
kill(-pgid, 0)counted successfully exited, unreaped esbuild processes as active work. A deterministic subreaper reproduction proved that distinction. The shared inspector now recognizes only a successfully inspected, exact owned group consisting entirely of zombies after leader exit; live or unverified work still fails. The repair also deletes generated eval/function-name dispatch and unused exports rather than suppressing dead-code checks.Follow-up review also exposed caller-cwd versus checkout-root identity. A real subdirectory-started compiler could still lose root declarations, and subdirectory cleanup could accept the root ownership directory as output. Acquisition, inherited child claims, retained-work records, and cleanup now reuse one checkout-root resolver, without changing cwd or argv. Root, direct-subdirectory, nested-subdirectory, and cleanup-containment regressions prove that boundary.
A bounded adjacent fixture repair publishes a PID file atomically: an empty read could otherwise become PID 0 and make failure cleanup signal the test process group.
User Impact
Build and validation commands wait instead of invalidating each other's generated inputs. Independent checkouts remain independent. Standalone tsgo commands serialize per checkout; the existing core test-shard concurrency remains intact within one owner.
Interrupted or unjoined ownership requires inspection and manual recovery, documented in the testing guide. Declaration contents/layout are unchanged: full builds do not replace package-boundary preparation of source-shaped declarations and private QA shims. No dependency edits, fake declarations, public flags/configuration, suppressions, execution-timeout increases, application-runtime changes, or database migrations.
Separate follow-up: audit direct runtime-only staging and source-launcher build/postbuild sequences. This repair does not claim transaction-wide ownership for arbitrary standalone staging commands, and does not modify the separate frozen Code Mode repair.
Evidence
AI-assisted implementation. Independent Codex review of the original repair passed; a fresh blocking-threshold review of the final CI fixup and root-identity follow-up also completed with no accepted/actionable findings.
677031140ff32229a3c5afb44431338207a2e2eb. Native review artifacts validated andOPENCLAW_TESTBOX=1 scripts/pr prepare-run 132340passed with the exact prepared/remote head unchanged. The documented fail-closed output-integrity policy is explicitly accepted for this maintainer landing; the installed lock contract was personally rechecked immediately before preparation.env OPENCLAW_BUILD_CACHE=0 pnpm build:ci-artifactspassed all 13 phases;pnpm deadcode:dependenciesand all threepnpm deadcode:exportsscans passed.node scripts/check-changed.mjs -- <all 13 fixup paths>passed. The monitored original-ordernode scripts/run-vitest.mjs test/scripts/dist-artifact-ownership.test.tspassed 11/11, including real preparation/private-QA-shim consumption through lint, unchanged 30-second test budgets, and preserved shard concurrency. Earlier local attempts had timeouts; their exact compiler-stall cause remains untraced. The monitored run passed without a source, timeout, assertion, or environment workaround.pnpm buildboth passed while a competing real QA-channel lint command waited then completed. The cold wait exceeded thirty minutes.pnpm test:extensions:package-boundarypassed 123 plugin compiles plus a negative root-directory canary. Actual source-shaped QA and private-QA declarations were verified, with no retained owner/child records afterward.@openclaw/[email protected]exclusive creation, retained-on-exit behavior, snapshot-checked release and fail-closed handoff; inspected esbuild 0.28.1 service shutdown and Linux process-state semantics. No dependency modification.tbx_01m15z450y60z7h8amx8jn3ge7, run 33235754183, Linux Node 24.19.0. Command exit/timing records establish proof; lease cleanup may cancel the hosting workflow and is not the required PR CI gate. Both owned leases are verified completed. Local Node 24.20.0 on macOS; Windows process fault injection was not exercised locally.Build/tooling: +996/−1083 (net −87). Tests/support: +863/−299 (net +564). Docs: +16. Gross tooling changes include indentation around callable implementations; the net reduction removes duplicate ownership/supervision. The small Linux classifier growth is required to distinguish exited zombies from actual live writers.