CodexBar icon indicating copy to clipboard operation
CodexBar copied to clipboard

v0.30.0 regression: dropdown becomes extremely laggy around bottom rows, provider switching, and menu close

Open vekovius opened this issue 6 months ago • 10 comments

Description

After updating to CodexBar 0.30.0, the menu bar dropdown became extremely laggy during normal interaction.

This was working smoothly before the update. The lag started immediately after updating CodexBar, not after changing my workload or launching new apps.

The issue is not just a slow initial open or slow provider/network fetching. The lag happens while the menu is already open. It becomes especially bad after moving/scrolling down toward the bottom rows such as Refresh, Settings, etc. Once I interact around that lower part of the dropdown, hovering becomes very sluggish, switching from Overview to individual providers is laggy, and closing the menu is also delayed.

I have quit and reopened CodexBar multiple times, and the issue persists.

Environment

  • CodexBar version: 0.30.0 (71)
  • macOS version: macOS 26.5 (25F71)
  • Mac: M1 Max
  • Configuration: out-of-the-box/default CodexBar configuration
  • Detected paid subscriptions/providers:
    • Codex
    • Claude
    • Gemini
  • Menu mode: default/out-of-the-box
  • Refresh cadence: default/out-of-the-box

Workload and timing context

At the time I noticed the regression, this workload was already active:

  • VS Code
  • Docker
  • Postgres
  • 2 Codex app windows
  • Safari
  • 3 terminals
    • 2 terminals were running Codex cli
    • 1 terminal was being used for git commands in the project directory

In addition to the above, I also had these extra things running at the time I updated CodexBar and first noticed the issue:

  • 2 additional Codex app windows, for 4 total Codex app windows
  • one Codex window steering Claude inside the Claude Chrome extension in the Chrome app where both were actively editing spreadsheet files.

The important detail is that CodexBar was working normally with this general setup before the update. I noticed the lag when I did because I updated CodexBar while this workload was open, not because the workload suddenly changed or started doing heavier operations.

After noticing the issue, I reduced the running apps back down to the smaller current workload listed above. None of those remaining apps were actively doing heavy work or running operations, but the CodexBar dropdown lag still persisted. Other apps remained responsive, including agent terminals doing actual work. The lag appears isolated to CodexBar’s menu interaction.

Reproduction steps

  1. Launch CodexBar 0.30.0.
  2. Open the menu bar dropdown.
  3. Move the cursor through the menu.
  4. Scroll/move down toward the lower rows such as Refresh, Settings, etc.
  5. Hover over the lower/bottom rows.
  6. Try switching from Overview to an individual provider.
  7. Try closing the dropdown.

Expected behavior

Hovering through menu items, switching providers, and closing the dropdown should be smooth.

Actual behavior

The dropdown becomes very sluggish, especially near the bottom rows. Hovering lags, switching from Overview to individual providers lags, and closing the menu also lags.

Why this feels like a regression

This started immediately after updating to CodexBar 0.30.0.

The workload is relevant only as context: I updated CodexBar while several development apps were already open, but CodexBar had been working smoothly before the update under the same general conditions. The lag appeared after the update, not after launching a new workload.

This does not feel like provider/network slowness because:

  • the lag happens while hovering already-rendered menu rows
  • it gets especially bad near the bottom rows such as Refresh and Settings
  • switching from Overview to individual providers becomes laggy after interacting near the lower part of the dropdown
  • closing the menu itself is delayed
  • quitting and reopening CodexBar multiple times does not fix it
  • reducing the number of running apps did not fix it
  • the remaining open apps were idle/not actively running heavy operations
  • other apps remain responsive

Sample evidence

I captured a sample while the dropdown was open and lagging near the bottom rows. I attached it as:

CodexBar-bottom-hover-lag-sample.txt

The sample shows:

  • Process: CodexBar
  • Version: 0.30.0 (71)
  • OS Version: macOS 26.5 (25F71)
  • The main thread inside AppKit menu tracking:
    • NSMenuTrackingSession startRunningMenuEventLoop
    • NSContextMenuTrackingSession startMonitoringEvents
    • status bar menu popup handling

