Skip to content

fix(RAM: view ram in settings): report native ORG2 app footprint accurately - #451

Merged
Harry19081 merged 2 commits into
developfrom
codex/fix-view-ram-native-memory-metrics
Jul 20, 2026
Merged

fix(RAM: view ram in settings): report native ORG2 app footprint accurately#451
Harry19081 merged 2 commits into
developfrom
codex/fix-view-ram-native-memory-metrics

Conversation

@ShiboSheng

Copy link
Copy Markdown
Collaborator

Summary

fixed #435.

  • Replace summed descendant RSS with a versioned, platform-native app memory snapshot.
  • Measure the ORG2 backend together with only WebView helper processes whose ownership can be established safely.
  • Use physical footprint on macOS and Private Working Set / Private Bytes on Windows, with explicit compatibility and fallback states.
  • Keep Terminal, CLI agent, MCP, and tool processes as separate diagnostics instead of including them in the top-level App memory value.
  • Share one frontend snapshot between the Sidebar monitor and Settings monitor so both surfaces display the same measurement.
  • Keep RSS / mapped memory available only as a diagnostic value.
  • Preserve partial attribution in the wire contract and automated tests without displaying the visually intrusive warning banner.
  • Merge the latest origin/develop before delivery.

Root cause

The previous implementation summed RSS across descendant processes.

RSS is not equivalent to the native memory value shown by macOS Activity Monitor or Windows Task Manager. It can include shared and mapped pages, and process-tree ancestry alone is not strong enough to prove that every WebKit helper belongs to ORG2. This could produce inflated totals, include unrelated processes, or retain incorrect ownership after PID reuse.

Sidebar and Settings also performed separate measurements, which allowed the two views to display different snapshots.

Behavior after this change

  • macOS reports native physical footprint for the ORG2 backend and explicitly owned WebKit helpers.
  • WebKit helpers that cannot be tied safely to ORG2 are excluded instead of risking attribution of Safari or another application.
  • Windows reports Private Working Set or Private Bytes, depending on API availability.
  • Native, compatibility, mixed, RSS fallback, unavailable, and partial-attribution states remain represented and testable.
  • Monitoring uses a shared atomic poller and does not create duplicate frontend polling loops.
  • The corrected metric is available to large-shell-output safeguards.
  • Actual WebView memory retained by the application remains visible instead of being hidden by the old metric.

Test plan

  • pnpm run lint
  • pnpm run check:circular
  • pnpm typecheck
  • Full frontend suite: 504 files and 5298 tests passed
  • cargo test -p perf_utils: 68 passed
  • cargo test --lib: 944 passed, 1 network-auth test ignored
  • cargo check -p org2 --lib
  • Strict Clippy checks for affected Rust crates
  • Husky and lint-staged checks
  • macOS live comparison against footprint / vmmap
  • macOS result within the agreed tolerance of 10% or 50 MiB, whichever is larger
  • Manual Sidebar and Settings verification
  • Manual combined verification with the Issue fix(RAM): replace full-buffer output IPC with bounded appends #425 shell-output changes
  • Windows API subset cross-compilation
  • Confirm the native Windows runtime result through Windows CI or release QA

Submit checklist

  • The PR is focused and has a scoped Conventional Commits title.
  • Relevant automated and manual checks were run.
  • No secrets, private configuration, generated build output, or unrelated formatting changes are included.
  • Verification documentation, architecture audit, UI audit, and locale updates are included.

Replace descendant RSS totals with a versioned native memory snapshot so
Sidebar and Settings report the same product boundary. Measure the ORG2
backend and only WebView helpers whose ownership can be established safely,
while keeping terminal, CLI agent, MCP, and tool processes as separate
diagnostics.

Use macOS physical footprint with process-scoped WebKit attribution and
Windows Private Working Set or Private Bytes with conservative fallbacks.
Share one atomic frontend poller, remove the legacy child-process heuristic,
and keep partial attribution internal instead of showing a warning banner.

Verification:
- pnpm run lint
- pnpm run check:circular
- pnpm typecheck
- pnpm exec vitest run --silent --reporter=dot (504 files, 5370 tests)
- cargo test -p perf_utils (68 passed)
- cargo test --lib (944 passed, 1 ignored)
- cargo check -p org2 --lib
- strict Clippy for changed leaf crates
- full-workspace all-target Clippy attempted; blocked by pre-existing warnings
- macOS live footprint comparison and Windows API subset cross-compile

Pre-commit hook ran. Total eslint: 0, total circular: 0
@Harry19081
Harry19081 merged commit c5dc964 into develop Jul 20, 2026
1 of 2 checks passed
Neonforge98 pushed a commit that referenced this pull request Jul 30, 2026
…metrics

fix(RAM: view ram in settings): report native ORG2 app footprint accurately
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(RAM): replace summed RSS with platform-native app memory metrics

2 participants