You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
menubar: 30s refresh spawns concurrent Node CLI processes at 100%+ CPU with App Nap disabled (video-call-class energy drain) #647
User report: the menubar app's energy use on macOS rivals a browser video call. Confirmed by measurement on an M-series MacBook running 0.9.15.
Measured evidence
Sampling the process table at 0.4s intervals for 60s while the menubar idled (popover closed):
One refresh tick spawned TWO concurrent full Node processes: codeburn status --format menubar-json --provider all --period today --no-optimize and the same for --period week.
Each was observed at 102-121% CPU for roughly 1-3 seconds (V8 cold start, pricing load, cache read, session parse).
At the 30s cadence that is ~120 Node cold starts per hour, or two-plus full-core seconds burned every 30 seconds, forever.
The app holds a permanent activity assertion (mac/Sources/CodeBurnMenubar/CodeBurnApp.swift:84, beginActivity with automaticTerminationDisabled at launch, never scoped to a fetch), so App Nap never throttles this, including on battery.
Combined-device mode issues a third fetch per tick (mac/Sources/CodeBurnMenubar/AppStore.swift:459-471).
Activity Monitor attributes child processes to the responsible app, so the menubar's Energy Impact reads in the video-call class. Machines with large session histories or cold caches (first run, Cursor sqlite) see much longer spikes, and the missing cross-process cache lock (#645) makes concurrent CLI/MCP/menubar runs re-parse repeatedly.
Proposed fix ladder (cheapest first)
Change-detection guard: before spawning, stat the known provider data roots; skip the fetch entirely when nothing changed since the last one. Most 30s ticks are no-ops on an idle machine.
Refresh the popover period (week etc.) only while the popover is open; the closed menubar only needs the status period.
Adaptive cadence: 30s only while the popover is open or on AC power; back off to 2-5 min on battery, Low Power Mode, or display sleep.
Set qualityOfService = .utility on the spawned Process so spikes prefer efficiency cores.
Scope the activity assertion to in-flight fetches instead of holding it for the app's lifetime.
Longer term: a resident helper process (same reasoning as the MCP server's resident design) to eliminate the per-tick Node cold start.
Items 1-5 are Swift-side and shippable without touching the CLI.
Activity
feat(menubar): user-selectable usage refresh cadence (Auto / 1m / 5m …
fix(menubar): manual cadence never respawns from stuck-refresh cleanup
fix(menubar): move Usage Refresh setting to the General tab
fix(menubar): Usage Refresh picker label now reflects the selection
fix(menubar): cut idle energy by gating spawns on popover, power, and…
feat(menubar): user-selectable usage refresh cadence (Auto / 1m / 5m …
fix(menubar): manual cadence never respawns from stuck-refresh cleanup
fix(menubar): move Usage Refresh setting to the General tab
fix(menubar): Usage Refresh picker label now reflects the selection
Merge pull request #648 from getagentseal/fix/menubar-energy