Repository navigation
fix: allow large Linux host builds to use the shared memory allowance - #193044
Conversation
Replace per-command quarter-RAM cancellation with shared RAM/swap accounting, host and Gateway reserves, and inherited cgroup bounds. Preserve delegated I/O and add durable hard backstops and recovery notification for memory failures. Retain the 304-line regression allocation and add exactly 85 lines for the pending-write cancellation/authority regressions and required fixture repairs. Focused tests, format, lint, typechecks and build passed on AWS; the final older-kernel Gateway pressure acceptance remains failed and documented. Closes #191975
|
🦞👀 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. What this changesThis PR replaces separate Linux host-command memory limits with a shared RAM and swap allowance covering ordinary and durable commands. Example: A foreground build on a Linux service with 20 GiB RAM uses 7.28 GiB of process-tree RSS.
Review scores
ProductKind: Feature · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this maintainer-directed PR addresses a concrete Linux build restriction, resolves the prior mock-export finding, and has no newly identified actionable defect. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherGateway exec launches ordinary process trees or durable systemd units; one memory sampler accounts their usage and requests cancellation through their existing cleanup owners. flowchart TD
A[Gateway exec] --> B[Process supervisor]
A --> C[Durable systemd units]
B --> D[Shared memory sampler]
C --> D
D --> E[Existing cancellation owners]
E --> F[Cleanup and visible result]
Technical reviewBest possible solution: Use one shared memory-budget owner while preserving existing launch authority, process cleanup, durable recovery, and delegated I/O policy. Do we have a high-confidence way to reproduce the issue? Current-main source establishes the quarter-RAM restriction, and the PR records a real exec regression failing on the original base at 497 MiB observed against a 256 MiB limit. Is this the best way to solve the issue? The shared owner directly addresses idle capacity and multiplied concurrent allowances, removes superseded per-command plumbing, and retains existing cancellation and persistence boundaries. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against fadf3044c0b6. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +331, Tests +453, Docs +12, Other -16. Total +780 across 27 files. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. Review metrics
LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReviewed November 5, 2026, 1:07 AM ET / 06:07 UTC (Revision 3). |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review Please review final head New-head CI is still running. Its scheduled-restart failures were independently reproduced on the earlier failing run’s exact base, with the same test and restart-owner bytes in the current CI merge. Original assertions remain intact; the PR records the failures and replay limits. |
|
🦞👀 Re-review progress:
|
…openclaw#193044) * fix: allow large Linux host builds to use the shared memory allowance Replace per-command quarter-RAM cancellation with shared RAM/swap accounting, host and Gateway reserves, and inherited cgroup bounds. Preserve delegated I/O and add durable hard backstops and recovery notification for memory failures. Retain the 304-line regression allocation and add exactly 85 lines for the pending-write cancellation/authority regressions and required fixture repairs. Focused tests, format, lint, typechecks and build passed on AWS; the final older-kernel Gateway pressure acceptance remains failed and documented. Closes openclaw#191975 * fix: address shared exec memory validation findings * test: isolate host exec PTY memory fixtures * test(exec): preserve mock exports and account for regression coverage
…openclaw#193044) * fix: allow large Linux host builds to use the shared memory allowance Replace per-command quarter-RAM cancellation with shared RAM/swap accounting, host and Gateway reserves, and inherited cgroup bounds. Preserve delegated I/O and add durable hard backstops and recovery notification for memory failures. Retain the 304-line regression allocation and add exactly 85 lines for the pending-write cancellation/authority regressions and required fixture repairs. Focused tests, format, lint, typechecks and build passed on AWS; the final older-kernel Gateway pressure acceptance remains failed and documented. Closes openclaw#191975 * fix: address shared exec memory validation findings * test: isolate host exec PTY memory fixtures * test(exec): preserve mock exports and account for regression coverage
Closes #191975
What Problem This Solves
Large Linux host builds are killed at a per-command quarter-RAM limit despite unused capacity, while concurrent commands each receive a separate allowance.
User Impact
Foreground, PTY, background, and durable host commands can use the unused shared RAM/swap allowance automatically, with reserves for the host and Gateway. No new configuration is required. Existing execution policy, service hierarchy, and I/O isolation remain in effect.
Sampling can overshoot and shared pages can be overcounted. Cache-heavy commands can slow under kernel reclaim; ordinary cache protection requires writable delegation. Separate Gateways retain separate budgets.
Validation status: hosted ClawSweeper reviewed final head
5719663b097b3e8bea393e9e75027ba01164b953with Before merge: None; Findings: None. Both prior blockers are resolved: export-preserving test mocks pass under Node/pinned Bun, and the native latest-stable upgrade passed through the published updater. The omitted red-on-base regression is linked below. Final CI settled with 59 successful / 2 failed / 26 skipped; no jobs remain active. Baseline-ratchets and build-artifacts passed. The failures are the scheduled-restart assertions independently reproduced on the earlier failing run’s exact base, plus the aggregate gate that propagates that lane. Earlier broad-CI failures and proof limits remain recorded below. No merge, release, or deployment is included.Why This Change Was Made
One sampler accounts for combined RAM and swap, includes inherited cgroup limits, and cancels one large contributor through its existing cleanup owner. Ordinary commands remain inside their delegated hierarchy and receive a full-budget soft cache limit. Durable units join sampled accounting and retain individual hard RAM/swap backstops across restart/adoption. Commands are never automatically replayed.
Memory-limit failures remain eligible for notification after durable recovery; only an explicit manual stop suppresses that notification. A crash before persistence can still recover the system manager's observed exit instead of the exact cancellation reason.
The smallest coherent stage is one shared budget across ordinary and durable callers. Superseded per-command memory arguments/watch exports and caller plumbing are removed; existing owners retain cancellation, cleanup, persistence, and I/O sizing. Production grows by 331 lines; tests/support by 453 lines for inherited capacity, aggregate RAM/swap, durable recovery, and distinct lifecycle regressions. No schema, public config, hierarchy relocation, or dependency change.
Evidence
5719663b097b3e8bea393e9e75027ba01164b953: Before merge: None; Findings: None. It accepted the mock-export repair, published-stable upgrade and red-on-base evidence, and the documented CI attribution. The subsequent description update only records terminal CI status; source is unchanged.18a5e2dfcffe3babc98f44f940184139dcf2a82dinto exact base4129e21215e7a6963bf34dc4bf2aad28b1543b95. The new-head CI tests mergefa5ebcc4624c2158cd51e14a9473d85405c2391c, candidate5719663b097b3e8bea393e9e75027ba01164b953into base291428568d404edb7b6c4f63dd1d09e867a6acc8. Its baseline-ratchet gate and build-artifacts passed. The scheduled-restart lane again fails at the same two assertions (nine ordinary / seven bundled requests); both tests and their restart-resume owner are byte-identical across the reproduced base, new base, and new CI merge. The run completed with failure at 06:20:39 UTC: 59 successful / 2 failed / 26 skipped, no active jobs. The second failed job is the aggregate gate, which only propagates this test lane; it executes no product test. Automatic scheduled-main classification is unknown because that main run has no matching job. The independent exact-base reproductions above establish inherited presence separately; this is not a claim that CI passed.5719663b097. Both touched files passed 40 tests under Node and 40 under pinned Bun; scoped lint, formatter parity, agents-root/services typechecks, mock-export and test-line guards passed. No production changes were needed. A fresh independent shared Codex review of those three files returned scoped-clean. The allocation is 367 + 85 = 452, exactly the PR’s own counted test LF growth; inherited slack and the shared scalar remain unchanged.4129e21215e7a6963bf34dc4bf2aad28b1543b95, with an independent frozen install/build and original assertions/deadlines. Both full-file Bun invocations failed at their finalmodelRequestsassertions (ordinary line 226, bundled line 351), receiving eight/v1/responsescalls each. Logs identify startup restart-resume and source=restart. This proves inherited presence, not a repair or a provider-payload claim. The files remained unchanged. Limit: files were replayed serially, not with CI’s concurrent-file load. New-head CI again reports those assertions; original and final CI counts vary, so attribution is to the unexpected-call behavior and owner path, not an identical request count.cbx_c8774d269865(Ubuntu 24.04, Node 24.22.1). The full package/declaration build and tarball integrity passed at exact production heada12314606f5e93cb0ec34510155d8cfcfada9d73; all tracked source manifests stayed identical. The repository’s native systemd upgrade-survivor installed published2026.10.10(commit7dc3350cb9f08fcf9a0af5c4845a20d5b2f1a8be), then used its installed updater to install the candidate without a harness restart. Updater status, authenticated RPC, health/readiness, exact serving build, retained state and execution approvals passed; MainPID changed from 16382 to 21916, then cleanup verified PID 0/inactive and disabled linger. Limit: stable has no legacy exec throttle or durable registry to migrate. Its preserved unit lacks newer delegation settings and reports the existing delegation/host-stop-timeout recommendations; it runs with sampled protection. Earlier base-to-candidate native proofs separately cover writable legacy-throttle removal and durable adoption. The later repair changes tests/allocation only, with identical production bytes.2dbd7f79bbf1fc49b38049429cb9e55b5437f0befor the intended reason: the real exec returns failed with watchdog diagnostic 497 MiB observed / 256 MiB limit and baseline exit 1. The candidate passes the same real regression (2,135 ms). This proof was previously run but omitted from the PR evidence.cbx_af642c4488d7: Ubuntu 24.04, actual6.8.0-1067-aws, four CPUs, and a 20 GiB service RAM / 6 GiB swap envelope. A real model generated one approved foregroundpnpm buildwith ordinary defaults in an independent cold checkout. Its original exec owner returned exit 0 in 380.5 seconds. Build-tree RSS reached 7.28 GiB, including one compiler at 6.27 GiB, above the former 5 GiB cutoff and within the 13.66 GiB shared allowance. No command was replayed.a12314606f5e93cb0ec34510155d8cfcfada9d73, with all 63,492 tracked source hashes identical before/after. All 26,293 prepared runtime-dist entries remained unchanged; the cold build produced 26,684 independent dist entries including the runtime entry. An independent receipt audit confirmed these outcomes. Limits: no swap, parallel JavaScript build workers, or native reclaim stack was observed. This run does not qualify parallel-worker contention, natural reclaim, performance parity, or an iOS compiler. The observer used 18.9 MiB peak RSS and 103.3 CPU-seconds over 393.2 seconds on four CPUs (about 6.6% of total CPU capacity); these are measurement overhead, not product sampler cost. Maximum polling gap was 139.5 ms.a12314606f5e93cb0ec34510155d8cfcfada9d73and base2dbd7f79bbf1fc49b38049429cb9e55b5437f0be, with distinct trusted harness4129e21215e7a6963bf34dc4bf2aad28b1543b95. Build-artifacts, types/lint, repaired agents-core-tools, and dependencies passed. The run completed with failure: 234 passed, 17 failed, 1 cancelled, 11 skipped, with no active jobs. The 17 failures comprise the 16 inspected lanes and the final aggregate gate, whose log only propagates selected-lane failures. iOS tests passed. Private-QA shard 17 exceeded its two-hour job limit; its Node half passed 873 tests and its Bun half was still passing cases 3.5 seconds before cancellation. Incomplete Bun coverage and the cause of the long total runtime remain unresolved. All current failed job logs were inspected. No CI redispatch or rerun was used to chase green.cbx_0b1182459499(Ubuntu 24.04, four observed CPUs, about 32 GiB RAM, Node 24.22.1, pinned Bun). Independent exact-base/candidate frozen installs and original assertions/deadlines were used. All 10 candidate invocations passed. Exact base passed nine and reproduced the CI extra CLI launch after credential revocation (9 vs 8 atserver.chat-cli-auth.test.ts:364). The preceding 502/ok:false assertion passed; the later provider-request-count assertion did not execute, so unauthorized provider access is unproved. This establishes inherited presence, not a candidate repair. Gateway creation, hooks (Node/Bun), approval forwarding, reload continuations, CLI resume, native runtime selection, auth timers, and isolated completion passed their paired replays. No candidate-only defect was demonstrated, and no source or test assertion was changed. Limit: these replays do not reproduce full-shard predecessor/concurrency state; the original failures remain unresolved where not independently attributed. The 36,178-byte evidence archive matched the guest SHA256d0be2c652186915f096f3b36a55d7da0d7e5c83a9aea372d13a86b25a8195d8c; all 20 command source-cleanliness checks passed.Preserved failures, source bindings, and remaining limits
Earlier broad-CI failure attribution (source identity alone is not runtime inheritance):
The attribution setup first failed before tests because the copied Git seed lacked a base blob. Preserved failure evidence was followed by supported exact-SHA fetches into empty independent repositories and frozen installs; source and assertions were unchanged. No product verdict is assigned to that setup failure.
The first real-build prelaunch attempt failed because the harness required explicit optional
background:false;awaitResults:truealready disables backgrounding. Zero approvals were released, all native workload PID counts stayed zero, and build dist remained empty. The failed results, Gateway state and manifest were preserved. Only that documented-default comparison was corrected before fresh isolated state continued the unexecuted workload. Explicit true/null and all other differing/unknown arguments still fail. Source, resources, deadlines and ordinary build concurrency stayed fixed. The actual build ran once.Earlier over-budget pressure attempts remain failed evidence. The earlier Gateway pressure attempt did not reach abort or full readback; it is not relabeled by the later successes. The direct native proof qualified discrete exact reclaim witnesses during a long nonblocking write and verified all original payload; it does not establish continuous reclaim or public Gateway behavior during it. An original native qualification missed full-readback bounds and remains failed. The storage comparison stopped at a baseline OOM after four candidate successes, so it does not establish performance parity. Earlier paired older-kernel work did not overlap reclaim and flagged latency changes.
Current head has 27 changed files. Earlier fitting evidence binds
a4889ffthrough source manifest SHA256596d005019baa631725e261d9095bcd19820a47bb03cc0528b63a0ceb1937780; production bytes are unchanged by the final test-routing commit. The exact-head real-build harness manifest is71371a8b4654bb0539a4b51f16abb9415041e0e46468b9eb70009a87adf74f3d; the failed prelaunch manifest/evidence remain separate. Export hashes for all 107 final evidence files were verified.Separate test-line records grant exactly 367 shared-owner lines plus 85 pending-write lines: 452 total, matching this PR’s net counted test LF growth including the two export-preserving mock lines. The shared scalar is unchanged; inherited ceiling slack is preserved rather than absorbing unrelated debt.
The native latest-stable upgrade passed as described above. No iOS/macOS compiler, latency-parity, saturated-I/O-throughput, or zero-regression claim. No release, deployment, or production-service change.