Skip to content

fix: skip unchanged status-item image applies - #1110

Merged
robinebers merged 1 commit into
mainfrom
cursor/skip-unchanged-status-item-image
Aug 14, 2026
Merged

robinebers merged 1 commit into
mainfrom
cursor/skip-unchanged-status-item-image

Conversation

@robinebers

Copy link
Copy Markdown
Owner

Fixes #1039.

TL;DR

The menu-bar strip no longer re-applies a memoized NSImage to the status item when the instance has not changed, so unchanged renders skip the WindowServer redraw.

What was happening

  • MenuBarStripRenderer.image(for:) already memos by content and returns the same NSImage instance when the strip has not changed.
  • StatusItemImageUpdater.update() still called apply(image) on every observation-driven render, including cache hits.
  • Setting the same image on the status-item button still costs a full status-item redraw through WindowServer (especially expensive on macOS 27 beta).

What this changes

  • update() remembers the last applied instance and skips apply when it is unchanged.
  • The 50ms observation coalesce is left alone. Widening it to 250ms would cap the loop at 4 Hz but also delay real strip changes (including the screen-share privacy swap) — a product/UX tradeoff, not required for the redundant-apply bug.
  • MenuBarStripMemoTests now covers the skip-apply gate against the existing memoized-instance contract.

Heads-up

Tests

  • Added testUnchangedMemoizedImageIsNotApplied and testChangedImageIsApplied on the existing MenuBarStripMemoTests path.
  • This environment is Linux, so swift test could not be run locally. CI on macos-26 is the compile/test gate.

Screenshots

Not applicable — no visual change; this only skips redundant status-item image sets.

Open in Web Open in Cursor 

The renderer already returns the same memoized NSImage when content
has not changed, but the updater still set the status-item button
every time. That forces a WindowServer redraw even for a no-op set.

Leave the 50ms observation coalesce alone; skip-apply is the
unambiguous fix for the redundant redraws.

Co-authored-by: Robin Ebers <[email protected]>
@robinebers
robinebers marked this pull request as ready for review August 14, 2026 05:26
@github-actions github-actions Bot added the tests label Aug 14, 2026
@robinebers
robinebers merged commit 86b5af4 into main Aug 14, 2026
3 checks passed
@robinebers
robinebers deleted the cursor/skip-unchanged-status-item-image branch August 14, 2026 05:30
kaanmertkoc pushed a commit to kaanmertkoc/openusage that referenced this pull request Aug 14, 2026
…bers#1110)

The renderer already returns the same memoized NSImage when content
has not changed, but the updater still set the status-item button
every time. That forces a WindowServer redraw even for a no-op set.

Leave the 50ms observation coalesce alone; skip-apply is the
unambiguous fix for the redundant redraws.

Co-authored-by: Cursor Agent <[email protected]>
(cherry picked from commit 86b5af4)
mstallone added a commit to mstallone/runway that referenced this pull request Sep 5, 2026
<!-- CURSOR_AGENT_PR_BODY_BEGIN -->
## TL;DR

Selective re-implementation of the new upstream OpenUsage commits that
still apply on Runway: Codex auto-review stays a first-class model in
spend breakdowns and prices as GPT-5.6 Luna from 2026-07-09, and Grok
CLI's `grok-proxy` slug resolves to Grok Build.

## What was happening

