fix: eliminate quota bar constraint churn causing menu unresponsiveness (closes steipete/CodexBar#1303)#1315
Conversation
|
Thanks for the context here. I swept through the related work, and this is now duplicate or superseded. Keep open: the quota guard is source-plausible and covered by focused tests, but the PR still has no posted after-fix runtime proof and still carries icon-observation work that overlaps #1297. Canonical path: Close this PR as superseded by #1297. So I’m closing this here and keeping the remaining discussion on #1297. Review detailsBest possible solution: Close this PR as superseded by #1297. Do we have a high-confidence way to reproduce the issue? No high-confidence runtime reproduction was established in this review. Source inspection confirms current main recreates quota fill constraints on each quota update, and the linked bug report supplies current-release macOS 26.5 lag evidence. Is this the best way to solve the issue? Unclear as submitted. The quota ratio guard is a narrow maintainable fix, but the branch should either be rebased to the quota files with runtime proof or explicitly consolidated with the open icon-observation PR. Security review: Security review cleared: No concrete security or supply-chain concern found; the diff is Swift app/test code with no dependency, workflow, secret, or release-script changes. AGENTS.md: found and applied where relevant. What I checked:
Likely related people:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 65e39f4dcb3a. |
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Thanks @juanjoseluisgarcia. The merged icon-observation part overlapped the already-landed #1297, and I landed the remaining quota bar constraint fix in #1319: #1319, merge commit af2c754. Because this branch could not be updated by maintainers, I carried the narrow fix in a maintainer PR. Enabling Allow edits by maintainers helps for future PRs. |
Summary
provider switcher quota bars") that caused menu tab switches to
unconditionally replace `NSLayoutConstraint` objects for every provider's
quota bar on each call to `updateMenuContentPreservingSwitcher` — even when
usage data had not changed
(`newRatio != indicator.fillRatio`); tab switches with unchanged quota data
now skip all AutoLayout work entirely
that constraints are preserved when the ratio is unchanged and replaced only
when it actually changes
Root cause
`updateQuotaIndicators()` was called on every tab switch via
`updateMenuContentPreservingSwitcher`. With 10+ enabled providers this
performed O(N) `NSLayoutConstraint` deactivation + creation on the main thread
per click, blocking the menu from responding.
Branch note
This branch also carries the icon-observation refactor that overlaps with open PR #1297. The unique quota-constraint work is isolated to `StatusItemController+SwitcherViews.swift` and `StatusMenuSwitcherRefreshTests.swift`. Happy to rebase to a narrow PR targeting only those two files once #1297 is resolved — deferring to maintainer on consolidation approach.
Test plan
Test output (macOS arm64, June 5 2026)
All 11 tests pass, 0 failures.
Closes #1303