The sample also appears to show CodexBar rebuilding/populating the visible menu while the dropdown is open:

  • StatusItemController.deferSwitcherMenuRebuildIfStillVisible
  • StatusItemController.rebuildOpenMenuIfStillVisible
  • StatusItemController.populateMenu
  • StatusItemController.updateMenuContentPreservingSwitcher
  • StatusItemController.addPrimaryMenuContent
  • StatusItemController.addMenuCards
  • StatusItemController.addActionableSections
  • -[NSMenu insertItem:atIndex:]
  • -[NSContextMenuImpl _optimalSizeForMenuItemAtIndex:]
  • -[NSView layoutSubtreeIfNeeded]

That seems consistent with the visible symptoms:

  • hover lag while moving through the dropdown
  • worse lag near bottom rows like Refresh / Settings
  • lag switching Overview → provider
  • lag closing the dropdown

The sample also shows hover/highlight related paths:

  • StatusItemController.menu(_:willHighlight:)
  • MenuCardItemHostingView.setHighlighted(_:)
  • SwiftUI/Observation invalidation paths

There is also concurrent account/refresh work in the sample, including:

  • UsageStore.scheduleCreditsRefreshIfNeeded
  • UsageStore.refreshCreditsIfNeeded
  • SettingsStore.codexAccountReconciliationSnapshot
  • DefaultCodexAccountReconciler.loadSnapshot
  • DefaultCodexAccountReconciler.loadLiveSystemAccount
  • OAuth credential parsing/date formatter work

So the concern is that v0.30.0 may be rebuilding or mutating the open menu while menu tracking/highlighting is active, especially around the persistent bottom action rows.

Possible areas to inspect

  • open-menu rebuild/mutation behavior
  • rebuildOpenMenuIfStillVisible
  • deferSwitcherMenuRebuildIfStillVisible
  • updateMenuContentPreservingSwitcher
  • bottom/footer action rows such as Refresh and Settings
  • persistent action item highlighting
  • hosted SwiftUI/AppKit menu-card views
  • menu layout/sizing while the dropdown is already open
  • provider switching from Overview while the lower rows have been interacted with
  • open-menu refresh/account reconciliation interactions

Attachments

CodexBar-bottom-hover-lag-sample.txt

vekovius avatar May 28 '26 02:05 vekovius

Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve. Reviewed May 27, 2026, 10:15 PM ET / 02:15 UTC.

Summary Keep open: this targets the latest v0.30.0 release, the attached sample and current source both point at visible-menu rebuild/mutation work during menu tracking, and I found no current-main fix or canonical duplicate.

Reproducibility: no. high-confidence local reproduction was established in this review. The reporter supplied clear macOS steps plus a sample, and source inspection matches the open-menu rebuild/highlight/account-refresh path, but a macOS bundle run is still needed.

Ways to help us reproduce this

  • Add a screenshot or short recording showing the behavior.
  • Add expected vs actual behavior.

Next step This is a concrete current-release regression with a clear likely code area, but the repair needs macOS runtime proof before maintainers can trust the performance fix.

Review details

Best possible solution:

Keep this open and fix the menu path so visible-menu hover, provider switching, and close stay responsive by coalescing or deferring expensive open-menu rebuild/layout work while preserving account/provider refresh correctness.

Do we have a high-confidence way to reproduce the issue?

No high-confidence local reproduction was established in this review. The reporter supplied clear macOS steps plus a sample, and source inspection matches the open-menu rebuild/highlight/account-refresh path, but a macOS bundle run is still needed.

Is this the best way to solve the issue?

Unclear because there is no proposed patch yet. The likely maintainable direction is to avoid mutating and remeasuring the visible NSMenu during tracking, rather than broadly disabling provider/account refresh behavior.

AGENTS.md: found and applied where relevant.

Remaining risk / open question:

  • I did not run a macOS bundle reproduction in this review, so the exact threshold and before/after performance delta still need runtime profiling.
  • The regression source may involve interaction between menu rebuilds, SwiftUI hosted views, account reconciliation, and macOS 26 menu tracking rather than a single isolated line.

Codex review notes: model gpt-5.5, reasoning high; reviewed against 9f5813e6d132.

Label changes

