Skip to content

fix: use /proc filesystem for agent memory metrics#82

Merged
khaliqgant merged 3 commits intomainfrom
fix/agent-relay-324-memory-metrics
Jan 6, 2026
Merged

fix: use /proc filesystem for agent memory metrics#82
khaliqgant merged 3 commits intomainfrom
fix/agent-relay-324-memory-metrics

Conversation

@agent-relay-rachel
Copy link
Copy Markdown
Contributor

Summary

Fixes agent-relay-324

The ps command is not installed in workspace containers, causing memory metrics to show 0 B for all agents.

Problem

execSync('ps -o rss=,pcpu= -p ${pid}') fails silently because ps is not available.

Solution

Replace ps with /proc filesystem parsing:

  • Read /proc/[pid]/status
  • Parse VmRSS line for resident set size (in kB)
  • Convert to bytes for display

Note: CPU percentage is left at 0 since accurate measurement requires sampling /proc/[pid]/stat over time intervals.

Test plan

  • Check metrics page shows non-zero memory for running agents
  • Verify cat /proc/<pid>/status | grep VmRSS returns valid data in container

Generated with Claude Code

Agent Relay and others added 3 commits January 6, 2026 13:56
Fixes agent-relay-324

The `ps` command is not installed in workspace containers, causing
memory metrics to show 0 B for all agents. This replaces the ps-based
approach with /proc filesystem parsing.

Now reads VmRSS from /proc/[pid]/status which provides resident set
size in kB. CPU percentage is left at 0 since accurate measurement
requires sampling over time intervals.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Fixes lint error - variable is never reassigned.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@khaliqgant khaliqgant merged commit d137b1f into main Jan 6, 2026
6 checks passed
@khaliqgant khaliqgant deleted the fix/agent-relay-324-memory-metrics branch January 6, 2026 15:34
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.

1 participant