Skip to content

crash: SIGABRT in on_new_window handler when WebKit triggers OAuth/SSO popup (createNewPage) #845

Description

@ipchanwang

Summary

ORG2 v1.2.6 crashes with SIGABRT (Abort trap: 6) on macOS when WebKit's SOAuthorizationCoordinator triggers a new-window/popup request during an OAuth or SSO authorization flow inside a Tauri/Wry webview.

Environment

Key Value
App version 1.2.6
Platform macOS 26.6.1 (25G76), ARM-64
Hardware Mac14,7 (MacBook Pro M2, 8 GB)
Tauri 2.10.3
Wry 0.54.4

Steps to Reproduce

  1. Open ORG2 v1.2.6 on macOS.
  2. Trigger an OAuth/SSO login flow inside the app (e.g. Claude Code OAuth, Codex OAuth, Cursor session capture, or any inline webview page that opens a popup for third-party authentication such as "Continue with Google").
  3. The app crashes approximately 4–5 minutes after launch.

Expected Behavior

The OAuth popup or new-window request should be handled gracefully — either by opening a host-managed popup window, denying the request and falling back to an external browser, or navigating within the existing webview.

Actual Behavior

The app crashes immediately with SIGABRT. The crash is triggered on the main thread by an uncaught Rust panic that propagates through abort().

Crash Analysis

Crash stack (Thread 0 — main thread, abbreviated)

0  libsystem_kernel.dylib     __pthread_kill + 8
1  libsystem_pthread.dylib    pthread_kill + 296
2  libsystem_c.dylib          abort + 148
3  org2                       (Rust panic handler)
4  org2                       (Rust panic handler)
5–25 org2                     (Tauri/Wry webview event handling → window creation)
26 WebKit                     UIDelegate::UIClient::createNewPage(...)
27 WebKit                     SOAuthorizationCoordinator::tryAuthorize(...)
28–31 WebKit/JavaScriptCore   RunLoop dispatch
32–45 CoreFoundation/AppKit   CFRunLoop → NSApplication event loop

Root cause

  1. WebKit initiates a new-page request via createNewPage during an SSO/OAuth authorization flow (SOAuthorizationCoordinator::tryAuthorize).
  2. Tauri/Wry dispatches the request to the Rust on_new_window callback registered on the webview.
  3. The Rust handler panics — likely due to an unwrap() or expect() on a fallible operation (e.g. WebviewWindowBuilder::build() failure, URL parse error, or window-handle lookup returning None).
  4. Since the panic is uncaught in the release binary, it calls abort(), producing SIGABRT.

Suspect code paths

The following files register on_new_window handlers that construct popup windows and could panic on error:

  • src-tauri/src/agent_sessions/cli/platform_adapters/claude_code/oauth.rs (lines 182–275)
  • src-tauri/src/agent_sessions/cli/platform_adapters/codex/oauth.rs (lines 150–215)
  • src-tauri/src/agent_sessions/cli/platform_adapters/cursor/session_capture.rs (line 214)
  • src-tauri/crates/browser/src/inline.rs (line 279)

All four handlers return NewWindowResponse::Create { window } or NewWindowResponse::Deny, but in some error paths the builder construction may panic before reaching the match builder.build() guard.

Suggested Fix

  1. Wrap all fallible operations inside on_new_window closures with match / if let instead of unwrap() / expect(). Any failure should log a warning and return NewWindowResponse::Deny.
  2. Install a catch_unwind guard at the FFI boundary between WebKit's createNewPage callback and Rust, so that a panic does not propagate into abort().
  3. Add a fallback path that opens the authorization URL in the system default browser (tauri_plugin_shell::ShellExt::shell().open(...)) when the in-app popup cannot be created.

Workaround

  • Authenticate CLI agents (Claude Code, Codex, Cursor) via their respective CLI tools in an external terminal (claude login, codex login, etc.) before launching ORG2. The app will pick up the persisted credentials without needing an in-app OAuth webview.
  • Avoid visiting pages that trigger SSO popups inside the inline browser; copy the URL and open it in Safari/Chrome instead.

Full Crash Report

Click to expand the full macOS crash report
Process:             org2 [31456]
Path:                /Applications/ORG2.app/Contents/MacOS/org2
Identifier:          yorg.orgii
Version:             1.2.6 (1.2.6)
Code Type:           ARM-64 (Native)

Date/Time:           2026-08-20 15:53:18.2547 +0800
Launch Time:         2026-08-20 15:48:54.6921 +0800
OS Version:          macOS 26.6.1 (25G76)

Exception Type:      EXC_CRASH (SIGABRT)
Termination Reason:  Namespace SIGNAL, Code 6, Abort trap: 6

Application Specific Information:
abort() called

Thread 0 Crashed:: main Dispatch queue: com.apple.main-thread
0   libsystem_kernel.dylib         __pthread_kill + 8
1   libsystem_pthread.dylib        pthread_kill + 296
2   libsystem_c.dylib              abort + 148
3   org2                           0x104afffd8
4   org2                           0x104affdcc
5   org2                           0x10442cfac
...
26  WebKit                         UIDelegate::UIClient::createNewPage(...) + 704
27  WebKit                         SOAuthorizationCoordinator::tryAuthorize(...)::$_0 + 308

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions