Skip to content

fix(devices): report available host memory - #144535

Merged
altaywtf merged 3 commits into
openclaw:mainfrom
sunlit-deng:sunlit/fix/issue-144176
Oct 10, 2026
Merged

altaywtf merged 3 commits into
openclaw:mainfrom
sunlit-deng:sunlit/fix/issue-144176

Conversation

@sunlit-deng

@sunlit-deng sunlit-deng commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

macOS Devices meters count reclaimable cache as used memory.

Fixes #144176

User Impact

Gateway and paired-node meters include reclaimable memory on macOS; Linux and Windows readings stay unchanged.

Why This Change Was Made

Both producers share one platform-aware reader. Utilization remains distinct from kernel memory pressure.

Evidence

Proof Result / limit
Contributor's native Mac run 6,175,932,416 available bytes; 64.1% utilization. Reader/sampler match this PR.
Fresh Linux checks Explicit OS fixtures; not a new native Mac run.
Supplied renderer captures below Controlled readings: red 59/64 GB → green 32/64 GB.

Before: controlled raw-free reading

After: controlled available-memory reading

@clawsweeper

clawsweeper Bot commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime size: XS labels Sep 11, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 11, 2026
@clawsweeper

clawsweeper Bot commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

Gateway and paired-node memory readings include reclaimable memory on macOS through one shared reader.

Example: The supplied Devices captures use a 64 GB macOS host with controlled memory readings.

  • Before: The meter shows 59/64 GB used in red.
  • After: The meter shows 32/64 GB used in green.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A useful, focused repair with sufficient native and visual evidence, meaningful platform coverage, and no actionable findings.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): The supplied native macOS sampler result exercises the shared reader, whose source matches this head; inspected controlled Devices captures demonstrate the meter result, and altaywtf verifies the source correspondence and producer regressions.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Healthy macOS hosts appear nearly out of memory because reclaimable cache is counted as used.
Reason: The patch fixes the central reported meter problem with a narrow shared-owner change and current maintainer verification; process-heap diagnostics remain a separate contract.

Merge readiness

✅ Ready for maintainer review

This PR repairs a real macOS diagnostics bug that remains on current main and the latest release; no actionable correctness or security defect was found.

Priority: P2
Reviewed head: 06ad1a481fd1516f6e3e6583861ccc0396cacf51

Before merge

None.

Findings

None.

Agent review details

How this fits together

Gateway system.info and paired-node resource snapshots supply memory readings to the Control UI, which subtracts available bytes from total bytes to render utilization.

flowchart TD
 A[Host memory] --> B[Shared platform reader]
 B --> C[Gateway system info]
 B --> D[Node host sampler]
 D --> E[Node stats publication]
 C --> F[Control UI memory meters]
 E --> F
Loading

Technical review

Best possible solution:

Keep the shared Darwin-aware reader and preserve other platforms, existing wire fields, and the distinction between host utilization and memory pressure.

Do we have a high-confidence way to reproduce the issue?

Current-main producers count only Darwin free pages, and the Devices renderer converts that reading into exaggerated utilization; official-release reports support this source path, but this review ran no target code.

Is this the best way to solve the issue?

Correcting both producers through one native runtime reader addresses the cause without shell probes, threshold changes, or additional configuration.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against d7f014ae5dea.

Provenance checked

  • Gateway host memory changes intended behavior with a stated reason (2bed394: Expose Gateway host resources and headroom without requiring operators to SSH into the machine.)
  • Paired-node memory and bounds changes intended behavior with a stated reason (fcc0d52: Publish bounded host-resource snapshots for paired-node diagnostics.)
  • Presence protocol documentation keeps the original intent (9466d07: Split the protocol reference by reader task while preserving its contracts.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit fcc0d52 adds src/node-host/host-stats.ts:10 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: fcc0d52b880e; files: src/node-host/host-stats.ts)

PR surface

Source +16, Tests +56, Docs +2. Total +74 across 6 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 3 18 2 +16
Tests 2 78 22 +56
Docs 1 5 3 +2
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 6 101 27 +74

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #144176
Summary: This PR implements the canonical macOS host-memory accounting repair.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: Misleading macOS resource warnings affect diagnostics without evidence of blocked operation or runtime failure.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only; repair and merge need explicit maintainer commands such as @clawsweeper autofix or @clawsweeper automerge.

History

Review history (8 earlier review cycles)
  • reviewed 2026-09-11T01:00:30.427Z sha f55c5eaa81d4911c912935f0f5f7d4fc46096acc :: blocked before merge. :: [P2] Preserve host-wide memory readings outside Darwin
  • reviewed 2026-09-11T02:07:20.838Z sha dd62b2a81473f03ca0033d1ba036d97a6ffbb948 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-11T02:19:00.090Z sha a3dc8534971d892ff9d16b90b121a438ba7519b9 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-14T01:09:42.558Z sha 5033fdf5b180c0d06ee7f5380b2d475fa5b361a8 :: needs real behavior proof before merge. :: none
  • reviewed 2026-09-14T04:46:43.169Z sha e166e828384140e8fab389531e20bdbb26ffd9ad :: blocked before merge. :: none
  • reviewed 2026-09-17T01:26:22.223Z sha 4dfcc1df4dde0f4890734bbff6ee1edd1513d07d :: needs maintainer review before merge. :: none
  • reviewed 2026-09-24T00:32:35.464Z sha 5fea1c7 :: needs maintainer review before merge. :: none
  • reviewed 2026-10-05T02:17:46.955Z sha 5fea1c7 :: needs changes before merge. :: none

Reviewed October 10, 2026, 9:14 AM ET / 13:14 UTC (Revision 9).

@sunlit-deng
sunlit-deng force-pushed the sunlit/fix/issue-144176 branch from f55c5ea to dd62b2a Compare September 11, 2026 02:00
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 11, 2026
@sunlit-deng
sunlit-deng force-pushed the sunlit/fix/issue-144176 branch 2 times, most recently from a3dc853 to 5033fdf Compare September 14, 2026 01:02
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 14, 2026
@sunlit-deng
sunlit-deng force-pushed the sunlit/fix/issue-144176 branch from 5033fdf to e166e82 Compare September 14, 2026 04:33
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Sep 14, 2026
@sunlit-deng
sunlit-deng force-pushed the sunlit/fix/issue-144176 branch from 4dfcc1d to 5fea1c7 Compare September 24, 2026 00:25
@altaywtf altaywtf self-assigned this Oct 10, 2026
@altaywtf

Copy link
Copy Markdown
Member

I verified the prepared change on Linux Crabbox. Independent review found no actionable P0–P2 issues.

  • Before → after: the real node sampler reports 90% used on main and 40% after the fix for the same Darwin memory inputs; Linux and Windows keep their host-wide readings. Reverting the reader fails the Darwin regression, and removing clamping fails the restored upper-bound case.
  • Tests and cost: both producer suites pass: host-stats.test.ts 7.33 s wall; system-info.test.ts 31.98 s. Per-file CI timing is not yet available for this revision.
  • Platform and visual proof: I checked the supplied native macOS trace against identical helper and sampler source. The inspected before and after captures exercise the real Devices renderer with controlled inputs; the proof images are no longer product assets.
  • Scope: my new execution uses controlled OS inputs on Linux. The full changed-file check stops at the same environment-variable budget failure on unchanged main (456 versus 455); final hosted checks remain pending.

@altaywtf

Copy link
Copy Markdown
Member

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@altaywtf
altaywtf merged commit 8a7542b into openclaw:main Oct 10, 2026
115 checks passed
@altaywtf

Copy link
Copy Markdown
Member

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 11, 2026
* fix(devices): report available host memory

* fix(devices): use prepared Gateway context in platform coverage

---------

Co-authored-by: Altay <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation gateway Gateway runtime P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Device inventory memory bar always red on macOS due to os.freemem() misunderstanding

2 participants