Merge Icons mode causes system-wide input freezes / beachballs on macOS 26 — WindowServer event-buffer overflow evidence (not an in-process hang)
Summary
With Merge Icons ON, interacting with the merged dropdown intermittently freezes the entire desktop — beachballs, dropped clicks, keyboard input lockout in other apps, and Settings taking multiple attempts to open. With Merge Icons OFF (separate per-provider status items), the same configuration is completely smooth, even with provider status checks enabled.
I profiled this with Instruments attached to the running pristine 0.32.5 build while reproducing, and the result is unusual and probably why this class of bug keeps surviving fixes: CodexBar's own process looks healthy the whole time — no main-thread hang, near-idle CPU — while WindowServer logs show it starving every other application's event delivery during long merged-menu tracking sessions. The evidence below includes the WindowServer ground truth, which I haven't seen in any of the related issues.
I also tested the current 0.32.6-dev fixes (#1376, #1384, #1389, #1391, plus #1271) cherry-picked onto 0.32.5: they do not fix it.
Environment
- CodexBar 0.32.5 (pristine notarized release build; also reproduced on 0.32.5 + the 0.32.6-dev backports listed below)
- macOS 26 (Darwin 26.5.1), Apple Silicon MacBook Pro
- Providers enabled: Codex (auto), Claude (auto), Gemini (OAuth), Antigravity — Gemini since disabled (deprecated CLI, expired token; see "Contributing churn" below)
- Refresh cadence 5 min; reproduced with provider status checks both ON and OFF
Reproduction
- Enable 3–4 providers, turn Merge Icons ON.
- Open the merged dropdown; switch between providers and Overview; click around.
- Within a couple of minutes: system-wide lag, beachballs, clicks in the menu and in other apps dropped, keyboard intermittently unresponsive. Opening Settings from the menu can take several attempts.
- Turn Merge Icons OFF → identical configuration is fast and stable (status checks ON or OFF makes no difference to this).
Evidence
Method: 150-second coordinated captures while reproducing — xctrace record --template 'Time Profiler' --attach <pid>, back-to-back 10s /usr/bin/sample captures, the app's own verbose unified log (subsystem == "com.steipete.codexbar"), and a 1 Hz CPU log.
1. It is NOT an in-process hang
During a 150s window in which I reproduced several "long beachballs":
- Instruments' potential-hangs table is empty (its only flagged event across all sessions was a single 324 ms microhang, attributed below).
- The main thread's largest single work item was ~40 ms; CPU peaked at 44%.
- But the main thread sat inside one
NSMenuTrackingSession.startRunningMenuEventLoopfor ~50 continuous seconds (stack-sampled across five consecutive 10s windows) while the merged menu was open and being interacted with.
2. WindowServer shows the system-wide starvation (the key finding)
During the exact beachball windows, WindowServer logged overflowed event datagram buffers being cleared for nine distinct client connections, all marked clientMayIgnoreEvents: 1 — the state every other app is placed in while a menu-tracking session is active:
14:27:56.285 E WindowServer [SkyLight] Clearing datagram buffer for cid 0x12449b. Client state: Data count: 16392 connectionIsUnresponsive: 0 clientMayIgnoreEvents: 1 clientIsSuspended: 0
14:28:22.370 E WindowServer [SkyLight] Clearing datagram buffer for cid 0x14d293. Client state: Data count: 16404 ... clientMayIgnoreEvents: 1 ...
14:28:22.370 E WindowServer [SkyLight] Clearing datagram buffer for cid 0x16405f. ...
14:28:23.547 E WindowServer [SkyLight] Clearing datagram buffer for cid 0xd80bb. ...
14:28:23.548 E WindowServer [SkyLight] Clearing datagram buffer for cid 0x98283. ...
14:28:26.455 E WindowServer [SkyLight] Clearing datagram buffer for cid 0x68647. ...
14:28:32.401 E WindowServer [SkyLight] Clearing datagram buffer for cid 0x13c92f. ...
14:30:51.253 E WindowServer [SkyLight] Clearing datagram buffer for cid 0xa731b. ...
14:30:52.831 E WindowServer [SkyLight] Clearing datagram buffer for cid 0xedd3b. ...
These timestamps align exactly with the sampled menu-tracking residency and with the perceived freezes. Mechanism (hypothesis, strongly correlated): while the merged menu's tracking session is active, input routes exclusively to CodexBar and other clients' event queues back up; the long sessions plus in-tracking rebuild/refresh churn push those queues to the 16 KB buffer limit, WindowServer dumps them, and the whole desktop freezes — while CodexBar itself profiles as responsive. This would explain why per-process hang detectors keep coming up empty for this class of report.
Query to see it: /usr/bin/log show --last 1h --predicate 'process == "WindowServer" AND eventMessage CONTAINS[c] "spinner" OR eventMessage CONTAINS[c] "unresponsive" OR eventMessage CONTAINS[c] "datagram"'
3. Full refresh cycles run inside the open menu
The app's own debug log, at the exact second of the worst buffer-overflow burst (14:28:22), shows a complete provider refresh executing while the menu was open and tracking:
14:28:22.008 [gemini-probe] Token check (expiry=2026-05-21 ... ) → Token expired; attempting refresh
14:28:22.008 [subprocess] Subprocess start (binary=ps label=antigravity-ps timeout=8.0)
14:28:22.120 [tty-runner] PTY start (binary=claude cols=160 rows=50 timeout=5.0)
14:28:22.955 [gemini-probe] ERROR Could not extract OAuth credentials from Gemini CLI
So menu interaction triggers refreshes, refreshes spawn subprocesses (a Claude CLI PTY, ps probes, login-shell PATH captures) and drive @Observable updates → menu content invalidation/rebuild inside the tracking transaction.
4. Secondary finding: Google Workspace status decode runs on the main thread
With status checks ON, UsageStore.parseGoogleWorkspaceStatus decodes the full https://www.google.com/appsstatus/dashboard/incidents.json (418 KB when measured) on the MainActor, with a custom date strategy that allocates a fresh ISO8601DateFormatter per date field. Measured cost: 150–340 ms of main-thread stall per decode, and it runs once per Google-status provider (Gemini and Antigravity) per refresh — refreshes that fire during menu interaction. The single 324 ms Instruments microhang across all sessions was exactly this stack (refreshStatus → fetchWorkspaceStatus → JSONDecoder.decode([GoogleWorkspaceIncident])). Note the feed is live data, so this cost grows whenever Google has a busy incident week — on all app versions simultaneously. This is real and worth fixing (decode off-main, shared formatter), but it is not the merged-icons freeze: that reproduces with status checks off.
5. Contributing churn observed (for completeness)
- The new login-shell PATH-capture retry (#1316 /
fa9b7570) produced 3+ concurrent$SHELL -lspawns blocked inwait4/readduring provider switching (login shell here is a fast 0.42 s, so this is amplification, not the cause). - An expired Gemini CLI token failed its refresh on every cycle for weeks at error level — a doomed-retry loop with no user-visible surfacing. Worth a backoff/notification.
What I tested that does NOT fix it
Cherry-picked onto 0.32.5 (all five applied cleanly; full test suite green) and re-tested with Merge Icons ON:
- #1376
e97bfb0d— defer tracked menu refresh rebuilds - #1384
7c0ed036— reuse hosted chart submenus - #1389
4c092ce3— defer copy-icon click work off the NSMenu tracking loop (macOS 26 beachball) - #1391
2ed15bf7— defer overview provider rebuild - #1271
f5618341— keychain prompt coordinator (unrelated; included for dev-build QoL)
The system-wide freeze persisted unchanged. Whatever the remaining driver is, it isn't covered by these.
Related issues
This appears to be the same underlying defect reported (without the WindowServer evidence) in:
- #1374 — Stale merged dropdown rebuilds synchronously inside menuWillOpen on the first click after a background refresh tick
- #1360 — Opening CodexBar on the menu bar causes a temporary freeze
- #1387 — Severe UI lag and freezing
- #1329 — Menu bar icon hangs and remains memory-heavy
- #1308 / #1371 — Lag/stutter when 2+ providers are configured (i.e., when the merged switcher is in play)
- #1321 / #1347 — General performance complaints consistent with the above
The common thread: all reports involve the merged dropdown, and per-process diagnostics look clean — consistent with the WindowServer-side starvation mechanism above.
Workaround
Merge Icons OFF. Separate per-provider status items are completely smooth with the identical provider set and status checks enabled.
Available on request
Full Instruments .trace files (two 150s sessions: status checks on/off), the rolling sample captures, app debug logs, and the CPU timelines for all windows quoted above.
Independent reproduction plus a control experiment that narrows the mechanism.
Reproduction (confirming this is not fixed by anything merged or in-flight): packaged build of current main (cde92cfb) plus the cost-scan executor/memo fixes (#1402, #1404), merged icons ON, codex + claude, Apple Silicon, macOS 26.5.1. ~90 seconds of continuous interaction inside the merged dropdown (tab switches, hovering). After ~50s of continuous NSMenuTrackingSession residency (stack-sampled), WindowServer dumped four other clients' event buffers within 70ms:
15:11:32.210 E WindowServer [SkyLight] Clearing datagram buffer for cid 0x49403. Data count: 16392 ... clientMayIgnoreEvents: 1 ...
15:11:32.276 E WindowServer [SkyLight] Clearing datagram buffer for cid 0x68f03. Data count: 16384 ... clientMayIgnoreEvents: 1 clientIsSuspended: 1
15:11:32.276 E WindowServer [SkyLight] Clearing datagram buffer for cid 0x64047. Data count: 16384 ...
15:11:32.276 E WindowServer [SkyLight] Clearing datagram buffer for cid 0x6ed47. Data count: 16384 ...
The 8s sample covering the burst shows CodexBar's main thread idle inside the tracking loop (5,178 of 5,283 tracking frames in mach_msg) — matching your "process looks healthy" observation exactly.
Control (the new datapoint): immediately afterwards, 120 seconds holding an Apple menu-bar menu open with the same continuous cursor motion over its items, CodexBar's menu closed. Result: zero datagram-clearing events in the same log stream.
So a long tracking session per se does not overflow other clients' buffers — Apple menus tracked for over twice as long stay clean. Something specific to the merged dropdown's tracking session generates sustained datagram volume toward every other (event-ignoring) client. Since the buffers that overflow belong to other apps, the volume is presumably broadcast traffic rather than input routing — which points at window-level churn during tracking (hosted submenu window create/destroy, in-tracking content swaps, status-item redraw notifications) rather than at CPU or event-queue pressure inside CodexBar.
Next isolation step if useful: an experiment build with all in-tracking UI updates disabled (quota-bar refresh, content swaps, switcher event monitor) re-run under the same protocol, to bisect which churn source produces the broadcast volume. Happy to run that here — this machine reproduces on demand.
Bisection complete on the reproducing machine — the felt freeze and the buffer-overflow log events turn out to be two separable drivers.
Protocol per round: ~2 minutes of continuous manual interaction inside the merged dropdown, WindowServer log stream (datagram/unresponsive) + back-to-back 1ms sample captures. Experiment builds used an env-gated kill switch suppressing all in-tracking UI churn (open-menu rebuilds, hosted submenu updates, status-icon redraws, store-driven invalidations, switcher event monitor).
| Build | Felt beachballs / dropped input | Buffer-clear events |
|---|---|---|
Stock main |
yes | 5 (burst at ~50s tracking) |
| All in-tracking churn suppressed | no | 0 |
| Churn suppressed, switcher event monitor alone re-enabled | yes | 1 |
| Stock + counter-gated monitor (#1408) | no (clicks + ⌘-shortcuts verified working) | 7 (burst) |
Findings:
- The felt input starvation is the switcher event monitor. Its
beforeSourcesrun-loop observer fired every tracking cycle and eachnextEvent(until:.distantPast)peek re-enters the run loop — under continuous pointer movement that starves the tracking session's own input processing while the process samples healthy. It only installs in Merge Icons mode, which is why Merge OFF is smooth, and none of the previously tested fixes touched it. Fix PR: #1408 (pump gated onCGEventSourcehardware counters for exactly the matched event types; verified by the same protocol — no beachballs, shortcuts intact). - The datagram-buffer overflow tracks in-tracking churn broadly, not the monitor. It disappeared only with all churn suppressed and persists on the gated build with stock rebuild/icon behavior. So your WindowServer evidence points at a second driver — broadcast volume from window/content churn during tracking — which is the direction #1394-style "less reconstruction while tracked" work addresses. Notably the overflow bursts recover without felt impact once the monitor is gated, so the lockout you experienced was most plausibly the monitor, with buffer dumps as the visible-symptom correlate.
Happy to re-run the protocol against any candidate fix for driver 2 — this machine reproduces both phenomena on demand.