Label changes:

  • add P1: This is a latest-release regression in the core menu-bar dropdown that makes normal hover, provider switch, and close interactions sluggish for a real user.
  • add impact:other: The concrete impact is user-visible UI responsiveness/performance in CodexBar's primary menu, which is outside the more specific owned impact categories.
  • add issue-rating: 🐚 platinum hermit: Current issue advisory state selects this label.
  • add clawsweeper:needs-live-repro: Current issue advisory state selects this label.

Label justifications:

  • P1: This is a latest-release regression in the core menu-bar dropdown that makes normal hover, provider switch, and close interactions sluggish for a real user.
  • impact:other: The concrete impact is user-visible UI responsiveness/performance in CodexBar's primary menu, which is outside the more specific owned impact categories.
Evidence reviewed

Acceptance criteria:

  • swift test --filter StatusMenuSwitcherRefreshTests
  • swift test --filter StatusMenuOpenRefreshTests
  • swift test --filter StatusMenuTests
  • make check
  • On macOS, run ./Scripts/compile_and_run.sh and capture before/after or after-fix proof of smooth menu hover, provider switch, and close behavior.

What I checked:

  • Reporter sample matches menu-tracking lag path: The attached sample is for CodexBar 0.30.0 (71) on macOS 26.5 and includes AppKit menu tracking plus CodexBar open-menu rebuild/populate/update frames, AppKit sizing/layout, hover highlight, and concurrent account/credits refresh work.
  • Open visible menu is still repopulated on current main: rebuildOpenMenuIfStillVisible checks that the menu is open, then calls populateMenu, marks it fresh, and reapplies the icon; this is the same visible-menu rebuild surface described in the sample. (Sources/CodexBar/StatusItemController+Menu.swift:1103, 9f5813e6d132)
  • Provider switching defers then rebuilds the open menu: deferSwitcherMenuRebuildIfStillVisible yields on the main actor, confirms the menu is still open, closes hosted submenus, and rebuilds the visible menu for the selected provider. (Sources/CodexBar/StatusItemController+MenuRefreshScheduling.swift:13, 9f5813e6d132)
  • Smart update still removes and re-adds visible menu rows: updateMenuContentPreservingSwitcher removes items below the switcher and re-adds account switchers, primary menu content, and actionable sections, matching the sample's NSMenu insertItem and layout work. (Sources/CodexBar/StatusItemController+Menu.swift:344, 9f5813e6d132)
  • Hover highlighting uses SwiftUI observation state: menu(_:willHighlight:) updates each custom menu view's highlight state, and MenuCardItemHostingView.setHighlighted mutates an observable highlight model, which matches the sample's hover/highlight invalidation path. (Sources/CodexBar/StatusItemController+Menu.swift:156, 9f5813e6d132)
  • No central menu fix after v0.30.0 on current main: Diffing v0.30.0 to current main shows no changes in the central menu rebuild, refresh scheduling, presentation, or Codex credits refresh files, so the reported path does not appear fixed after the release. (9f5813e6d132)

Likely related people:

  • Peter Steinberger: Current blame for the visible-menu rebuild, highlight, and Codex credits-refresh paths points to the v0.30.0 release commit, and nearby history shows follow-up menu/account fixes in the same area. (role: recent area contributor; confidence: high; commits: 81cf30a6d5e1, aebe1c91cd58, eba4b6fc45f1; files: Sources/CodexBar/StatusItemController+Menu.swift, Sources/CodexBar/StatusItemController+MenuRefreshScheduling.swift, Sources/CodexBar/StatusItemController+MenuPresentation.swift)
  • Yuxin Qiao: git log -S ties the provider switcher and smart menu update surface to the compact multi-row provider switcher work, which is central to the reported provider-switch lag. (role: provider switcher feature contributor; confidence: medium; commits: 2ff00f6d8e66; files: Sources/CodexBar/StatusItemController+Menu.swift, Sources/CodexBar/StatusItemController+MenuRefreshScheduling.swift, Sources/CodexBar/StatusItemController+MenuPresentation.swift)
  • René: Recent current-main history touched status item recovery behavior shortly after v0.30.0, adjacent to the menu-bar runtime surface though not the central open-menu rebuild files. (role: recent adjacent contributor; confidence: low; commits: 63d9373b733f; files: Sources/CodexBar/MenuBarVisibilityWatcher.swift, Tests/CodexBarTests/MenuBarVisibilityWatcherTests.swift, Tests/CodexBarTests/StatusItemControllerSplitLifecycleTests.swift)
