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. |
Node and Gateway host stats read os.freemem(), which on Darwin counts only free pages and ignores inactive and purgeable file cache. The Control UI memory meter therefore sat at or near 100% on idle Macs and rendered as a danger-level shortage. Read process.availableMemory(), which counts reclaimable pages, through one shared host-memory helper for both producers, and keep os.freemem() as the fallback where the runtime reports no available-memory figure. Wire fields and meter thresholds are unchanged. Closes openclaw#144176
ce549db to
12c0b82
Compare
|
Codex review: needs real behavior proof before merge. Reviewed September 10, 2026, 2:55 PM ET / 18:55 UTC. ClawSweeper reviewWhat this changesThe PR shares an available-memory reader between Gateway and node statistics, updates regression tests, and documents reclaimable memory in the existing wire field. Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readiness⛔ Blocked before merge - 5 items remain The macOS correction remains necessary, but applying the new reader on Linux introduces misleading container memory readings. Real after-fix macOS proof is also still needed. Priority: P2 Review scores
Verification
How this fits togetherGateway and node hosts publish resource statistics that feed the Control UI’s device memory meters. Those meters calculate usage by subtracting reported free memory from total host memory. flowchart TD
A[Operating system memory] --> B[Shared memory reader]
B --> C[Gateway system information]
B --> D[Node resource snapshots]
C --> E[Device memory calculation]
D --> E
E --> F[Usage meter and warning color]
Before merge
Findings
Agent review detailsSecurityNone. PR surfaceSource +13, Tests +8, Docs +2. Total +23 across 6 files. View PR surface stats
Review metricsNone. Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep one shared Darwin-aware reader that preserves other platforms’ host-memory semantics, existing wire fields, and meter thresholds. Do we have a high-confidence way to reproduce the issue? Yes, through source: Darwin free-page accounting explains the original warning, and Linux cgroup accounting establishes the introduced mismatch. No runtime reproduction was executed during this read-only review. Is this the best way to solve the issue? No, the shared producer repair is appropriate but the API substitution must be Darwin-specific to preserve consistent host-level measurements elsewhere. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against a4ad6f3137d0. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Closing this one: the user-visible proof for this change is a before/after Devices page capture on macOS, and I cannot produce that on my Linux host. The unit-level evidence in the description is not enough for a Control UI change. The branch stays available at ylcn91:fix/issue-144176 if someone with a Mac wants to pick it up with the missing capture. |
Closes #144176
What Problem This Solves
Fixes an issue where the memory meter in Control UI → Devices, on both paired node rows and the Gateway row, showed close to 100% used and rendered red on any macOS host, even when the machine was idle.
Why This Change Was Made
Both host-stat producers read
os.freemem(), which on Darwin counts only free pages and ignores inactive and purgeable file cache, sototal - freealways lands near the total. Node'sprocess.availableMemory(), available on the supported Node 24 and 26 baselines, counts reclaimable pages as well. OnereadHostFreeMemoryBytes()helper insrc/infra/host-memory.tsnow serves the node-host sampler and the Gatewaysystem.infohandler, and falls back toos.freemem()where the runtime reports no available-memory figure. ThememoryFreeByteswire field and the meter's 80/90% thresholds are unchanged; the field's meaning is stated in the presence protocol doc.Not changed: the issue's
debug.overlay.memoryMbclaim concerns process heap, a different diagnostic that matches its current implementation.User Impact
macOS operators see a memory meter that reflects memory actually under pressure instead of a permanent danger-level shortage. Linux and Windows readings are unchanged, because libuv already reports available memory there (verified on this Linux host:
os.freemem()andprocess.availableMemory()both return theMemAvailablefigure).Evidence
src/node-host/host-stats.test.tsdrives the sampler throughprocess.availableMemory(fails on main, where the sampler still readsos.freemem) and covers the free-memory fallback;system-info.test.tsasserts the Gateway row uses the same reader.node scripts/run-vitest.mjs src/node-host/host-stats.test.ts src/gateway/server-methods/system-info.test.ts packages/gateway-protocol/src/schema/nodes.test.ts: all passed.uv_get_free_memory(free_count only) versusuv_get_available_memory(free + inactive + purgeable) indeps/uv/src/unix/darwin.c.pnpm check:changed: pending, will update.