- Upstream has moved on since the last port wave (Runway #101–#108).
Each new OpenUsage commit was reviewed against Runway's architecture,
existing ports, and the "don't bloat" bar.
- Codex still replaced `codex-auto-review` with its dated GPT fallback
before aggregation (openusage robinebers#1085), so the breakdown showed gpt-5.5
instead of auto-review.
- That fallback table still stopped at gpt-5.5 (openusage robinebers#1125). OpenAI
moved auto-review onto GPT-5.6 Luna on 2026-07-09, so every auto-review
event since July was priced 25× too high.
- Grok CLI now logs `grok-proxy` for Grok Build (openusage robinebers#1123); that
slug had no alias, so those tokens were dropped from the spend tiles.

## What this changes

- Parser keeps the measured `codex-auto-review` slug and stores the
dated GPT fallback on `Event.pricingModel` only for cost. Aggregation
keys the rate cache by both slugs so a day that spans the Luna cutoff
does not reuse the first event's rates.
- Adds `("2026-07-09", "gpt-5.6-luna")` at the top of the auto-review
fallback table (ours; ccusage's snapshot still stops at gpt-5.5). Bumps
the Codex JSONL cache schema to 2 so already-remapped events are
reparsed.
- Aliases `grok-proxy` → `grok-build-0.1` and stamps `updated_at` with a
same-day ISO timestamp so the feed wins over today's date-only cache.
- Documents the auto-review identity/pricing split on the Codex
spend-tiles page.

## Heads-up

Reviewed and **not** ported, with reasons:

- **openusage robinebers#1116 / robinebers#1127** (mandatory daily analytics ping, PostHog
bump) — Runway removed analytics in #9.
- **openusage robinebers#1111 / robinebers#1106** (scroll / reorder / SVG parse) — Runway
already has `ReorderFrameStore`, parsed-once `ProviderMark`, row-local
reorder gestures, and the rebuilt popover scroll path. Taking their
patch would duplicate and fight that work.
- **openusage robinebers#1033** (Reset All Settings) — Runway already has Reset
All Customization; a second Settings-wide reset is extra surface, and
earlier port waves already skipped it.
- **openusage robinebers#1128** (Sparkle 2.9.5 → 2.9.6) — relevant security bump,
but this environment cannot refresh `Package.resolved`'s `originHash`.
Dependabot is already scheduled weekly; worth a dedicated follow-up.
- Pricing/provider commits through robinebers#1112, robinebers#1108, robinebers#1110, robinebers#1109, robinebers#1105,
robinebers#1103, robinebers#1101, robinebers#1097, robinebers#1093, robinebers#1089, robinebers#1087, robinebers#1050, robinebers#1019, robinebers#1082 are
already in `main`.

## Tests

- New parser tests: auto-review lines keep the slug; post-2026-07-09
lines price as Luna; the 2026-07-08/09 boundary stays gpt-5.5.
- New aggregation tests: breakdown shows `codex-auto-review` while
costing the fallback; Luna and gpt-5.5 auto-review events on either side
of the cutoff keep independent rates (guards the rate-cache key).
- `grok-proxy` resolves to the same rates as `grok-build-0.1`.
- This environment is Linux, so `swift test` could not be run here. CI
on `macos-26` is the compile/test gate.
<!-- CURSOR_AGENT_PR_BODY_END -->

<div><a
href="https://cursor.com/agents/bc-28a06551-9894-4f4b-ac34-9d5daf6e62b1?cursor_ref=pr_footer&cursor_cta=open_in_web"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://cursor.com/assets/images/open-in-web-dark.png"><source
media="(prefers-color-scheme: light)"
srcset="https://cursor.com/assets/images/open-in-web-light.png"><img
alt="Open in Web" width="114" height="28"
src="https://cursor.com/assets/images/open-in-web-dark.png"></picture></a>&nbsp;<a
href="https://cursor.com/background-agent?bcId=bc-28a06551-9894-4f4b-ac34-9d5daf6e62b1&cursor_ref=pr_footer&cursor_cta=open_in_cursor"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://cursor.com/assets/images/open-in-cursor-dark.png"><source
media="(prefers-color-scheme: light)"
srcset="https://cursor.com/assets/images/open-in-cursor-light.png"><img
alt="Open in Cursor" width="131" height="28"
src="https://cursor.com/assets/images/open-in-cursor-dark.png"></picture></a>&nbsp;</div>

Co-authored-by: Cursor Agent <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fixes menu-bar strip re-renders at up to 20 Hz and re-applies unchanged images (40-60% CPU on macOS 27 beta)

2 participants