How this review workflow works
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

clawsweeper[bot] avatar May 28 '26 02:05 clawsweeper[bot]

Same here on CodexBar 0.30.0 (build 71).

  • macOS 26.5 (25F71), M5 Pro
  • 3 providers enabled: Codex (Pro 20x), Claude (Claude Max, OAuth), OpenCode Go
  • Menu becomes extremely laggy after opening, especially near bottom rows. Clicking the menu bar icon and hovering around Refresh/Settings causes the dropdown to freeze. Was completely smooth on 0.29.x.

The sample stack shows rebuildOpenMenuIfStillVisible → populateMenu → insertItem:atIndex: being called while NSMenuTrackingSession startRunningMenuEventLoop is active — same main-thread contention as the OP observed.

Astro-Han avatar May 28 '26 04:05 Astro-Han

I have same issue

wang93wei avatar May 28 '26 04:05 wang93wei

I have the issue as well

Sar777 avatar May 28 '26 05:05 Sar777

I have same issue

Seaony avatar May 28 '26 05:05 Seaony

Same here, when click on the toolbar and move the mouse to the drop menu, the UI becomes slow. Sometimes the whole screen becomes laggy because codexbar

tomcruiseqi avatar May 28 '26 06:05 tomcruiseqi

The same issue on v0.30.1

downgrade to v0.29.1 fix the problem

aborovmind avatar May 28 '26 07:05 aborovmind

Fixed on main in 529e2553.

What changed:

  • coalesced visible-menu rebuild scheduling so repeated refresh/switcher events collapse into one deferred rebuild
  • preserved hosted-submenu cleanup when a switcher rebuild is coalesced with a plain refresh
  • reduced hover highlight work to only the previous/current custom row instead of walking every menu item

Proof:

  • swift test --filter StatusMenuOpenRefreshTests
  • swift test --filter StatusMenuHighlightTests
  • swift test --filter StatusMenuSwitcherRefreshTests
  • swift test --filter StatusMenuTokenAccountSwitcherTests
  • swift test --filter StatusMenuCodexSwitcherTests
  • swift test --filter StatusMenuTests
  • make check
  • local autoreview clean
  • ./Scripts/compile_and_run.sh packaged, relaunched, and verified CodexBar stayed running
  • Peekaboo verified the com.steipete.codexbar menubar item click; no recent CodexBar error/fault logs after relaunch

steipete avatar May 28 '26 08:05 steipete

Fixed on main in 529e255.

What changed:

  • coalesced visible-menu rebuild scheduling so repeated refresh/switcher events collapse into one deferred rebuild
  • preserved hosted-submenu cleanup when a switcher rebuild is coalesced with a plain refresh
  • reduced hover highlight work to only the previous/current custom row instead of walking every menu item

Proof:

  • swift test --filter StatusMenuOpenRefreshTests
  • swift test --filter StatusMenuHighlightTests
  • swift test --filter StatusMenuSwitcherRefreshTests
  • swift test --filter StatusMenuTokenAccountSwitcherTests
  • swift test --filter StatusMenuCodexSwitcherTests
  • swift test --filter StatusMenuTests
  • make check
  • local autoreview clean
  • ./Scripts/compile_and_run.sh packaged, relaunched, and verified CodexBar stayed running
  • Peekaboo verified the com.steipete.codexbar menubar item click; no recent CodexBar error/fault logs after relaunch

still super slow in latest version v0.31.0

0xbentang avatar May 29 '26 02:05 0xbentang

still super slow in latest version v0.31.0

@steipete I have the same issue.

I have active subscriptions for both OpenAI and z.ai. In the menu bar status menu, when repeatedly switching back and forth between the two subscriptions/accounts, CodexBar shows brief bursts of very high CPU usage. That makes the app feel frozen or noticeably stuttery during interaction.

I think UI speed issues should be verified by manual testing by a human, not delegated to automation to decide whether they are solved.

wang93wei avatar May 29 '26 02:05 wang93wei