Repository navigation
feat(worker): enforce Node worker resource limits - #110
Merged
Merged
Conversation
Requires OpenClaw WebKit. Adapt oven-sh#32896 for per-VM managed heap limits, nursery and stack sizing, Node-only option parsing and worker-only OOM termination. Code-range sizing remains reporting-only; defaults are fixed and idle GC is outside this change. Co-authored-by: robobun <[email protected]>
This was referenced Oct 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implement Node worker resource-limit reporting and bind it to OpenClaw WebKit's per-VM managed-heap, nursery and stack controls. Previously
worker.resourceLimitswas missing and worker heap limits were not enforced.The worker finishes initialization GC before installing limits. A full-GC limit breach requests termination through the existing cross-thread owner and reports
ERR_WORKER_OUT_OF_MEMORYfollowed by exit code 1 in the parent. Normal exit and explicit termination keep their original reason. ArrayBuffer backing storage is excluded; the parent reports{}once the worker exits. Options are parsed only for Node workers, with Node's getter evaluation order. Global Web Workers do not parse or enforce these limits.Fixed defaults and reporting-only
codeRangeSizeMbare documented experimental limitations. This does not implement idle GC. Adapts oven-sh#32896; thanks @robobun. Requires OpenClaw WebKit, pinned on main by #108; upstream remains open and no duplicate PR is needed.Before: 9/14 added resource-limit cases fail on old-engine Bun; Node 24's contract probe passes. OpenClaw custody fails 2/2 and worker memory fails at missing limit reporting; Linux Node controls pass 2/2 and 1/1. After: all 14 added cases pass; surrounding worker suites pass 281 tests with one skip and zero failures; the expanded plain fork selection passes 47/47 with zero regressions. Cross-target Rust checking passes all 12 targets. Custody passes 2/2 and memory passes 1/1. In the memory test, old Bun already passed the allocation, idle-heap and worker-reuse assertions before failing the final resource-limit assertion. This change makes that last assertion pass; it does not add a new idle-GC implementation. The integrated sample reports about 135.6 MB allocated and 1.37 MB after the existing idle collection. The full branch at the new head passes scoped Codex P2 review against its merge-base with fork main. Both exact-head native lanes pass: Linux x64 and macOS arm64. Clippy and formatting also pass on the corrected head.
Linux proof was built at
9052469a0f89e61ac37a9985cfeef0b931b7f7c7; head3d262f621824263f6f117971e9fd980482604a4bdiffers from that tested source by exactly oneSAFETYcomment required by Clippy. A strict source comparison confirms no runtime-logic change. The fully integrated stack additionally passes all four OpenClaw consumers on one binary.