Skip to content

Fix menu open refresh delay - #1398

Merged
steipete merged 2 commits into
steipete:mainfrom
joshuavial:jv/xc-htvhl-instant-menu-open
Jun 10, 2026
Merged

Fix menu open refresh delay#1398
steipete merged 2 commits into
steipete:mainfrom
joshuavial:jv/xc-htvhl-instant-menu-open

Conversation

@joshuavial

Copy link
Copy Markdown
Contributor

Summary

  • keep cached menu contents attached for instant menu-bar opens after data-only refresh invalidations
  • schedule the stale data refresh/rebuild asynchronously while the menu remains visible
  • preserve cached quota/card metrics with a Refreshing indicator instead of blanking the card
  • keep localization/config structure changes rebuilding when they must update visible labels

Tests

  • ./Scripts/lint.sh lint
  • swift test --filter MenuCardSubtitleTests
  • swift test --filter StatusMenuOpenRefreshTests
  • swift test --filter StatusMenuInstantOpenTests
  • swift test --filter StatusMenuClosedPreparationTests
  • swift test --filter StatusMenuLocalizationRefreshTests
  • swift test --filter StatusMenuTests
  • swift test (fails only in MiniMaxMenuCardModelTests: locale formats Renews as 18 May 2027 while the test expects May 18, 2027)

Bead: xc-htvhl (RCA + fix the menu-bar click delay (instant cached render, async refresh))

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9bd187d0d3

ℹ️ 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".

"storeRefreshing": self.store.isRefreshing ? "1" : "0",
])
#endif
self.deferMenuInteractionRefreshIfNeeded()

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Avoid queuing duplicate refreshes after cached opens

When a background store update has already completed while the menu was closed, it invalidates with allowStaleContentDuringDataRefresh and leaves menuVersion < menuContentVersion but menuVersion >= latestRequiredMenuRebuildVersion; opening that cached menu now enters this preservation path even though no refresh is in flight. This unconditional call sets deferredMenuInteractionRefreshPending, so menuDidClose later schedules scheduleDeferredMenuInteractionRefreshIfNeeded, which calls performStoreRefresh again despite the async open-menu rebuild already rendering the fresh data. In the common “background refresh completed, user opens then closes menu” path this causes an unnecessary second provider refresh/network scrape.

Useful? React with 👍 / 👎.

@steipete
steipete force-pushed the jv/xc-htvhl-instant-menu-open branch from 9bd187d to 0174897 Compare June 10, 2026 22:16

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 01748970b5

ℹ️ 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".

Comment on lines +1180 to +1184
let stillNeedsRetry = retryProviders.contains {
self.store.isStale(provider: $0) || self.store.snapshot(for: $0) == nil
}
if !stillNeedsRetry {
self.clearSatisfiedDeferredMenuInteractionRefreshes(for: retryProviders)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve deferred retry after failed coalesced refresh

When the menu opens while a full store refresh is already in progress, the call to deferMenuInteractionRefreshIfNeeded above is a no-op because that helper returns while store.isRefreshing is true. If the coalesced provider refresh then finishes with an error or still has no snapshot, stillNeedsRetry is true here, but this branch only clears on success and never records the pending retry after the in-flight refresh has ended. In that scenario, closing the menu no longer schedules the retry that the stale/missing card needs, leaving the user stuck until the next timer/manual refresh.

Useful? React with 👍 / 👎.

@steipete
steipete merged commit 3c2d53d into steipete:main Jun 10, 2026
4 checks passed
@steipete

Copy link
Copy Markdown
Owner

Landed in 3c2d53de57c118149b8511abb333aebb01cdf327.

Verification:

  • make check
  • swift test — 3,520 tests in 401 suites passed
  • Focused suites: StatusMenuInstantOpenTests (26), StatusMenuTokenAccountSwitcherTests (6), CodexAccountScopedRefreshTests (76)
  • Final autoreview: /Users/steipete/Projects/agent-skills/skills/autoreview/scripts/autoreview --mode branch --base origin/main --stream-engine-output — clean; no accepted/actionable findings
  • Live packaged-app QA with Peekaboo: 8 repeated merged-menu opens completed in 0.15–0.20s; cached Overview/Claude menu rendered without a blank or blocked menu
  • Exact-head CI on 01748970b5a9208240c08fa39d87affba5df6259: GitGuardian, macOS lint/build/full tests, Linux x64 CLI, and Linux arm64 CLI all passed

Caveat: the installed gh has no image uploader, so the local visual proof could not be attached; screenshot: /tmp/codexbar-pr1398-overview.png.

Thanks @joshuavial!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants