Repository navigation
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 Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex review: passed. What this changesThis PR reuses the mapped Linux cgroup view until process membership changes while continuing to read live memory counters and limits. Example: Repeated optional-work checks on the reported Linux ARM64 delegated-cgroup fixture.
Review scores
ProductKind: Performance · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this PR provides a focused, measured reduction in repeated Linux memory-check work. No actionable correctness or security defects were found, and the exact-head CI gate passed. Reviewed head: Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherThe host-memory owner translates process membership, mount visibility, and live kernel memory readings into the pressure decision consumed by Gateway startup and background schedulers. flowchart TD
A[Process membership] --> B[Mapped cgroup view]
C[Mount information] --> B
B --> D[Live memory readings]
E[Host and process limits] --> F[Memory pressure decision]
D --> F
F --> G[Optional Gateway work]
Technical reviewBest possible solution: Keep discovery reuse in the existing host-memory owner, invalidate it on membership changes, and retain live policy and counter reads. Do we have a high-confidence way to reproduce the issue? Current-main source repeats mount discovery for each Linux Node pressure check, corroborated by the supplied real-Linux measurements; this read-only review executed no target code. Is this the best way to solve the issue? The small owner-local change removes repeated discovery without introducing a parallel reader, and its explicit mount-lifetime assumption explains the intended reduction in freshness. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 7f65b8d78ada. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +8, Tests +33, Other +100. Total +141 across 3 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. LabelsLabel changes:
Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
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 Reviewed November 27, 2026, 9:55 AM ET / 14:55 UTC. |
|
Merged via squash.
|
* fix(runtime): defer optional work under host memory pressure * style(infra): format memory pressure admission * style(gateway): format the deferred prewarm check (cherry picked from commit 9f50802) Companion audit: #207993 selected later for publication fixture isolation. #206779 required if the new Cron host-memory fixture spoofs platform: preserve native SQLite namespace. #206041/#206230/#206308/#206746 are separate cgroup detection and optimization changes; #206322 is service-aware cron run budget, #206483 forks chat and #206384 changes a main-only warmer. Release adaptation: Extend the stable optional-memory owner and its existing callers only. Preserve cgroup/Bun/macOS behavior and upstream threshold cases; omit main-only prompt warmer, cgroup diagnosis, and Cron platform-spoof changes. Co-authored-by: RomneyDa <[email protected]>
* fix: pause optional Gateway work under parent memory pressure * fix: resolve visible cgroup controllers from their mounted subtree * fix: retain visible memory limits above covered controllers * fix: honor controller masks on the visible mount only * fix: keep existing cgroup budget readers independent of admission * refactor: name parsed cgroup mount fields (cherry picked from commit 589a70a) Release adaptation: take the pressure-owner slices of #206230 (verified mount mapping), #206308 (delegated leaf), and #206746 (mount discovery reused per membership). Do not import resource sizing, diagnostics or #206322 cron scheduling APIs; none are needed by stable optional callers. Co-authored-by: RomneyDa <[email protected]>
What Problem This Solves
On Linux, each check for whether the Gateway should pause optional work reads and parses the process’s mount table, then resolves the same cgroup paths again. Startup prewarm can make several checks per item and more from the load callbacks, adding synchronous reads and allocation on the Gateway thread.
User Impact
Startup and idle work spend less CPU and allocate less memory checking for headroom. The Gateway still reacts to fresh leaf and ancestor charges, controller ceilings, process limits and host free memory. Existing installations need no configuration change.
Why This Change Was Made
Host memory owns one mapped view for the current process placement. Normal checks reuse the visible mount, file masks and ancestor paths. The process can move within a delegated subtree via
cgroup.procs, so a change in membership captures the new view. For a fixed membership the mount layout is assumed stable for the process lifetime. The periodic worker-pressure and cron capacity readers keep their live lookup policy. Linux cgroup delegationThis builds on Vincent Koc’s delegated sizing and hidden-submount work and his follow-up correction for delegated pressure. The quiet-path change adds eight runtime lines for the single slot and its membership transition. Regression tests add 33 net lines, with 100 lines of measurement tooling. #206230 · #206308
Evidence
Team, on
6312d8beat 06:22 PST on November 27 with about 120 RPC/min, sampled 179.7 MB in 30 s. The startup pressure call site’s two synchronous file-read stacks and path joins accounted for about 4.49 MB (2.5%). The combined profile entries include counter reads as well as discovery.Real Linux arm64 cgroup v2, Node 26.12.1, delegated mount with a 2 GiB parent, 1.5 GiB leaf and a lower file mask hidden by a nonrecursive bind. The test mountinfo was 60 lines / 7,142 bytes, close to Team’s 60 lines / ~7.8 KB. Five interleaved A/A and A/B pairs per capture, with 10,000 calls and 2,000 warmup checks per sample. The owner takes no database or workspace input. Measurements cover the predicate itself.
Every timed check returned the same decision. The remaining JS reads include the membership probe and live policy/counter reads. Node’s native host memory reads occur in both arms. A separate kernel check admitted at 36.6 MB of leaf charge, deferred at 162.9 MB under a 180.0 MB cap, then admitted after a live move to an idle sibling. Both versions returned the same results. Replay with
node scripts/perf/host-memory-pressure-measure.mjs <base host-memory.ts> <head host-memory.ts>in a disposable delegated mount, with normal module resolution for those files.The regression failed on the original owner with two mountinfo reads where one was expected. Host memory, Gateway resource profile and worker memory budget passed 77 tests (34.03 s in the local wrapper). The 33 host-memory tests executed in approximately 1.2 s. Existing tests cover hidden submounts, restricted procfs, live limits, ancestor pressure and delegated moves.
Two additional macOS cron cases failed with the same SQLite offline-maintenance error on this branch and clean main. The fixture globally mocks Linux while a real database worker runs on macOS. An exact-main diagnostic scoping the mock to the memory probe passed both cases. Fixture change in #200180
Codex autoreview found zero actionable P0–P2 findings.
pnpm check:changedpassed.