feat(cli): add /heapdump for process memory snapshots#152
Merged
emal-avala merged 5 commits intomainfrom Apr 22, 2026
Merged
Conversation
Writes a best-effort memory snapshot (RSS, VSZ, peak, per-segment sizes where available) to a timestamped file under the user's data directory. Useful for attaching to bug reports when investigating memory growth or leaks. Linux: parses /proc/self/status for VmPeak/VmSize/VmRSS/VmData/etc. macOS: shells out to `ps -o rss,vsz` to avoid a mach binding dep. Other platforms: prints an "unsupported" notice. Hidden from /help since it's a diagnostic command, not a daily-use one.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
The tests module only has Linux-specific tests; on Windows/macOS the `use super::*` was unused and fails `-D warnings`. Moving the cfg guard up to the mod itself avoids duplicating it per test and keeps the file lint-clean on every platform. Also: cargo fmt.
# Conflicts: # crates/cli/src/commands/mod.rs
# Conflicts: # crates/cli/src/commands/mod.rs
# Conflicts: # crates/cli/src/commands/mod.rs
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.
Summary
Adds `/heapdump` — writes a best-effort process memory snapshot to a timestamped file under the user's data directory. Hidden from `/help` (diagnostic command, not daily-use).
Writes to `{data_local}/agent-code/heapdumps/YYYYMMDD-HHMMSS.txt` with a header noting timestamp, PID, version, and platform.
Why
When investigating memory growth or leaks, users currently have no way to capture a snapshot from within the running session. A first-class heap profiler would require rebuilding with a profiling allocator — this OS-level snapshot is the 80% solution at 0 deps.
Test plan