Skip to content

fix(macos): patch NSApplication for macOS 26 Tahoe drag crash#403

Open
a5af wants to merge 1 commit intomainfrom
fix/macos26-cef-drag-crash
Open

fix(macos): patch NSApplication for macOS 26 Tahoe drag crash#403
a5af wants to merge 1 commit intomainfrom
fix/macos26-cef-drag-crash

Conversation

@a5af
Copy link
Copy Markdown
Member

@a5af a5af commented Apr 15, 2026

Summary

  • CEF 146 calls private NSApplication selectors (isHandlingSendEvent, setEffectiveAppearance:, etc.) that were removed in macOS 26 Tahoe, causing EXC_BREAKPOINT crashes whenever the user drags a pane or the window
  • Injects +resolveInstanceMethod: into NSApplication's metaclass so unknown selectors get typed stubs before the ___forwarding___ machinery is invoked
  • isHandlingSendEvent and similar BOOL guard getters return 0 (NO) — returning truthy blocked CEF's sendEvent: routing and broke window drag
  • All other missing selectors get a void stub
  • 100% macOS-only (#[cfg(target_os = "macos")]); no impact on Windows or Linux

Also included (macOS bring-up work from this session):

  • package:macos task — builds .app bundle + DMG
  • cef:bundle:darwin task — copies CEF framework, sidecar, frontend into dist/cef/
  • --use-mock-keychain Chromium switch to suppress the macOS Keychain dialog on first launch
  • NativeKeyEvent type alias fix (cef::sys::MSG is Windows-only, broke macOS compile)
  • framework_dir_path / resources_dir_path set to CEF .framework/Resources on macOS (fixes icudtl.dat not found in bundle crash)

Test plan

  • task dev launches on macOS 26 Tahoe without Keychain prompt
  • Dragging a pane to rearrange within a window works without crash
  • Dragging the window by its title bar works without crash
  • Windows build unaffected (patch is #[cfg(target_os = "macos")] only)
  • Check logs for macOS 26 compat: lines on startup to confirm stubs are registered

🤖 Generated with Claude Code

CEF 146 calls private NSApplication selectors (isHandlingSendEvent,
setEffectiveAppearance:, etc.) that were removed in macOS 26 Tahoe.
The crash path goes through ___forwarding___ which corrupts state if
doesNotRecognizeSelector: returns normally instead of throwing.

Fix: inject +resolveInstanceMethod: into NSApplication's metaclass so
unknown selectors get typed stubs before the forwarding machinery runs.
isHandlingSendEvent and similar BOOL guards return 0 (NO) — returning
truthy blocks CEF's sendEvent: routing and breaks window drag.
All other unknown selectors get a void stub.

Also includes:
- macOS packaging task (package:macos) — builds .app + DMG
- macOS CEF bundle task (cef:bundle:darwin) — copies framework, sidecar, frontend
- --use-mock-keychain switch to suppress macOS Keychain dialog
- NativeKeyEvent type alias fix (cef::sys::MSG is Windows-only)
- macOS framework_dir_path / resources_dir_path pointing into CEF .framework

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown

@reagentx-workflow reagentx-workflow Bot left a comment

Choose a reason for hiding this comment

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

ReAgent Diagnostics
Field Value
ReAgent Version 5.12.5
Trigger PR opened
Project Context CLAUDE.md loaded
Model claude-opus-4-6
Effort high
Ref Repos Disabled
Merge Analysis Clean
Review Time 60.0s
Timestamp 2026-04-15T10:05:26Z
Repository agentmuxai/agentmux
PR #403

Issues:

  • package.json:3 - Version downgrade detected: 0.33.180 → 0.33.169. Branch appears to be based on a stale commit. Rebase on main and bump to next version.
  • Taskfile.yml:111 - CFBundleIdentifier includes the version (ai.agentmux.app.v0-33-169). macOS uses bundle ID to track app identity across updates — permissions, dock position, notification settings, and Gatekeeper state will reset on every version bump. Use a stable ID like ai.agentmux.app.
  • agentmux-cef/src/main.rs:379 - resolve_instance_method_impl unconditionally stubs ALL unrecognized selectors on NSApplication, not just the known CEF ones. This silently swallows legitimate doesNotRecognizeSelector: errors, masking real bugs. Guard with an allowlist of known CEF selectors and fall through (return 0) for anything else.

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