Repository navigation
fix(test): respect process memory limits in local scheduling - #146298
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. |
|
Codex review: needs maintainer review before merge. Reviewed September 13, 2026, 7:56 AM ET / 11:56 UTC (Revision 4). ClawSweeper reviewWhat this changesLocal test scheduling incorporates process memory limits and available headroom, shares those readings with resource reporting, and adds regression coverage. Merge readiness✅ Ready for maintainer review This remains a useful, bounded fix absent from current main and the latest release. No actionable correctness or security findings remain, and the supplied process-limit evidence supports the change. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw’s local test scheduler converts CPU, load, memory readings, and explicit overrides into worker and shard limits. Vitest configuration and the full-suite runner consume those limits, while the resource reporter reads live telemetry. flowchart TD
A[Host and process memory] --> C[Shared scheduling snapshot]
B[CPU and system load] --> C
C --> D[Worker budget decision]
E[Explicit worker overrides] --> D
D --> F[Vitest workers and suite shards]
A --> G[Live resource report]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceTests +140, Other +28. Total +168 across 3 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep memory-aware admission in the existing scheduler while preserving explicit overrides, stable per-process sizing, and live telemetry. Do we have a high-confidence way to reproduce the issue? Yes: current main ignores process memory limits, and the supplied constrained-Linux baseline/candidate trace demonstrates the resulting admission difference. This read-only review did not execute tests. Is this the best way to solve the issue? Yes: extending the existing scheduler avoids a competing budget owner and preserves caller, override, and reporting contracts. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 59773963d180. LabelsLabel 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 |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Merged via squash.
|
* commit '4aff70f27016f9acf62d0acc19c8bd3592993e4c': (1537 commits) test: align plugin fixtures with current runtime contracts (#147000) refactor(browser): separate session tab tracking from cleanup (#146973) fix(tests): make systemd clock fixtures private (#146990) fix(linux): retire sleep guards when logind disconnects (#146046) refactor(matrix): share draft fallback delivery (#144840) fix(sessions): preserve cross-agent replies after reload (#146799) test(models): cover quota recovery during catalog discovery (#146708) fix(macos): recover browser sign-in when no browser opens (#146787) fix(process): prevent one-shot agents exiting while polling (#144268) fix(status): label the session inventory as stored (#146979) fix: avoid repeated background reads while loading chat (#146953) refactor(ui): narrow Skill Workshop proposal context (#146977) perf(sessions): keep cleanup responsive and reuse workers (#140897) fix(sessions): prevent stranded writers after abort and restart (#146792) refactor: reuse deferred owners in Gateway and infra fixtures (#146809) fix: prevent queued conversation replies from switching storage (#146984) test(ui): preserve nested failure summaries in CI logs (#146864) fix(test): respect process memory limits in local scheduling (#146298) fix: validate large media data URLs without regexp stack exhaustion (#146972) fix(ui): label model usage contributions as messages (#146735) ...
* commit '4aff70f27016f9acf62d0acc19c8bd3592993e4c': (30 commits) test: align plugin fixtures with current runtime contracts (#147000) refactor(browser): separate session tab tracking from cleanup (#146973) fix(tests): make systemd clock fixtures private (#146990) fix(linux): retire sleep guards when logind disconnects (#146046) refactor(matrix): share draft fallback delivery (#144840) fix(sessions): preserve cross-agent replies after reload (#146799) test(models): cover quota recovery during catalog discovery (#146708) fix(macos): recover browser sign-in when no browser opens (#146787) fix(process): prevent one-shot agents exiting while polling (#144268) fix(status): label the session inventory as stored (#146979) fix: avoid repeated background reads while loading chat (#146953) refactor(ui): narrow Skill Workshop proposal context (#146977) perf(sessions): keep cleanup responsive and reuse workers (#140897) fix(sessions): prevent stranded writers after abort and restart (#146792) refactor: reuse deferred owners in Gateway and infra fixtures (#146809) fix: prevent queued conversation replies from switching storage (#146984) test(ui): preserve nested failure summaries in CI logs (#146864) fix(test): respect process memory limits in local scheduling (#146298) fix: validate large media data URLs without regexp stack exhaustion (#146972) fix(ui): label model usage contributions as messages (#146735) ...
What Problem This Solves
Resolves a problem where developers running local test suites inside a memory-constrained process could get more concurrent test shards than the process's memory budget warrants. Physical host RAM alone can overstate the memory available to that process.
Why This Change Was Made
Include native process memory constraints and available headroom in the existing scheduling snapshot and worker inference. Keep the tighter valid memory bound, distinguish unknown constraints from exhausted headroom, and prevent the moderate-load adjustment from raising a memory-limited worker count.
The resource reporter calls live
detectVitestHostInfo()instead of duplicating the native memory reads; only the scheduler caches its scheduling snapshot. Explicit worker overrides, throttle opt-out semantics, the shared cross-module snapshot, raw telemetry fields, CI scheduling policy, and one Vitest worker per full-suite shard remain unchanged.User Impact
Automatic local test scheduling respects the memory reported as available to its process. Application runtime behavior is unchanged. This is an admission-control fix, not a measured CPU/RSS improvement or a guarantee against every OOM.
Evidence
Remote proof used Node 24.19.0 on Linux x64, with baseline and candidate in separate processes and the same new regression tests:
The tests cover exhausted and unknown readings, independent valid bounds, moderate load, explicit overrides, and stable scheduling across two separately loaded copies of the same module.
The Testbox Actions run records the lease lifecycle. Application stdout/stderr was retained client-side; the reviewer's inability to retrieve job logs is an evidence-access limitation, not an additional test failure. The complete retained captures were independently inspected.
Selected-field projections from those captures follow. Command/path fields are omitted, test-count lines have ANSI formatting removed, and no timings are presented as performance evidence:
Complete-capture SHA-256:
fa056cc232d96754f1003d0ed6befc115163d3bef3e8081756efd7ace1b56d0cc5d0311ebbac9342b780026b3a32b2bc4efc902ac34c17ef01cfe52daf820addThe proof used source base
12c55d1650c07d07046c3a08462f5fd0960c6e67and candidate capsule treee4f7dc53f457c3ba001f2427bc16d1d23bc92ed2.The subsequent change only collapses one test-data tuple's whitespace; production bytes are unchanged.
Fresh independent P2 review completed. Its single unknown-host-total finding was rejected after source inspection: the existing lowest-memory-tier fallback remains conservative, rather than increasing admission. The PR's ClawSweeper review found no actionable correctness or security issue; its log-access limitation is addressed by the retained evidence above.
Hosted CI: the native watcher completed with
GREENand zero pending checks for exact head326681be20acdb8800e7be42dce815870e20ca59in CI run 34711427239.Landed: squash-merged on September 13, 2026 at 11:58:56 UTC as 533698353132. Native review, prepare, and merge completed successfully, with the exact head and landed source verified. The initial remote changed-check invocation stopped at test-file formatting and is not relabeled as a passing invocation. No additional full suite, stress/OOM test, or performance benchmark was run by this task.