Repository navigation
AgentMenu 1.2.1
Two bug fixes from real use, both root-caused against live session data before anything was changed.
Opening the popover now lands on the agent that's actually running
Reported: Claude Code was mid-turn; opencode had finished over an hour earlier and its app was closed. The popover still opened on the opencode page.
Two independent defects were behind that:
.workingwas not a tier at all. The landing order was exact permission → inferred permission → most-recent.done. A running agent contributed nothing to the ranking, so it lost to any finished session, at any age.- The
.donetier had no age limit. Every session ends in.doneand the sources retain a week of them, so that tier was almost always matched by something stale. Fixing only the first defect would not have held — an idle Claude between turns isn't.workingeither, so a day-old opencode.donewould have recaptured the page the moment a turn ended.
New order:
- exact permission prompt — most recent
- inferred permission prompt — most recent
- running session — the one running longest
- turn finished within the last 10 minutes — most recent
- the page you last chose
Tier 3 orders by earliest startedAt, the opposite direction to every other tier. That's deliberate: elsewhere the timestamp marks a moment that just demanded attention, here it marks the start of a stretch, and the longer the stretch the likelier it's the session you came to check on.
Permission prompts still outrank a merely-busy agent. A working agent needs nothing, and surfacing the one that does is the point of the app.
Idle CPU: 17% → 4.8%
Reported: 17% CPU at rest.
Profiling put Core Animation at the top, running a full commit/layout cycle at frame rate behind a closed popover. StatusDot drives a .repeatForever(autoreverses:) pulse for every working or blocked session, and a repeating animation doesn't care whether anyone can see it. The SwiftUI tree was built once in init and lived for the whole run of the app, so those pulses never stopped.
1.2.0's fix — suppressing model mutations while hidden — could never have caught this, because the animation is self-perpetuating and needs no model change to keep going. The tree is now mounted on open and torn down in popoverDidClose: a hidden view that doesn't exist can't do work, which closes the whole class of bug rather than this one instance. (NSPopoverDelegate was already declared on the controller but never assigned, so close events were going unobserved entirely.)
Measured with the popover closed and one session working:
| 1.2.0 | 1.2.1 | |
|---|---|---|
| CPU | 17.0% | 4.76% |
| Warm start | — | 4.96% CPU / 51 MB RSS |
| RSS over 6 open/close cycles | — | flat (101 → 100 MB) |
An isolation build with the pulse disabled read 4.51%, pinning ~12.5 of the 17 points on the animation alone.
For the record: 1.2.0's release notes quoted 4.6%. That reading was taken with no session working, so no dot was animating — accurate for that moment, but not the steady state.
Not done, and why
1.2.0 suggested slowing the 2-second heartbeat while idle as the next lever. On inspection that isn't safe yet: spool.drain() is called only from that heartbeat, and the permission-hook spool has no file watcher of its own. Slowing the timer would directly slow permission alerts. It needs the spool watched first.
The README's "180 MB RSS and ~3% CPU" has been replaced with measured figures.
248 tests pass (was 239).
Install: download AgentMenu-1.2.1.dmg, open it, drag to Applications. It's ad-hoc signed and not notarised, so macOS blocks the first launch — the README covers three ways past that.