Repository navigation
fix(tooling): enforce Linux process-tree memory limits - #160024
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. |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Codex review: needs maintainer review before merge. Reviewed September 27, 2026, 11:52 PM ET / September 28, 2026, 03:52 UTC (Revision 4). ClawSweeper reviewWhat this changesThe branch adds optional Linux process-tree memory limits to OpenClaw's managed tooling runner, packages a bounded launcher, and updates process, CI fixture, and Vitest preload tests. Merge readiness✅ Ready for maintainer review Keep this PR open. Current main lacks aggregate limits in the managed tooling runner, and this branch provides a distinct, opt-in Linux implementation. The earlier lifecycle findings are addressed, and this review found no new blocking defect. Activating limits for lint remains part of the linked issue. Priority: P2 Review scores
Verification
How this fits togetherThe managed tooling runner starts commands used by OpenClaw's development checks and reports their exit status after handling signals and child processes. A capped launch enters a verified Linux systemd scope, then the runner cleans up its descendants before releasing its resource claim. flowchart LR
A[Tooling caller] --> B[Managed process runner]
B --> C{Memory limit requested?}
C -->|No| D[Ordinary child process]
C -->|Yes| E[Verified Linux scope]
E --> F[Workload process tree]
F --> G[Descendant cleanup]
D --> H[Exit result]
G --> H
Before mergeNone. Agent review detailsSecurityNone. PR surfaceTests +734, Other +360. Total +1094 across 16 files. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Technical reviewBest possible solution: Keep one managed-runner owner for Linux scope creation and cleanup, then enable it in semantic-check callers after the linked CI provisioning and platform qualification are ready. Do we have a high-confidence way to reproduce the issue? No high-confidence live current-main reproduction was run in this read-only review. Current source confirms the managed runner has no aggregate kernel cap, and the linked issue records an observed lint memory spike. Is this the best way to solve the issue? Yes for this implementation slice: an opt-in limit at the existing process owner can contain descendants without changing uncapped callers. The broader lint repair still needs caller activation. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 86376d56b287. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (3 earlier review cycles)
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
Carry the preload-owner fix and regression coverage from b9cd492 (#160024). The failing CI merge inherited a newer preload that tried to resolve vitest/runtime relative to temporary JavaScript fixture entrypoints. It crashed before those children could register their IPC handlers. Apply the adapter only to recognized Vitest workers, preserving their package-local runtime while leaving ordinary forks, threads, and evals alone. Keep the accepted canonical-home repair unchanged. Validated the four original failures and the preload regressions before repair, three focused passes, the original CI shard, changed checks, and fresh P1 review on a Linux Testbox. Co-authored-by: Vincent Koc <[email protected]>
Refresh the PR merge ref after #160024 repaired the trusted harness inventory and ordinary child-process jsdom preload. Package source and the reviewed tree are unchanged.
Refresh the PR merge ref after #160024 repaired the trusted harness inventory and ordinary child-process jsdom preload. Package source and the reviewed tree are unchanged.
Refresh the PR merge ref after #160024 repaired the trusted harness inventory and ordinary child-process jsdom preload. Package source and the reviewed tree are unchanged.
Refresh the PR merge ref after #160024 repaired the trusted harness inventory and ordinary child-process jsdom preload. Package source and the reviewed tree are unchanged.
* refactor(packages): deslop shared packages second pass Consolidate remaining stream, parser, schema projection and normalization paths while preserving public exports, wire shapes and runtime semantics. Retain the prior package cleanup owners and shrink assertion ratchets for removed casts. * refactor(packages): preserve schema declarations and finish type cleanup * refactor(packages): preserve explicit guards and import ordering * refactor(packages): retain distinct plugin result declarations * fix(sdk): bundle private session URL dependency The private session URL contract exports TypeScript source and has no standalone package build. Keep it as a build-time dependency so the existing package builder bundles it into the SDK. The unchanged external-consumer E2E reproduced the missing build-script failure before this repair. * ci: refresh packages proof after inherited fixture repairs Refresh the PR merge ref after #160024 repaired the trusted harness inventory and ordinary child-process jsdom preload. Package source and the reviewed tree are unchanged. * ci: refresh packages proof after placement fixture repair Refresh the PR merge ref after #160124 repaired the inherited placement fence synchronization and cleanup race. The reviewed and Testbox-proven package tree remains unchanged. * ci: refresh packages after compiler scheduling repair Refresh the PR merge ref after #160290 separated per-group scheduling from shared compiler inputs. The package tree and active Testbox source hashes are unchanged. * ci: refresh packages after lazy import guard repair
…aw#160085) Refresh OpenAI 7.20.0, Pi TUI 0.86.1, tsx 4.23.15, native TypeScript 7.1.0-dev.20260920.1, Tauri 2.11.6, single-instance 2.4.5, rand 0.10.3, and SimSlim 0.10.0 under the fixed 2026-09-20T18:25:54Z cutoff. Align companion manifests, native locks, Docker tooling, and SimSlim qualification. Preserve existing patches, overrides, the updater fork, and compatibility holds. Validation includes 303 npm consumer cases, 148 Rust core cases, 63 desktop cases, 86 SimSlim cases, actual Linux container and SDK transport proof, four typecheck lanes, 102 npm lock mirrors, and cutoff/integrity audits. Synthetic terminal comparisons are attached to the PR and verified rendered. Independent reviews are clean through P2. Land under explicit maintainer approval for proven pre-existing CI failures. Run 36376168824 exposed three unchanged Windows checkout-fixture inventory failures already repaired on main by openclaw#160024 (fe5c642). The dependency delta does not touch that workflow/helper/test closure. No green full-CI result is claimed. No third-party PR, release, or deployment.
…law#160094) Related: openclaw#160010 ## What Problem This Solves Independent lint and compiler processes can each fit their own heap target while collectively exhausting the host. ## User Impact This adds the shared admission owner for subsequent compiler and lint activation; no existing command uses it yet. Callers receive one host/account slot, a kernel process-tree limit based on current memory headroom, and a 15-minute queue-plus-execution deadline. The owner requires verified Linux containment. Unsupported platforms or insufficient/unknown memory headroom return an actionable refusal instead of starting an unbounded process. Compiler/lint command activation and platform routing are separate PRs. ## Why This Change Was Made The kernel limit from openclaw#160024 bounds one process tree; this owner prevents simultaneous checks across worktrees from independently consuming the same budget. It uses the existing fs-safe lock contract and process-memory reader, with the OS account identity rather than task-specific HOME. Admission follows artifact ownership, measures headroom after waiting, caps the aggregate tree at the smaller of 8 GiB or half of usable capacity/headroom, and refuses below 512 MiB. It records the kernel scope identity before launch and retains ownership when cleanup cannot prove tree extinction. Cancellation remains owned through asynchronous release; soft Go overrides remain intact. ## Evidence - [Blacksmith Testbox proof](https://github.com/openclaw/openclaw/actions/runs/36373081283) exercised real filesystem lock contention, canceled/expired admission, late acquisition, command snapshotting, capacity/headroom refusal, non-Linux refusal, receipt ordering, and retention after uncertain cleanup. Kernel launches are mocked in this focused owner suite; actual kernel enforcement was qualified in the merged parent. - Strict script/root test types, targeted typed lint, formatting, and whitespace passed for the helper and profiler candidate. An independent P0–P2 review found no actionable finding. - This PR cherry-picks the tested helper unchanged onto the merged kernel/cancellation parents. The three dependency-owner modules are byte-identical to the proof base. Hosted CI will validate this exact head. - Production/tooling: +166/-0; tests: +321/-0. The growth supplies the missing cross-worktree admission/lifecycle owner. There is no runtime/config migration or new dependency. CI correction: exact-head check-lint identified nine missing control-flow braces in the new test file. Commit `e590faf299ddb75e36b1a8e503121807785bb1ba` adds those braces; conditions and async sequencing are unchanged. Targeted formatting, whitespace, and independent P0–P2 review pass. Fresh CI provides the updated lint proof. Measured test cost at `e590faf299ddb75e36b1a8e503121807785bb1ba`: the exact helper and test bytes were run on [Testbox](https://github.com/openclaw/openclaw/actions/runs/36376377264) from the profiler child revision, with `--maxWorkers=1`. All 26 cases passed; file test time 1.331s, Vitest wall 1.84s, complete test command 2.69s. Dedicated test execution adds 2.69 CI wall seconds, excluding shared checkout/install/setup. This addresses the review's test-cost finding and Rank-up move; no source change or repeat review is needed.
* refactor(packages): deslop shared packages second pass Consolidate remaining stream, parser, schema projection and normalization paths while preserving public exports, wire shapes and runtime semantics. Retain the prior package cleanup owners and shrink assertion ratchets for removed casts. * refactor(packages): preserve schema declarations and finish type cleanup * refactor(packages): preserve explicit guards and import ordering * refactor(packages): retain distinct plugin result declarations * fix(sdk): bundle private session URL dependency The private session URL contract exports TypeScript source and has no standalone package build. Keep it as a build-time dependency so the existing package builder bundles it into the SDK. The unchanged external-consumer E2E reproduced the missing build-script failure before this repair. * ci: refresh packages proof after inherited fixture repairs Refresh the PR merge ref after openclaw#160024 repaired the trusted harness inventory and ordinary child-process jsdom preload. Package source and the reviewed tree are unchanged. * ci: refresh packages proof after placement fixture repair Refresh the PR merge ref after openclaw#160124 repaired the inherited placement fence synchronization and cleanup race. The reviewed and Testbox-proven package tree remains unchanged. * ci: refresh packages after compiler scheduling repair Refresh the PR merge ref after openclaw#160290 separated per-group scheduling from shared compiler inputs. The package tree and active Testbox source hashes are unchanged. * ci: refresh packages after lazy import guard repair
* fix: allow Doctor repair with canonical service home overrides Compare process and runtime homes independently with the OS account home so a canonical OPENCLAW_HOME in service metadata does not block Doctor credential migration. Preserve relocated-home isolation, active-writer checks, and the existing migration owner. * test: keep inherited Vitest preloads out of verifier children Carry the preload-owner fix and regression coverage from b9cd492 (#160024). The failing CI merge inherited a newer preload that tried to resolve vitest/runtime relative to temporary JavaScript fixture entrypoints. It crashed before those children could register their IPC handlers. Apply the adapter only to recognized Vitest workers, preserving their package-local runtime while leaving ordinary forks, threads, and evals alone. Keep the accepted canonical-home repair unchanged. Validated the four original failures and the preload regressions before repair, three focused passes, the original CI shard, changed checks, and fresh P1 review on a Linux Testbox. Co-authored-by: Vincent Koc <[email protected]> * test(update): align canonical home recovery guidance --------- Co-authored-by: Vincent Koc <[email protected]>
…law#160056) * fix: allow Doctor repair with canonical service home overrides Compare process and runtime homes independently with the OS account home so a canonical OPENCLAW_HOME in service metadata does not block Doctor credential migration. Preserve relocated-home isolation, active-writer checks, and the existing migration owner. * test: keep inherited Vitest preloads out of verifier children Carry the preload-owner fix and regression coverage from fe5c642 (openclaw#160024). The failing CI merge inherited a newer preload that tried to resolve vitest/runtime relative to temporary JavaScript fixture entrypoints. It crashed before those children could register their IPC handlers. Apply the adapter only to recognized Vitest workers, preserving their package-local runtime while leaving ordinary forks, threads, and evals alone. Keep the accepted canonical-home repair unchanged. Validated the four original failures and the preload regressions before repair, three focused passes, the original CI shard, changed checks, and fresh P1 review on a Linux Testbox. Co-authored-by: Vincent Koc <[email protected]> * test(update): align canonical home recovery guidance --------- Co-authored-by: Vincent Koc <[email protected]>
Keep the moved CLI command fixture in its runtime prerequisite group and preserve complete agent coverage across the core and CLI process owners. Carry the test-only trusted-harness fixture fix from #160024. Co-authored-by: Vincent Koc <[email protected]>
* fix(cli): release plugin resources when help finishes Uncached CLI metadata loads now use the existing inspection acquisition when an executable invocation owns them. The source-plugin regression verifies that invocation release joins module disposal. Caller-owned programs retain their existing lifetime. * fix(plugins): release retired registry preparation scope Create the aggregate retirement observer outside the registry preparation scope so it retains only child waiters. Preserve per-observation options, cleanup ordering, failure identity, and deferred consumer results. The unchanged cold registry-retention regression failed on the CI Bun runtime before this change and passes after it. The original seven-file shard passes all 172 cases, and Node retirement coverage passes 20 cases. * fix(ci): carry the chat attachment lint repair Carry the exact two-file fix from 2e95cdb (#160159). Move the unchanged image decoder into its existing helper to restore the 700-line limit without changing attachment behavior. Targeted lint and all 21 attachment tests pass on this candidate. Independent review found no actionable defects. * test: retain complete lifecycle helpers in lease fixtures * test: isolate local command fixtures and join recovery cleanup * test(ci): preserve CLI runtime ownership and harness staging Keep the moved CLI command fixture in its runtime prerequisite group and preserve complete agent coverage across the core and CLI process owners. Carry the test-only trusted-harness fixture fix from #160024. Co-authored-by: Vincent Koc <[email protected]> * fix(tests): scope Vitest preload to test workers Apply the jsdom adapter only at Vitest worker entry points while preserving package-local runtime resolution. Ordinary Workers may inherit the preload without having a Vitest dependency. Exercise default native inheritance and await worker termination. Copy the static-check evidence helper into lint fixtures so the real oxlint entry point can load its current import closure. Validation: reproduced both original failure causes before repair; all 76 affected tests pass (351.44 seconds in Vitest), as do canonical changed-file checks and independent review. * test: isolate public runtime surface planning fixtures Verify public runtime entries and packaged assets with a synthetic publishable plugin after the Diffs forwarding APIs were retired. Preserve the existing planner assertions without depending on one bundled plugin layout. * fix(ci): carry shared lint repairs into CLI preparation * test(tooling): repair extracted PR and npm fixtures * test: retain gateway cleanup and isolate Windows temp paths Close the prewarm gateway when client connection fails and retain cleanup errors during orphaned recovery. Keep Windows-under-Bun coverage on host-owned temporary directories, matching the fixture fix in #160985. Validation: 13 focused fixture tests and canonical changed-file checks. * fix(ci): keep extracted manifest within script contracts Resolve inherited manifest lint errors without changing job selection. Move its closed true/1 flag parsing to the dependency-free argument owner and include that helper in trusted fixture copies. Validation passed 718 tests with eight existing skips, canonical changed checks, fixture lint, and independent review. The 74-case argument helper file took 1.79 seconds at one worker with warm inputs. * test(state): apply upstream snapshot custody fixture isolation Reuse the fixture repair from #161598 (af16b80). Keep the real exit callback and every custody assertion while isolating the synthetic cleanup owner from preceding files. * test(pr): drain fake GitHub streams before exit --------- Co-authored-by: Vincent Koc <[email protected]>
* fix(cli): release plugin resources when help finishes Uncached CLI metadata loads now use the existing inspection acquisition when an executable invocation owns them. The source-plugin regression verifies that invocation release joins module disposal. Caller-owned programs retain their existing lifetime. * fix(plugins): release retired registry preparation scope Create the aggregate retirement observer outside the registry preparation scope so it retains only child waiters. Preserve per-observation options, cleanup ordering, failure identity, and deferred consumer results. The unchanged cold registry-retention regression failed on the CI Bun runtime before this change and passes after it. The original seven-file shard passes all 172 cases, and Node retirement coverage passes 20 cases. * fix(ci): carry the chat attachment lint repair Carry the exact two-file fix from 87b7350 (openclaw#160159). Move the unchanged image decoder into its existing helper to restore the 700-line limit without changing attachment behavior. Targeted lint and all 21 attachment tests pass on this candidate. Independent review found no actionable defects. * test: retain complete lifecycle helpers in lease fixtures * test: isolate local command fixtures and join recovery cleanup * test(ci): preserve CLI runtime ownership and harness staging Keep the moved CLI command fixture in its runtime prerequisite group and preserve complete agent coverage across the core and CLI process owners. Carry the test-only trusted-harness fixture fix from openclaw#160024. Co-authored-by: Vincent Koc <[email protected]> * fix(tests): scope Vitest preload to test workers Apply the jsdom adapter only at Vitest worker entry points while preserving package-local runtime resolution. Ordinary Workers may inherit the preload without having a Vitest dependency. Exercise default native inheritance and await worker termination. Copy the static-check evidence helper into lint fixtures so the real oxlint entry point can load its current import closure. Validation: reproduced both original failure causes before repair; all 76 affected tests pass (351.44 seconds in Vitest), as do canonical changed-file checks and independent review. * test: isolate public runtime surface planning fixtures Verify public runtime entries and packaged assets with a synthetic publishable plugin after the Diffs forwarding APIs were retired. Preserve the existing planner assertions without depending on one bundled plugin layout. * fix(ci): carry shared lint repairs into CLI preparation * test(tooling): repair extracted PR and npm fixtures * test: retain gateway cleanup and isolate Windows temp paths Close the prewarm gateway when client connection fails and retain cleanup errors during orphaned recovery. Keep Windows-under-Bun coverage on host-owned temporary directories, matching the fixture fix in openclaw#160985. Validation: 13 focused fixture tests and canonical changed-file checks. * fix(ci): keep extracted manifest within script contracts Resolve inherited manifest lint errors without changing job selection. Move its closed true/1 flag parsing to the dependency-free argument owner and include that helper in trusted fixture copies. Validation passed 718 tests with eight existing skips, canonical changed checks, fixture lint, and independent review. The 74-case argument helper file took 1.79 seconds at one worker with warm inputs. * test(state): apply upstream snapshot custody fixture isolation Reuse the fixture repair from openclaw#161598 (0cadcec). Keep the real exit callback and every custody assertion while isolating the synthetic cleanup owner from preceding files. * test(pr): drain fake GitHub streams before exit --------- Co-authored-by: Vincent Koc <[email protected]>
Integrate main at cc7e664 to include the fixture provisioning repair from b9cd492 (#160024), which fixes the inherited failure in CI run 36373839884. The nine-file Lobsterdex feature delta remains patch-identical (979c951b512eb74d048acccac9aafcdc7729d047). Verified 95 focused tests, six Chromium checks, 22 matching CI fixture cases, and UI typecheck. Co-authored-by: hannesrudolph <[email protected]>
Related: #160010
What Problem This Solves
Go heap targets do not cap aggregate lint/compiler memory. The shared process owner also needs to join detached descendants before it releases resource ownership.
User Impact
Adds an internal, opt-in Linux process-tree memory limit. Existing uncapped callers retain their behavior; semantic-check callers adopt containment in subsequent small PRs.
Capped launches require a cgroup-v2 systemd user manager. Unsupported platforms fail with an actionable bounded-Linux-worker instruction. Native Windows containment is deferred to a separately qualified change; this PR leaves the existing Windows runner unchanged.
Why This Change Was Made
The managed-process owner verifies the aggregate kernel limit before workload startup and verifies descendant cleanup before releasing its resource claim. Generated scope names belong to that invocation. Default capped launches start cleanup at launcher exit even when detached children hold output pipes open. Signal ownership survives cgroup cleanup and claim release, with the leaf retaining the sole grace timer.
The standalone packaged launcher uses the same verified limit. CI provisioning is separate: #160014.
Production/tooling: +380/-20; tests: +739/-5. Production growth implements the missing kernel containment and cleanup ownership contract.
Evidence
Linux Testbox proof, with changed-source and frozen-input hashes verified:
Review follow-through: both reported lifecycle defects are repaired. The hosted fixture bundling failure is repaired by including the new memory-owner import closure. Windows aggregate containment was removed from this PR pending native qualification. The 34 new unit cases took 261 ms; the 8 real integration cases took 11.356 s (11.72 s Vitest wall time). The complete two-shard focused/regression command took 90.73 s including compiler preparation.
This PR does not activate the caps or complete the lint-memory repair.
Current-head follow-through: adopt landed baseline repairs at
57f1abecc191ea0a54a9af93a6ccb97e6eb87700. The new ownership tests use the repository's typed deferred helper instead of unavailable Promise.withResolvers typing. Run 36372683237 verified seven source/input hashes; all 34 cases, strict root test types, formatting, and whitespace passed (266 ms tests; 1.77 s wrapper). Kernel implementation bytes are unchanged.Shared CI baseline repairs restore the static-step helper to checkout/planning fixtures and the diagnostic helper to the lint fixture. The Vitest preload now initializes only its four packaged worker entrypoints, preserving package-local resolution and ordinary child-process flags; the package-worker workaround was removed.
Run 36374450491 passed all 57 affected preload, package-worker, and database-verifier cases, plus all 8 jsdom cases under each configured forks/threads pool. Run 36374680281 verified five source hashes, passed all 40 lint-status cases, strict root test types, formatting, and whitespace. Its subsequent Bun command could not start because that Testbox had no Bun. Run 36375089688 then installed the checksum-pinned CI runtime and passed all 11 preload/jsdom tests (exit zero, with a Bun directory-mismatch diagnostic recorded). Independent P0–P2 autoreview found no actionable issue in this repair.
Follow-up: release shared test setup before VM realm disposal. An extra vmForks probe passed all 8 assertions, then failed in unchanged process-exit cleanup after realm globals were disposed. VM pools are outside the configured forks/threads matrix; no passing VM qualification is claimed. Hosted CI validates this PR's final context.