Repository navigation
Open
Labels
enhancementNew feature or request
Description
Summary
Add root CLI flags --cpuprofile <path> and --memprofile <path> to capture CPU and heap profiles from a Zero session (previously bundled into #1196, split out per review). Decision needed on whether these ship as user-facing flags.
Proposed behavior
- Profiles written on session exit: CPU collection starts at run start; the heap profile is written at finish after a
runtime.GC(), matchinggo test -memprofilesemantics. - Wired into
runWithDepswith correct start/finish/reconfigure lifecycle; documented indocs/PERFORMANCE.md. - No live-sampling signal handling ships in this cut.
Open questions for maintainer decision
- Do these ship? They are new user-facing flags on the root command and imply a support surface (users will attach profiles to issues).
- Live sampling. Sampling a running TUI session without quitting is valuable — it is what made the Reasoning/thinking stream rendering is quadratic in the TUI (per-delta full re-render, O(n^2) append, per-frame whole-string preview) #1195/perf(tui): cache transcript row renders, grow caches with the live tail, and scan the provider catalog without cloning #1196 diagnosis possible — but
SIGUSR2does not exist on Windows, a supported target. Options: a cross-platform trigger (control-file watch, named pipe, an out-of-processzero debug pprofsubcommand talking to an in-session listener), POSIX-only signal sampling with exit-time profiles on Windows, or no live sampling. This issue ships exit-time profiles only; it can also track whether/when live sampling returns. - If a live-sampling listener is chosen, what guards apply (loopback only? disabled by default in
zero serve/ACP modes?) so it can't expose a profiling endpoint.
References
- Split out from perf(tui): cache transcript row renders, grow caches with the live tail, and scan the provider catalog without cloning #1196 (review feedback: new user-facing flags need their own issue/decision).
- Evidence: profiles captured with the prototype drove the fixes in Reasoning/thinking stream rendering is quadratic in the TUI (per-delta full re-render, O(n^2) append, per-frame whole-string preview) #1195 and the render-cache work in perf(tui): cache transcript row renders, grow caches with the live tail, and scan the provider catalog without cloning #1196.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or request
Activity
Vasanthdev2004 commentedon Nov 9, 2026
Thanks for splitting this out. My vote is to ship the exit-time flags only. They are opt-in, they write to a path the user names, and they make performance reports like #1195 much easier to act on.
I would leave live sampling out for now. A profiling listener inside a process that runs model-chosen commands is new attack surface even on loopback, and Windows has no signal to hang it on. If it comes back, it should be its own issue with the guards from your third question decided up front.
@kevincodex1, new root flags are your call.