fix: enforce single menu bar instance #47

Merged
wmc merged 1 commit from codex/single-instance-menu-bar into main 2026-06-23 12:36:14 +00:00
Owner

Summary:

  • claim an exclusive per-user launch lock before loading AppStore so duplicate launches do not initialize app state
  • keep the launch lock for the process lifetime and fall back to lower-PID ownership for older running copies
  • add regression coverage for lock exclusivity, release/reacquire, duplicate termination, older-instance fallback, and XCTest bypass
  • document duplicate-launch behavior in README and TODO

Verification:

  • DEVELOPER_DIR=/Applications/Xcode-beta.app/Contents/Developer xcodebuild test -project CodexModelSwitcher.xcodeproj -scheme CodexModelSwitcher -destination platform=macOS -derivedDataPath /tmp/CodexModelSwitcher-DerivedData-single-instance CODE_SIGNING_ALLOWED=NO -only-testing:CodexModelSwitcherTests/AppInstanceGateTests
  • DEVELOPER_DIR=/Applications/Xcode-beta.app/Contents/Developer scripts/verify.sh
  • git diff --check
  • Runtime check: after rebuilding Release, open app then open -n app left exactly one CodexModelSwitcher process running.
Summary: - claim an exclusive per-user launch lock before loading AppStore so duplicate launches do not initialize app state - keep the launch lock for the process lifetime and fall back to lower-PID ownership for older running copies - add regression coverage for lock exclusivity, release/reacquire, duplicate termination, older-instance fallback, and XCTest bypass - document duplicate-launch behavior in README and TODO Verification: - DEVELOPER_DIR=/Applications/Xcode-beta.app/Contents/Developer xcodebuild test -project CodexModelSwitcher.xcodeproj -scheme CodexModelSwitcher -destination platform=macOS -derivedDataPath /tmp/CodexModelSwitcher-DerivedData-single-instance CODE_SIGNING_ALLOWED=NO -only-testing:CodexModelSwitcherTests/AppInstanceGateTests - DEVELOPER_DIR=/Applications/Xcode-beta.app/Contents/Developer scripts/verify.sh - git diff --check - Runtime check: after rebuilding Release, `open app` then `open -n app` left exactly one CodexModelSwitcher process running.
wmc merged commit 8db5e86a2a into main 2026-06-23 12:36:14 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
wmc/CodexModelSwitcher!47
No description provided.