Improve menu performance#1198
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed May 28, 2026, 6:20 AM ET / 10:20 UTC. Summary Reproducibility: yes. for the review finding: source inspection shows the new cache-only loader applies Review metrics: 2 noteworthy metrics.
Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Mantis proof suggestion Risk before merge
Maintainer options:
Next step before merge
Security Review findings
Review detailsBest possible solution: Preserve the existing Vertex fallback in the cache-only hydration path, keep the latest highlight regression fix, and require redacted live menu/runtime proof before merge. Do we have a high-confidence way to reproduce the issue? Yes for the review finding: source inspection shows the new cache-only loader applies Is this the best way to solve the issue? No, not merge-ready yet. The performance direction is plausible, but the cache-only loader should preserve the existing Vertex fallback and the PR still needs real after-fix menu/runtime proof. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model gpt-5.5, reasoning high; reviewed against afe4e802239f. Label changesLabel changes:
Label justifications:
Evidence reviewedWhat I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: eab7936d5a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| var daily = CostUsageScanner.loadDailyReport( | ||
| provider: provider, | ||
| since: since, | ||
| until: until, | ||
| now: now, | ||
| options: options) |
There was a problem hiding this comment.
Preserve Vertex fallback when hydrating cache
When Vertex AI is enabled while Claude is also enabled, allowVertexClaudeFallback is false, so this cache-only hydration reads only .vertexAIOnly. The full token loader immediately retries with .all when that report is empty, which covers existing/legacy Claude log caches without Vertex provider tags; this new menu-hydration path skips that retry, so Vertex cost history shows the loading/empty state until the slower revalidation scan finishes even though usable cached data exists.
Useful? React with 👍 / 👎.
Stale entry caused first hover after reopen to skip setHighlighted(true) when the same row was highlighted last.
|
Here is the proof of that working: https://youtu.be/SANjIeV_FoQ |
|
+1. Since last week, CodexBar has become nearly unusable. Even exiting takes around 5 seconds, and switching between tabs is extremely slow. |
|
Thanks for the performance work here. I pulled out one narrower piece from this PR and landed it separately on main: ca63a8e7 What landed:
I am leaving this PR open for now rather than merging the whole branch; it is still useful as an ideas branch for smaller follow-up extractions. |
Summary
Reduce menu lag observed on local machine. Branch bundles several main-thread cost reductions and adds a stall monitor to surface remaining hot spots.
StatusItemController+MenuRefreshScheduling.swift) so rapid usage updates collapse into one rebuild instead of N.StatusItemController+MenuPopulation.swift,+MenuSizing.swift,+MenuPrewarming.swift,+MenuHighlighting.swift,+TokenCostDeferral.swift,+TokenCostHydration.swift,+SwitcherMenuItems.swift) — keeps+Menu.swiftsmaller and avoids redundant work during open.MenuCardHighlightingview receivesetHighlighted(_:), tracked viahighlightedMenuItems(was O(items) per move; now O(1)).UsageStore+TokenCostDeferral.swift,UsageStore+TokenCostScheduling.swift,UsageStore+TokenCost.swift).PiSessionCostScanner/CostUsageScannerto shrink JSONL re-scan overhead.MainRunLoopStallMonitor+StatusItemController+StallMonitoring.swiftto log main-runloop stalls ≥ 350 ms with menu/refresh metadata.Commands run
swift test— 3103/3103 tests pass.make check— 0 SwiftFormat/SwiftLint violations across 984 files.CODEXBAR_SIGNING=adhoc ./scripts/package_app.sh release+./scripts/launch.sh— app packages and stays running.Test plan
main runloop stall detectedwarnings in Console.Notes
Built locally with ad-hoc signing (no Developer ID identity on the contributor machine). Upstream release signing path unchanged.