feat(system): per-session RAM breakdown in Settings → System (v0.142.0)#242
Merged
Conversation
Show how much resident memory each live agent session holds — its process tree (shell → claude/node → MCP subprocesses) — with a fleet total, sorted heaviest-first, in the Host resources panel. New SessionBackend.sessionRss(): one `tmux list-panes -a` maps each live pane to its root PID; one `ps -Ao pid,ppid,rss` snapshot is walked to sum RSS over each pane's subtree (portable BSD/Linux). TerminalManager.sessionMemory() joins that against the running rows; GET /api/system surfaces it. LauncherSessionBackend returns null (uid-private sockets) → UI shows "not measurable here". RSS is approximate (shared pages counted per process). Validated against 8 live sessions on the instapods box: ~500-735 MB each, 4.6 GB total. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
9d26144 to
cb436a6
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Follow-up to #240. The Host resources panel now shows how much RAM each agent session is using — not just the host total.
For every live session it sums the resident memory of that session's process tree (the tmux pane's shell →
claude/node → its MCP subprocesses), lists them heaviest-first, and shows a fleet total (e.g. "4.6 GB · 8 live"). So you can see how much of the box the running agents are holding, and which session is the hog.How
SessionBackend.sessionRss()— onetmux list-panes -a -F '#{session_name} #{pane_pid}'maps each live pane to its root PID; oneps -Ao pid=,ppid=,rss=snapshot is walked into a child map and summed over each pane's subtree. Portable across macOS (BSD) and Linux (GNU)ps; RSS is KiB on both.TerminalManager.sessionMemory()joins that map against the runningterm_sessionsrows (bytes out).GET /api/systemas asessionsfield; rendered inHostResourcesPanel.LauncherSessionBackend(Linux uid-isolation, off by default) returnsnull— uid-private sockets the app can't inspect → UI shows "not measurable here."Caveat: RSS is approximate — shared library pages are counted once per process, so the per-tree sum slightly over-reports. Labeled as such in the UI.
Testing
typecheck✅ · web build ✅ · server build ✅tmux list-panes+pssubtree-sum algorithm was run against the live tmux socket to confirm the numbers before shipping.🤖 Generated with Claude Code