Repository navigation
fix(scripts): build heap ignores its systemd memory budget and takes the full default - #123979
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 23, 2026, 11:25 PM ET / August 24, 2026, 03:25 UTC. ClawSweeper reviewWhat this changesThis PR derives build heap limits from the process cgroup hierarchy, prevents unsafe cleanup, updates CI prebuild planning, and documents the source-build memory floor. Merge readinessKeep open. Current main still probes only static cgroup-root paths, so it does not solve systemd slice budgeting; the remaining merge decision is whether the intentional fail-closed behavior is acceptable for existing low-memory source builds. Priority: P1 Review scores
Verification
Live VerificationCommand: Result: PASS (completed) Assertions:
How this fits togetherThe build wrapper starts tsdown and clears generated outputs before rebuilding artifacts. This change turns Linux cgroup information into a bounded heap plan used by local builds and selected CI shards. flowchart LR
A[Build or CI shard] --> B[Build planner]
B --> C[Cgroup budget reader]
C --> D[Heap admission decision]
D --> E[Output cleanup and tsdown]
E --> F[Artifacts or visible refusal]
Decision needed
Why: This is an intentional compatibility and operator-experience choice that source review cannot settle alone. Before merge
Agent review detailsSecurityNone. PR surfaceSource +15, Tests +1909, Docs +6, Config +20, Other +860. Total +2810 across 25 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Accept the cgroup resolver at the build-owner boundary only with an explicit maintainer decision on fail-closed admission and a recorded justification for the coupled production growth. Do we have a high-confidence way to reproduce the issue? Yes, source-reproducible: current main’s two root paths cannot discover a systemd slice limit, while the PR’s focused fixtures exercise that hierarchy. No tests were run because this review is read-only. Is this the best way to solve the issue? Unclear: resolving cgroups at the build owner is the right technical boundary, but default fail-closed admission needs maintainer product judgment. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against c337919f6d4f. LabelsLabel changes:
Label 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 (44 earlier review cycles; latest 8 shown)
|
|
/clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
/clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
/clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
/clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
/clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
/clawsweeper re-review |
|
/clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
A systemd-managed build could size V8 from host RAM instead of the process's enforceable cgroup budget. On the observed 5 GiB slice, that selected a 12,288 MiB heap, drove the slice into reclaim, and contributed to unrelated services being OOM-killed.
This is the final layer of the original stack. #123975 and #123976 are merged; this PR targets
maindirectly.What changed
--no-configpositional builds keep their dependency-owned single-process behavior.@openclaw/normalization-core; remove the duplicate script helper.The architectural owners remain the build wrapper for admission/cleanup, normalization-core for mount-path decoding, CI planning for shard prerequisites, and workspace quiescence for watchdog lifecycle. No parallel fallback path was added.
Operator-visible proof
Full eleven-invocation build in a transient systemd unit with
MemorySwapMax=0:An automatically sized 4 GiB build now exits before output cleanup. The explicit operator recovery path remains available:
Maintainer decision: accept fail-closed admission for constrained or unprovable Linux source builds, with the documented explicit heap override as the operator-owned escape hatch. The build, cleanup, CI-prerequisite, and watchdog safeguards are accepted as one coherent repair.
Review and verification
Exact head:
45e5acd41708003d80b08a7e3c28e05163a7743epnpm lint:scripts, changed-file formatting, andgit diff --check: passed.32684970145: passed. Build artifacts, script lint, the runtime-prebuilt compact shard, and the private-QA-prebuilt changed-extension shard all passed on a fresh checkout. Two unrelated transient jobs passed on the failed-only rerun without branch changes.isPathInside(base, target)returns true whentargetis equal to or belowbase;assertTsdownCleanOutputRootstherefore correctly passes(candidateRoot, cwd)to reject a candidate that is the checkout or an ancestor. The namedroots: [".."]regression passed locally (1 passed / 155 skipped), and the bot's own exact-head run passed all 156 tests in that file.Diff classification
The positive tooling delta implements the cgroup-topology, argument-serialization, output-cleanup, cache, CI-prerequisite, and workspace-lifecycle contracts; tests cover the changed and sibling failure paths. The last review fix adds three production lines solely to satisfy the enforced no-map-spread rule while preserving planner output.
Rank-up moves
mainand passed; GitHub reports the PR mergeable.