bench(coding-agent): committed instrument for session-load memory - #903
Merged
Conversation
Measures heap after forced GC per phase (module baseline, entries loaded, context volume) plus the process high-water RSS while loading a synthetic multi-MB session through the real SessionManager pipeline, so memory claims about session retention have one reproducible instrument instead of a throwaway script per investigation.
|
Warning Review limit reachedNext included review available in 21 minutes. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
The header named three phases and the script had two. Phase 3 was a character count over the loaded entries, which measures the transcript, not the pipeline, and buildSessionContext -- the pass that turns retained entries into the message array a turn carries -- was never called. It is called now, through SessionManager.buildSessionContext(), so the phase runs against the live entry array, leaf and id index rather than a re-derived copy. Each phase also prints high-water RSS beside heap and current RSS. VmHWM is monotonic, so the rise between two phases is that phase's transient peak; the header claimed peaks were reported per phase and one line at the end reported the whole run. The synthetic transcript moves from the system temp dir to the repo's gitignored .scratch root. SESSION_MB=500 is half a gigabyte, and where /tmp is a tmpfs that is half a gigabyte of RAM charged against the measurement being taken. Refs #903
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
A committed instrument for the question this whole perf series keeps asking: what does a large session actually hold in memory?
packages/coding-agent/bench/session-memory.bench.tsbuilds a synthetic multi-MB transcript (alternating user/assistant turns with multi-KB text blocks and periodic large tool outputs — the shape real sessions have), loads it through the realSessionManager.openpipeline, and reports per phase:VmHWMfrom/proc/self/statuson Linux),SESSION_MB=80 bun packages/coding-agent/bench/session-memory.bench.tssizes the synthetic session.Sample output (docker sandbox, 32 MiB / 13,435 entries)
Why
Every memory claim in this series (#898's export peak, #899's pinned clones) was measured with an ad-hoc script that no longer exists. This makes session-retention measurement reproducible: any future change to session loading, entry shape, or snapshot retention can be diffed against these numbers with one command, and new investigations start from a map instead of a blank page.
Testing
SESSION_MB.bun run check:ts,bun run check:toolsclean.bun checkpasses