Skip to content

Conversation

@ibehnam
Copy link
Contributor

@ibehnam ibehnam commented Jan 5, 2026

Summary

This PR addresses UI lag and responsiveness issues during app startup by moving several blocking operations from the main thread to background tasks.

Key Changes

  • Async Binary Resolution: UsageStore now resolves binary paths (which involves spawning interactive shells) in a detached background task.
  • Background Keychain Migration: Moved KeychainMigration.migrateIfNeeded() to an async task in HiddenWindowView to prevent blocking the app's init.
  • Lazy Status Items: Refactored StatusItemController to create NSStatusItems only when needed (lazily), reducing IPC overhead with the system status bar during launch.
  • Thread Safety: Ensured UI updates from background tasks are properly dispatched to the @MainActor.

Test plan

  • Verified that the app launches instantly and the menu bar icons appear without freezing the main thread.
  • Confirmed that binary resolution and version detection still work as expected in the background.
  • Ran ./Scripts/compile_and_run.sh with CODEXBAR_SIGNING=adhoc to verify local execution.

🤖 Generated with Claude Code

…ckground tasks\n\n- Move keychain migration to a detached background task\n- Make path debug info resolution async and deferred\n- Implement lazy initialization for NSStatusItems to reduce IPC overhead on startup\n\n🤖 Generated with [Claude Code](https://claude.com/claude-code)\n\nCo-Authored-By: Claude <noreply@anthropic.com>
Copy link

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

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: e9631e0ef3

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +302 to +306
Task.detached(priority: .userInitiated) { [weak self] in
await self?.refreshPathDebugInfo()
}
LoginShellPathCache.shared.captureOnce { [weak self] _ in
Task { @MainActor in self?.refreshPathDebugInfo() }
Task { @MainActor in

Choose a reason for hiding this comment

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

P2 Badge Prevent stale path snapshot overwriting login PATH data

The new async refresh runs twice with no ordering: a detached refreshPathDebugInfo() starts immediately (before LoginShellPathCache has a value), and then captureOnce triggers a second refresh after the login PATH is captured. Because both tasks race, the first (potentially slow) refresh can finish after the login-PATH refresh and overwrite pathDebugInfo with a snapshot that has loginShellPATH/binary paths missing. This shows up in the Debug preferences as missing binaries or empty login PATH when shell resolution is slow. Consider gating the early refresh, canceling it when captureOnce finishes, or only overwriting when the snapshot includes loginShellPATH.

Useful? React with 👍 / 👎.

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.

1 participant