Repository navigation
Conversation
Share the existing controller and hierarchy owner between tooling budgets and runtime pressure. Preserve anonymous, active-file, kernel, and child usage while keeping warm SQLite workers from retiring on inactive file-cache charges.
|
🦞👀 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: needs maintainer review before merge. What this changesThis PR shares the existing cgroup memory reader with runtime diagnostics to exclude inactive file-cache pages from pressure estimates. Example: A Linux cgroup has a 1,000-byte limit, 950 bytes charged, and 850 bytes of inactive file cache.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Regression provenanceRegression provenance — verified: source commit Merge readiness✅ Ready for maintainer review Keep this useful maintainer-authored PR open: the earlier fixture finding is resolved, and no new actionable code defect was found. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherGateway diagnostics turn process and cgroup measurements into pressure events consumed by existing worker-retirement owners; build and lint tooling share the same hierarchy reader. flowchart TD
A[Linux memory counters] --> B[Shared cgroup reader]
B --> C[Gateway pressure sampler]
B --> D[Tooling memory budgets]
C --> E[Critical pressure channel]
E --> F[Idle worker retirement]
Technical reviewBest possible solution: Keep the shared-reader refinement and existing retirement policy, and land only after the declared acceptance gate is satisfied. Do we have a high-confidence way to reproduce the issue? Current-main source establishes raw cgroup charges reaching critical retirement, supported by the reported constrained baseline and exact-parent failing regression; this review executed no target code. Is this the best way to solve the issue? The patch fixes classification at its producer, preserves heap/RSS protection and unknown-evidence fallback, and migrates existing consumers without adding a competing parser or policy owner. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 8830ff6d8ed6. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +19, Tests +98, Docs +2, Config 0, Other +9. Total +128 across 25 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 HistoryReview history (1 earlier review cycle)
Reviewed November 11, 2026, 3:59 AM ET / 08:59 UTC (Revision 2). |
|
Addressing item 1 from the review, fixed in
The copied-fixture regression was red before repair with the missing-module error. After repair, all 14 originally failing native declaration cases and the one changed-lint case pass. The pilot proved The runtime performance gate remains unresolved, and this response does not request a merge. The earlier constrained baseline demonstrates the mechanism (22 SQLite-worker births and 31,747 compile-cache reads in 60.519 seconds), but a sustained warm baseline/candidate comparison is not qualified. A normal read-only pass fills the local 24 GiB cgroup with inactive file cache; OrbStack proactively reclaims it before the Gateway's 60-second warmup ends. The attempted warm count arm therefore saw only 6.5–9.6% raw usage and zero pressure events. It is a missing-trigger setup result, not acceptance evidence. The dedicated idle trace correlates cache loss with the kernel proactive-steal counters; database metadata is unchanged and OOM counts are zero. The unchanged disk-space guard then stopped the task container when internal free space fell to 4.73 GB, exceeding its original 2 GiB loss threshold. The subsequent helper lookup saw no task cgroup because that container was already stopped; this is a setup failure, not a protection or namespace verdict. The proposed leaf-reservation alternative was not applied. No host setting, pressure guard, or production data was changed. The added refinement owner was measured separately under the finite 24 GiB limit, with two 100-call controls after 20 warmups: p50 0.0517/0.0470 ms, p95 0.0677/0.0703 ms, CPU 9.80/9.47 ms per 100 calls; separate counters report seven file reads per sample. This is added owner cost, not a complete sampler or Gateway speedup claim. The final six pressure cases preserve critical retirement for anonymous children, active files, kernel charges, missing statistics, and unmapped hierarchy while rejecting the inactive-file false positive. The ancestor regression compares each usage with its own ceiling. All 69 focused runtime cases pass, including existing worker lifetime tests; the inactive-file case fails on the exact parent. Final-head CI run Disposition: item 1's copied-fixture defect is fixed, but the declared constrained Gateway A/A and five-pair count/CPU/allocation/tail acceptance remains incomplete. Please retain that explicit performance-proof hold. No merge or auto-merge intent has been submitted. @clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Parking this change as a closed draft per the maintainer decision; no further sustained-cache qualification campaign is planned. The worker-retirement mechanism and focused regression are established, and the final-head review has no open code findings. Existing evidence still lacks a qualified after-fix Gateway count/CPU/allocation/tail comparison, so this is not being merged on a performance claim. Report: measured root cause, owner cost, safety proof, exact-parent CI attribution, and the qualification gap. The full measurements and provenance are also preserved in this PR body. Final retained head: |
What Problem This Solves
A large SQLite workload can fill its Linux cgroup with inactive file-cache pages while Gateway RSS remains small. The diagnostic sampler treats that raw charge as critical process pressure and repeatedly retires otherwise warm SQLite workers. The next operation starts a new worker and reloads its module graph and Node compile cache.
User Impact
Keep warm workers when inactive file pages explain the apparent memory shortage. Anonymous memory, active file pages, kernel charges, and child-process usage still count. Unknown hierarchy or usage evidence keeps the existing raw-pressure fallback; process RSS and heap thresholds remain unchanged.
Why This Change Was Made
Reuse the existing cgroup memory owner for both runtime pressure and tooling budgets. It already maps controller mounts, ancestor limits, v1 hierarchy rules, and inactive-file usage. Move that owner from scripts/lib to src/process, migrate every internal consumer and copied CI fixture, and expose the highest working-set-to-limit ratio using each controller's own ceiling. Only refine raw pressure once it reaches the existing 80% threshold. No new cache, configuration, schema, worker pool, or retirement policy.
The observed loop was introduced by #191272 (
c3b3d56c37c9): critical samples publish on every sampling interval, and the shared-state owner retires idle workers on that channel. This change fixes the pressure classification, preserving that owner boundary.Evidence
The synthetic Linux/btrfs fixture has a 35.227 GiB agent database after legitimate backfill and integrity verification, 10,800 sessions, 212,888 transcript rows, and 62,000 workspace payload files. No production data is copied. In a baseline constrained arm, 117 acknowledged writes over 60.519 seconds produced 22 SQLite worker starts and 31,747 native compile-cache reads. Of these, 31,130 reads are 1,415 module URLs each loaded 22 times. Gateway RSS was about 1.45–1.59 GiB. A later constrained sample recorded 51.54 GB charged, 49.18 GB inactive file pages, 2.27 GB anonymous memory, and zero OOM/OOM-kill events. This demonstrates the local mechanism, not production causality.
Acceptance rule for the candidate: use the same qualified completed-backfill fixture and constrained Linux cgroup, real voicewake.set RPCs at 2/s with reply and final-state verification, two baseline A/A controls, and at least five serial interleaved baseline/candidate pairs. Count worker births by script and native compile-cache reads separately from unprofiled timing and separate sampled-allocation passes. Repeated pressure-driven worker starts and graph rereads must disappear while preserving the tested non-file critical-retirement contract. Report owner read cost, total/main CPU, sampled allocation, RPC p50/p95, and spread; a material adverse metric remains a landing stop. The qualified candidate macro comparison is not complete; the environment qualification failure below is a landing blocker, not a passing result.
The inactive-file regression fails on the exact parent: it publishes one critical-retirement event instead of zero. All 69 candidate runtime cases pass, including anonymous children, active-file and kernel pressure, missing statistics, an unmapped hierarchy, and existing shared-state worker lifetime behavior. A separate ancestor test protects comparing each usage with its own limit. The existing v1 and mount-mapping tests pass.
Affected tooling and workflow checks exposed two fixture cutover mistakes, repaired before publication: the artifact-copy fixture omitted the moved owner, and its added source directory invalidated a hardcoded stripe-selection assumption. Their failed cases now pass. Types, targeted lint, workflow validation, formatting, and two independent local Codex reviews are clean at P0–P2. Both macOS and Linux canonical runtime builds pass. The full changed-file check exposed a test callback typing defect, fixed and independently reviewed; its affected typecheck, targeted lint, and formatting pass. The remaining failures are the exact-parent dead-export signature and 19 unrelated max-lines errors. A canonical replay on the 19 unchanged parent paths reproduces identical counts. Importer changes intentionally select the broader lint policy; no limits or suppressions were relaxed.
Code size: 604 existing owner lines are relocated, not duplicated. Runtime files grow 623 lines while tooling shrinks 598, for a combined production/tooling delta of +25 lines (19 policy/adapter lines and six import-wrap lines). Tests and test support grow 98 lines (97 counted by the test-line ratchet), and docs two lines. This growth avoids a second cgroup resolver and keeps both consumers on the existing hierarchy contract. Inactive-file credit is a working-set estimate, not a guarantee that every page is immediately reclaimable.
Inherited main lint failures and introducing changes
These remain unresolved main regressions. Eight causal proofs reuse prior lane evidence; eleven newly exposed crossings were verified with the real max-lines rule on the actual introducing parent and commit. The exact main parent
95c2a0db619e9reproduces all 19 current path/count pairs.packages/gateway-protocol/src/schema/plugins.ts071ea8338d93e55c9a55e0504ac0ea95257dad23/ #193694src/agents/cli-runner/execute-tool-tracking.ts5310c71fb32e5871089a174c71d3c0f4c0c7bf91/ #194154src/agents/plugin-model-catalog.tsf9478d593c96c955db06923f4aa6367fb2825b61/ #191148src/auto-reply/reply/session-event-handoff.ts62e0b2b7fcf5fe3e2231f3d2418cd3e0e4d3c29d/ #184243src/cli/daemon-cli/lifecycle.ts9e14c1e5744069995c9c19cba15bb6d93f31428c/ #191552src/cli/update-cli/update-command-post-update.tsed79334f5b7252f90efe2e0124d45449995df6a9/ #189647src/cli/update-cli/update-command-service-maintenance.ts32aab96a87c2819fbff8a149a0514fd7198789e4/ #193760src/config/sessions/transcript.test.tsf6a936bd6d0674f258d767369e416430111f1aa6/ #156657src/gateway/server-http-request.tsd85ebfe8daad438c8141b9efada73d5c05e174a3/ #191513src/gateway/tools-invoke-shared.ts59b8a114bf6dede71999976ddc87fd3edf382c85/ #192345src/infra/package-update-steps.ts0542dd84ffc5dd2c495fe5f5748f4f57301607e0/ #194659src/plugins/registry-runtime.tsdef63496ca8f7af960b187138b1ef4084e71f23a/ #190950src/secrets/egress-proxy/proxy-server.test.ts99b8d70706649b286fe25a26f450dff6c5f3ce17/ #153661src/state/openclaw-state-db-readonly.ts9f5e817557791c720626bbe7e6e7671c22a93925/ #194042ui/src/app/app-shell-gateway.ts68647dbe133c716d384a5abae83e4c3246f02367/ #195730ui/src/components/board/board-widget-frame.tsxee774cfb21d4de9b8742a11861fbde868ed5f8d3/ #193029ui/src/e2e/settings-layout.e2e.test.tseb0f58e907f793cc11d032e91c22979ae0bdc321/ #191320ui/src/pages/activity/activity-page.test.tsc7d92911be3513aacbaa95531a165a9cf9f18290/ #174059ui/src/pages/sessions/sessions-page.test.ts0c5327886c4b08ec29d5acfe442c5c9d8b70b763/ #189256CI run
42964368645at224bc94exposed three branch defects in test setup: the line-allocation record overstated prior counted growth by one, and two copied tooling fixtures omitted the relocated memory owner. Commit66b150c9d994supplies the owner and its dependency while excluding it from the fixtures’ synthetic compiler roots. Both failures reproduce before repair; all 14 native preparer cases and the changed-lint case now pass, along with targeted types, lint, formatting, and the correct 97-line allocation. Fresh local Codex review of the repair is scoped-clean at P0–P2. Runtime sources and the +25 production/tooling LOC delta are unchanged.The remaining browser failure reproduces identically on the exact CI main parent:
activity-denial-refresh.real-gateway.e2e.test.ts:137times out waiting for denial feedback. CI tested merge25c92bf9670eagainst main36aa3b591d54, which includes this test from #196939; it does not exist on the original branch parent. The selected bundled case on that exact parent fails at the same line and selector after the same 30-second wait, with Node 24.22.1 and matching CI flags (Linux arm64 locally versus x64 hosted). The complete command exits 1 in 119.23 seconds without unhandled errors; all test/browser/Gateway children drained. This is a newly exposed main test regression introduced bye51bb0455e9d(#196939): it expects a blanket person-timeline denial that4005ca2f0faa(#196446) had already removed. The fixture creates a sessionless profile; the current readable-row contract returns an empty success. All five recordedsessions.listreplies succeed and the alert correctly stays absent. The seven determining test/owner blobs are identical at the introducing commit, CI main parent, and tested merge. No unrelated production change or weakened expectation is included here. Final-head CI and the controlled Linux performance comparisons remain landing requirements.Final-head run
42967882653at66b150c9d994completed with only two nonaggregate failures. The browser failure above persists unchanged on CI parentf97c6668a9fb. The other is the private UI server inventory: #196949 (0d0ab362b225) addedchat-files-refresh.e2e.test.tswith a private source server without registering it in the existing private/serial lists. The single guard reproduces on exact parentf97c6668a9fbin 11.04 seconds: 84 discovered versus 83 declared, with that sole extra path. All 66,605 parent blobs and its reconstructed Git tree were verified; the initial missing-Git-index setup failure is excluded. This is another newly exposed main regression, not ignored CI noise. The three original branch-caused fixture/allocation failures are green on the final head. CI remains failed, not green; landing still requires the measured performance result and final-head ClawSweeper clearance.Constrained warm-fixture qualification: blocked
The completed-backfill fixture contains a 37,825,224,704-byte agent database, 10,800 sessions, 212,888 transcript rows, and 62,008 workspace files totaling 1,142,784,496 bytes (62,000 payload files). All 32,400 usage-cache values and transcript payloads are preserved, and real startup integrity verification established the canonical clean-close seal. No production data or synthetic cache rows were injected.
A normal read-only pass over the closed database fills the task container's 24 GiB cgroup almost entirely with inactive file cache. However, the local OrbStack host proactively reclaims that charge before the Gateway finishes its 60-second warmup. A dedicated one-pass-plus-idle trace shows the cgroup losing 13.86 GB of inactive cache while the kernel's proactive-steal counter rises by 13.94 GB, followed by another 11.89 GB loss and 12.79 GB of proactive stealing. Database inode, size, and mtime are unchanged; no OOM events occur. The attempted warm count arm saw only 6.5–9.6% raw usage and no pressure event, so it does not test this fix and is excluded from acceptance. No candidate worker-start, CPU, allocation, or tail-latency benefit is claimed from it.
The added cgroup-refinement owner itself was measured under a finite 24 GiB limit: two identical 100-call controls after 20 warmups gave p50 0.0517/0.0470 ms, p95 0.0677/0.0703 ms, and CPU 9.80/9.47 ms per 100 calls. Separate counting records exactly seven file reads per sample. These are the added refinement's costs, not a complete sampler before/after comparison and not the missing Gateway acceptance proof. The source/runtime regression and 69-case safety suite pass, but neither substitutes for the declared real-flow performance gate.
The final CI merge object was also verified directly:
fe4e46dca8843c72b7e630dd76b59c50a6ae6978, tree105dc75a7ea37354b22ea1592d71a844666fe419, with ordered parentsf97c6668a9fba413c7abb580972a74ab813c32f8and66b150c9d99457d4faf4f4c922c86c340c875bb4. On that literal main parent, the Activity case fails in 98.07 seconds and the private-server inventory fails in 11.04 seconds. Their introducing changes remain #196939 and #196949. These are failed CI with qualified inherited attribution, not green checks.No merge or auto-merge intent has been submitted. The source fix remains under a performance-proof hold.
A supported container-only memory reservation was considered but not applied. The unchanged disk-space guard stopped the task container at 08:46:51Z when internal free space fell to 4.73 GB, exceeding its original 2 GiB loss threshold. The read-only helper could not find the task cgroup because that container was already stopped; this is a setup failure, not evidence about namespace visibility or ancestor protection. No host/global setting was changed, guard reset, or additional pressure-fill retry run. Local pressure qualification is stopped; source and synthetic fixture are retained for recovery.