Merge upstream CodexBar main#2
Merged
Merged
Conversation
Defer merged-menu close rebuilds, cache repeated menu-card height measurements, and coalesce rapid switcher rebuild requests. Co-authored-by: hhh2210 <hzy2210@gmail.com>
* Reduce icon observation churn * Remove residual reflection from icon observation signature A main-thread sample of the packaged build (Merge Icons on, macOS 26.5) showed providerStoreIconObservationSignature still bottoming out in String(describing:) -> _adHocPrint_unlocked reflection, from two String(describing:) calls over the payload-free IconStyle enum. Make IconStyle String-raw-represented (rawValue == case name, so the signature string is byte-identical) and replace both String(describing:) calls with .rawValue. The icon-observation leaf is now reflection-free; a re-sample shows providerStoreIconObservationSignature and _adHocPrint_unlocked gone from the path entirely. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * Derive icon credits fallback from the Codex projection, not a hand-rolled predicate menuBarCreditsRemainingForIcon (used by both the rendered menu-bar icon and the icon observation signature) reimplemented the menu-bar credits fallback with its own rate-window predicate over snapshot.primary/secondary. That is a second source of truth for a decision the Codex projection already owns (codexConsumerProjection -> menuBarFallback == .creditsBalance): equivalent today, but free to drift from the rendered/menu fallback semantics as the projection evolves. Delegate to store.codexMenuBarCreditsRemaining instead, so render, signature, and the menu-bar fallback all read one projection. The projection is pure value composition over already-loaded snapshot/credits state (no IO), so the icon/signature path stays cheap. Behavior is unchanged in the covered cases (8 icon observation signature tests still pass). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * Stabilize flaky switcher coalesce test timing * docs: add changelog for icon observation fix --------- Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com> Co-authored-by: Peter Steinberger <steipete@gmail.com>
Menu cards size from semantic text styles (.body/.footnote/.headline/…) that scale with the macOS system text-size / Dynamic Type setting. That scale was in neither the content fingerprint nor the cache key, and no observer clears the cache when it changes, so a runtime text-size change could return a height measured at the old scale (clipped or over-tall cards) until the next data refresh or the 256-entry flush. Add the resolved .body point size to MenuCardHeightCacheKey. Widening the key is the safe direction: identical scale keeps hitting as before, a changed scale forces a fresh measurement. It can never return a stale height, only (at worst) re-measure once after a scale change. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
In Merge Icons mode prepareAttachedClosedMenusIfNeeded eagerly rebuilt the closed merged menu on every store tick, running a full main-thread populateMenu (incl. SwiftUI hosting-view layout) that menuWillOpen redoes on display anyway. Defer the merged menu until next open instead, taking the residual close-path freeze to zero. Refs #1274.
Cache menu card heights and skip closed merged-menu rebuild
…-churn Fix quota indicator constraint churn
Fix Alibaba token plan SEC token fallback
Fix Kiro CLI discovery after slow login PATH capture
Try the token-plan remains endpoint first, then fall back to the legacy coding-plan remains endpoint for compatible API-token failures. Cover the new fallback path and the updated global/China retry request order.
Use the most constrained MiniMax quota window for automatic menu-bar metrics so a near-exhausted weekly lane is not hidden behind a low 5h lane.
fix: preserve Codex reset windows across account refresh
The menu readiness signature serializes every enabled provider's token snapshot and 30-day daily breakdown on each store mutation. Two fixes: - Skip computing it entirely when no menu is open, since the result (refreshOpenMenus) is only consulted while a menu is open. This is the common case during background refresh ticks. - Use the raw Double bit pattern instead of String(format: "%.8f", …), which is a hot per-value cost. The signature is only compared for equality, so the bit pattern is both exact and far cheaper. Reduces main-thread work that regressed popup-menu responsiveness in the 0.32 series (refs #1321). Co-authored-by: Cursor <cursoragent@cursor.com>
Each hosted chart/submenu item built TWO SwiftUI hierarchies on every (re)build: the MenuHostingView that is actually displayed, plus a separate NSHostingController created solely to measure height via sizeThatFits. That controller's result was always immediately overwritten by the subsequent refreshHostedSubviewHeights() fittingSize pass (run from both menuWillOpen and refreshHostedSubviewMenu), so the second hierarchy was pure overhead on a popup-menu hot path that scales with provider/account count. Measure the live displayed view via fittingSize instead (the same mechanism refreshHostedSubviewHeights already uses), via a shared hostedSubviewFittingHeight helper. Final heights are unchanged; only the redundant SwiftUI tree is removed. Adds a test asserting the append-path height matches the authoritative re-measure across chart types/providers. refs #1321 Co-authored-by: Cursor <cursoragent@cursor.com>
Skipping the readiness signature while all menus are closed (the idle-cost optimization) let the baseline drift from live store data. A menu reopened from new data, followed by an open-menu change reverting to the previous baseline value, was treated as unchanged and skipped the rebuild, leaving stale content visible. Re-anchor the baseline when a root menu opens (rebuilt from current data). Only the root open re-anchors; nested submenu opens must not, to avoid masking a pending parent refresh. Adds a focused regression test. Co-authored-by: Cursor <cursoragent@cursor.com>
…347) localizedBundle()/codexBarLocalizationResourceBundle()/lprojBundle() did Bundle(url:)/Bundle(path:) filesystem lookups on every call. Menu row bodies re-evaluate them on every closed-menu rebuild tick on the main thread, so idle CPU climbs. Cache the (constant) resource bundle and the resolved localized bundle keyed on the current language; a language switch transparently re-resolves. Single lock with compute-outside-lock keeps disk work off the critical section and avoids re-entrant deadlock. Co-authored-by: Cursor <cursoragent@cursor.com>
CI failed because the language-switch assertion used "ja", which has no ja.lproj in the repo and correctly falls back to en.lproj. Use "es" instead, which matches an actual catalog. Co-authored-by: Cursor <cursoragent@cursor.com>
Only re-anchor the readiness baseline on root menu open when the menu was actually rebuilt or is already fresh for the current menuContentVersion. When refreshMenuForOpenIfNeeded preserves stale content during an in-flight provider refresh, resyncing to live store data would mask the refresh-completion update. Add a focused regression test (negative-validated). Co-authored-by: Cursor <cursoragent@cursor.com>
Cache localized bundle resolution to cut main-thread disk lookups (#1347)
perf: size hosted menu charts without a throwaway hosting controller
perf: cut menu readiness signature cost on store changes
Defer status-menu quit during shutdown
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Merges Pete's
steipete/CodexBarupstream/mainchanges sincev0.32.4into QuotaKit while preserving QuotaKit product/release identity.Closes #1 when merged.
What changed
UPSTREAM_MONITOR_BASEfor new-commit detection, whileUPSTREAM_VERSIONremains the shipped-user release markerQuotaKit boundaries preserved
QuotaKit/quotakit)UPSTREAM_VERSIONbefore releaseUPSTREAM_MONITOR_BASEso the daily monitor will not reopen stale issues after this sync lands, unless Pete commits new upstream changesUsageSnapshotfields while adding upstream subscription date fieldsSecondary review focus
UsageSnapshotschema compatibilityValidation
./Scripts/lint.sh lintswift build./Scripts/check_upstreams.shnow reports 0 new commits on this branch becauseUPSTREAM_MONITOR_BASEpoints at the merged Pete upstream commit