Skip to content

Fix app hang from uncached menu localization lookups - #3053

Open
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/app-hang-uncached-localization
Open

sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/app-hang-uncached-localization

Conversation

@sentry

@sentry sentry Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR addresses an app hang issue (APPLE-MACOS-31G) caused by repeated, uncached localization lookups during menu command rendering.

The osaurusApp.body getter, which defines the application's menu commands, was re-evaluated frequently due to observed singletons (ThemeManager, VADService, SpeechModelManager) and @AppStorage changes. Each re-evaluation involved numerous calls to L(), which performs a fresh bundle lookup for every string. This cumulative overhead led to main-thread stalls exceeding 3 seconds.

The fix replaces all instances of L("...") with LCached("...") for fixed string literals within osaurusApp.swift's menu command definitions. LCached() memoizes the localized strings, ensuring that subsequent lookups for the same key are served from a cache rather than re-querying the localization bundle. This significantly reduces the CPU overhead during menu re-renders, preventing the app hang. Dynamic labels (e.g., agent names, schedule names) remain uncached as LCached() is intended for a fixed set of keys.

Changes

  • Behavior change
  • UI change (screenshots below)
  • Refactor / chore
  • Tests
  • Docs

Test Plan

Verify that the app no longer experiences hangs or significant main-thread stalls when menu commands are re-rendered frequently. Observe reduced CPU overhead during menu interactions.

Screenshots

N/A

Checklist

  • I have read CONTRIBUTING.md
  • I added/updated tests where reasonable
  • I updated docs/README as needed
  • I verified build on macOS with Xcode 16.4+

Fixes APPLE-MACOS-31G

@sentry <feedback>: Autofix iterates on these changes
@sentry stop iterating: Autofix stops iterating on this run

This PR was automatically generated by Sentry at no cost. You can adjust this setting at any time.

@github-actions github-actions Bot added the bug Something isn't working label Oct 8, 2026

This branch has not been deployed

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

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants