CodexBar icon indicating copy to clipboard operation
CodexBar copied to clipboard

v0.24: Cost / Subscription Utilization submenus do not open after first refresh; plan label transiently shows account email

Open markiewiczsergei opened this issue 6 months ago • 1 comments

Summary

After upgrading from 0.23 → 0.24, the two drill-down rows in the Claude card — Cost and Subscription Utilization (those with the > chevron) — fail to open their submenus on hover or click most of the time. They occasionally open briefly after a sequence of clicks elsewhere in the menu, then stop responding again.

In the same session, the plan-label slot in the Claude card header (top-right) was observed to transiently render the account's email address instead of the plan tier (Team); reverted back to Team on the next reopen of the menu. Possibly the same state-machine glitch affecting #848-style data binding.

Both rows worked normally on 0.23.

Environment

  • CodexBar 0.24, macOS 26.4.1, Apple Silicon
  • Single claude token account in ~/.codexbar/config.json
  • cookieSource: "manual", showAllTokenAccountsInMenu = false
  • Token: 131-char sk-ant-sid02-… sessionKey from claude.ai cookies
  • HTTPStorages were cleared the day before the upgrade

Steps to reproduce

  1. Have a single Claude account configured (web/sessionKey path, not OAuth).
  2. Upgrade from 0.23 to 0.24 via the in-app updater.
  3. Open the menu and hover/click the Cost row.
  4. Repeat for Subscription Utilization.

Observed

  • The submenu does not open in most attempts.
  • One time on Cost, the submenu flashed open and immediately closed.
  • Stochastic behaviour after clicking the header / Session row first: both submenus briefly started working, then stopped again on next menu reopen.
  • During one menu reopen, the plan label slot displayed the email address of the account instead of Team. Could not reproduce on demand for a screenshot; reverted to Team on the next reopen.

Expected

Cost and Subscription Utilization submenus should open consistently on click/hover, and the plan-label slot should never spill the account email into the tier-label position.

Suspected area

0.24 changed:

  • "refresh open usage cards after live data changes so the 'Updated' timestamp advances after manual or cadence refreshes" (#715)
  • "block delayed test-time menu mutations after teardown and enforce no-UI keychain reads more reliably" (#381)
  • "preserve existing status items and assign stable autosave names" (#538)

Any of these touching the menu/submenu lifecycle could plausibly leave the popover coordinator in an inconsistent state where the inner sheet is dismissed before it can present.

Workarounds tried

  • Click the icon to dismiss and reopen the menu — no change.
  • Quit and relaunch CodexBar — submenus open briefly after a few clicks, then break again.
  • ⌘R Refresh — does not reset the submenu state.

Notes

Filed under the same setup as #848 and #851 (single Claude Team workspace, manual sessionKey).

markiewiczsergei avatar May 07 '26 22:05 markiewiczsergei

Fixed on main in 3ca45e3f.

Root cause: open-menu refreshes could rebuild the parent SwiftUI-backed menu card while a hosted chart submenu was open. That mutates AppKit menu items during submenu tracking, which can make the Cost / Subscription Utilization submenu flash closed or stop opening reliably.

Fix:

  • Defer parent menu rebuilds while any hosted submenu is open.
  • Still refresh submenu heights while the submenu is open.
  • Refresh the parent menu after the hosted submenu closes if the parent became stale meanwhile.

Validation:

  • swift test --filter StatusMenuHostedSubmenuRefreshTests
  • swift test --filter StatusMenuTests
  • focused swiftlint --strict
  • ./Scripts/compile_and_run.sh rebuilt, packaged, relaunched, and confirmed CodexBar running.

The transient email-in-plan-slot symptom should also be covered by the separate #848 organization-targeting cleanup that landed earlier; this issue's submenu lifecycle bug is fixed here.

steipete avatar May 10 '26 13:05 steipete