CodexBar icon indicating copy to clipboard operation
CodexBar copied to clipboard

v0.37.0 repeatedly crashes on macOS 27 with _swift_task_checkIsolatedSwift SIGTRAP

Open xiehaibin18 opened this issue 5 months ago β€’ 7 comments

Description

CodexBar 0.37.0 (build 90) repeatedly crashes and the menu bar item disappears. macOS generated 27 CodexBar crash reports during several short bursts on the same day.

The latest reports all share the same failure shape:

  • EXC_BREAKPOINT / SIGTRAP
  • Trace/BPT trap: 5
  • faulting queue: com.apple.root.utility-qos
  • top frames go through _dispatch_assert_queue_fail and _swift_task_checkIsolatedSwift

I did not find TCC or sandbox permission denial messages around the crash windows, so this does not look like a permission prompt or missing entitlement issue from the local logs. It looks more like a Swift executor / queue isolation assertion.

Environment

  • CodexBar: 0.37.0 build 90
  • macOS: 27.0 (26A5353q)
  • Architecture: Apple Silicon / ARM-64
  • Model identifier: Mac16,10
  • App path: /Applications/CodexBar.app/Contents/MacOS/CodexBar

Crash frequency

Crash report count from DiagnosticReports and DiagnosticReports/Retired:

5 reports at 21:12
19 reports at 21:20
1 report  at 21:49
2 reports at 21:50

Times above are local time, UTC+8.

Latest crash report excerpts

These are sanitized excerpts. Full .ips files also contain incident IDs, local host/user fields, and crash reporter identifiers, so I am not pasting them inline.

captureTime=2026-06-20 21:49:54.6255 +0800
procLaunch=2026-06-20 21:29:38.5291 +0800
app=CodexBar 0.37.0 build 90
os=macOS 27.0 (26A5353q)
model=Mac16,10 arch=ARM-64
exception=EXC_BREAKPOINT / SIGTRAP
termination=SIGNAL Trace/BPT trap: 5
faultingThread=5
queue=com.apple.root.utility-qos
  _dispatch_assert_queue_fail
  dispatch_assert_queue$V2.cold.1
  dispatch_assert_queue
  _swift_task_checkIsolatedSwift
  swift_task_isCurrentExecutorWithFlagsImpl(swift::SerialExecutorRef, swift::swift_task_is_current_executor_flag)
  <CodexBar app frame>
  <CodexBar app frame>
  _dispatch_client_callout
  _dispatch_continuation_pop
  _dispatch_source_latch_and_call
  _dispatch_source_invoke
  _dispatch_root_queue_drain_deferred_item

captureTime=2026-06-20 21:50:05.9573 +0800
procLaunch=2026-06-20 21:49:54.5587 +0800
exception=EXC_BREAKPOINT / SIGTRAP
faultingThread=7
queue=com.apple.root.utility-qos
  _dispatch_assert_queue_fail
  dispatch_assert_queue$V2.cold.1
  dispatch_assert_queue
  _swift_task_checkIsolatedSwift
  swift_task_isCurrentExecutorWithFlagsImpl(swift::SerialExecutorRef, swift::swift_task_is_current_executor_flag)
  <CodexBar app frame>
  <CodexBar app frame>
  _dispatch_client_callout
  _dispatch_continuation_pop
  _dispatch_source_latch_and_call
  _dispatch_source_invoke
  _dispatch_root_queue_drain_deferred_item

captureTime=2026-06-20 21:50:15.5090 +0800
procLaunch=2026-06-20 21:50:05.9016 +0800
exception=EXC_BREAKPOINT / SIGTRAP
faultingThread=6
queue=com.apple.root.utility-qos
  _dispatch_assert_queue_fail
  dispatch_assert_queue$V2.cold.1
  dispatch_assert_queue
  _swift_task_checkIsolatedSwift
  swift_task_isCurrentExecutorWithFlagsImpl(swift::SerialExecutorRef, swift::swift_task_is_current_executor_flag)
  <CodexBar app frame>
  <CodexBar app frame>
  _dispatch_client_callout
  _dispatch_continuation_pop
  _dispatch_source_latch_and_call
  _dispatch_source_invoke
  _dispatch_root_queue_drain_deferred_item

One of the crash reports also contains thread state mentioning OS_dispatch_source.MemoryPressureEvent, and the visible stack includes dispatch source handling. That may be related, but I am treating it as a clue rather than a confirmed root cause.

Expected behavior

CodexBar should remain running and keep the menu bar item available.

Actual behavior

The CodexBar main process terminates repeatedly with EXC_BREAKPOINT / SIGTRAP, and the menu bar item disappears. The widget extension may still be present, but the main app is no longer running.

Additional context

Searches for existing issues with _swift_task_checkIsolatedSwift, dispatch_assert_queue, and MemoryPressureEvent did not find a matching report at the time of filing. I did find other v0.37.0 macOS 27 menu/performance reports, but not this crash signature.

xiehaibin18 avatar Jun 20 '26 14:06 xiehaibin18

Codex review: keeping this open for maintainer follow-up; there is still a little grit to resolve. Reviewed June 20, 2026, 10:11 AM ET / 14:11 UTC.

Summary Current main appears to contain the merged fix for the reported memory-pressure Swift isolation crash, but I would keep this issue open under the repository’s conservative onboarding profile and because the latest public release is still v0.37.0, which predates the fix.

Reproducibility: yes. for the shipped v0.37.0 code path: the tag shows the memory-pressure DispatchSource callback registered on a utility queue from a MainActor-isolated monitor, and the report plus merged fix PR match that crash shape. I did not establish a failing current-main path because current main has replaced that handler boundary.

Next step No repair PR is needed because the fix is already merged on main; a maintainer should decide whether to keep this open until a fixed release ships or close it under repository policy.

Review details

Best possible solution:

Keep the merged main fix, ship it in v0.37.1 or newer, then let a maintainer close this issue once release and repository policy allow.

Do we have a high-confidence way to reproduce the issue?

Yes for the shipped v0.37.0 code path: the tag shows the memory-pressure DispatchSource callback registered on a utility queue from a MainActor-isolated monitor, and the report plus merged fix PR match that crash shape. I did not establish a failing current-main path because current main has replaced that handler boundary.

Is this the best way to solve the issue?

Yes, the merged implementation is the narrow maintainable fix: keep the DispatchSource entry nonisolated and hop to MainActor only for app-state cleanup. The remaining decision is release/closure timing, not a different code direction.

AGENTS.md: found and applied where relevant.

Remaining risk / open question:

  • The fix is on current main but not in the latest public release, so v0.37.0 users can still hit the crash until a fixed build ships.
  • I did not run a macOS 27 live reproduction in this read-only review; the conclusion relies on source history, merged PR proof, and the reported crash signature.

Codex review notes: model internal, reasoning high; reviewed against 3f3e2f4a112a; fix evidence: commit 8c4bdd63f3d6, main fix timestamp 2026-06-20T03:32:54-04:00.

Label changes

Label changes:

  • add P1: The issue reports a latest-release runtime crash loop that makes the menu bar app disappear for a real user.
  • add impact:crash-loop: The report is specifically about repeated process termination and loss of the menu bar item.
  • add issue-rating: 🦞 diamond lobster: Current issue advisory state selects this label.
  • add clawsweeper:source-repro: Current issue advisory state selects this label.
  • add clawsweeper:no-new-fix-pr: Current issue advisory state selects this label.
  • add clawsweeper:fix-shape-clear: Current issue advisory state selects this label.
  • add clawsweeper:needs-maintainer-review: Current issue advisory state selects this label.

Label justifications:

  • P1: The issue reports a latest-release runtime crash loop that makes the menu bar app disappear for a real user.
  • impact:crash-loop: The report is specifically about repeated process termination and loss of the menu bar item.
Evidence reviewed

Acceptance criteria:

  • Confirm a release newer than v0.37.0 contains 8c4bdd63f3d6d1432fcdb50add7ed6988a2b5734.
  • swift test --filter MemoryPressureCacheTrimTests
  • make check

What I checked:

  • Issue report: The report describes 27 CodexBar 0.37.0 build 90 crashes with EXC_BREAKPOINT/SIGTRAP, _swift_task_checkIsolatedSwift, a utility-qos faulting queue, and a visible DispatchSource memory-pressure clue.
  • Current main fix shape: Current main registers the memory-pressure DispatchSource through a nonisolated makeEventHandler helper and then hops to MainActor before touching app state. (Sources/CodexBar/MemoryPressureMonitor.swift:75, 3f3e2f4a112a)
  • v0.37.0 vulnerable shape: The v0.37.0 tag registered an inline memory-pressure event handler on a global utility queue from a MainActor-isolated type, matching the reported crash signature. (Sources/CodexBar/MemoryPressureMonitor.swift:66, 33a5f4362eab)
  • Fix provenance: Commit 8c4bdd63f3d6d1432fcdb50add7ed6988a2b5734 is titled "fix: prevent memory pressure isolation crash (#1668)" and changes MemoryPressureMonitor plus regression coverage. (Sources/CodexBar/MemoryPressureMonitor.swift:66, 8c4bdd63f3d6)
  • Regression coverage: The merged test invokes the generated memory-pressure handler from a utility queue and asserts cleanup runs on the main thread. (Tests/CodexBarTests/MemoryPressureCacheTrimTests.swift:31, 8c4bdd63f3d6)
  • Release provenance: The fixed commit is contained by main but no tag; GitHub releases still show v0.37.0 as latest, so this is current-main-only and not yet shipped in a public release. (CHANGELOG.md:3, 8c4bdd63f3d6)

Likely related people:

  • Zihao-Qi: Authored the merged memory-pressure isolation crash fix and the regression test that exercises the utility-queue callback boundary. (role: fix author; confidence: high; commits: 8c4bdd63f3d6, 384c1b4d7a56, 844b8fdc7cfc; files: Sources/CodexBar/MemoryPressureMonitor.swift, Tests/CodexBarTests/MemoryPressureCacheTrimTests.swift, CHANGELOG.md)
  • ProspectOre: Authored the merged PRs that introduced MemoryPressureMonitor and expanded memory-pressure cache trimming shortly before the crash fix. (role: introduced behavior and adjacent area contributor; confidence: high; commits: f6f76ff9d01e, 32db84035b55, 4fa89c4bf52e; files: Sources/CodexBar/MemoryPressureMonitor.swift, Sources/CodexBar/CodexbarApp.swift, Sources/CodexBar/StatusItemController+MemoryPressure.swift)
  • steipete: Cut the v0.37.0 release commit, contributed adjacent memory-pressure changes, and posted maintainer verification when the fix landed. (role: recent release and verification owner; confidence: medium; commits: 33a5f4362eab, 8c4bdd63f3d6, 3f3e2f4a112a; files: Sources/CodexBar/MemoryPressureMonitor.swift, CHANGELOG.md, appcast.xml)
How this review workflow works
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

clawsweeper[bot] avatar Jun 20 '26 14:06 clawsweeper[bot]

When will this go live, can't bare having to open all the time.

lmachineone avatar Jun 21 '26 06:06 lmachineone

CodexBar 0.37.0 crashes repeatedly: EXC_BREAKPOINT in _swift_task_checkIsolatedSwift from a dispatch-source callback

Summary

CodexBar 0.37.0 (build 90) crashes repeatedly while running idle in the menu bar. Over ~18 hours I got 10 crash reports, all with an identical stack. Each crash is a Swift-concurrency executor-isolation assertion (EXC_BREAKPOINT / SIGTRAP): a dispatch source callback running on the com.apple.root.utility-qos background queue invokes Swift code that asserts it must run on a specific executor, dispatch_assert_queue fails, and the runtime traps.

This started the same day I updated to 0.37.0 β€” there were zero CodexBar crash reports before 0.37.0, so it looks like a regression.

Environment

CodexBar 0.37.0 (build 90)
macOS 26.5.1 (25F80)
Hardware MacBook Air, Mac17,4, Apple Silicon (arm64)
Min OS macOS 14.0

Frequency

10 identical crashes (local time):

2026-06-20 21:51
2026-06-20 22:51
2026-06-20 22:57
2026-06-20 23:10
2026-06-20 23:38
2026-06-21 09:45
2026-06-21 14:50
2026-06-21 15:20
2026-06-21 15:59
2026-06-21 16:14   ← process launched 16:01, crashed after ~13 min

Intervals are irregular (6 min to many hours), which points at an event-driven dispatch source (timer / file-watch / network refresh) rather than a fixed-interval timer.

Crash type

  • Exception: EXC_BREAKPOINT (SIGTRAP), codes 0x1, 0x...4fc
  • Termination: SIGNAL 5 (Trace/BPT trap)
  • Faulting thread queue: com.apple.root.utility-qos

Faulting stack (thread 10)

0  libdispatch.dylib          _dispatch_assert_queue_fail + 120
1  libdispatch.dylib          dispatch_assert_queue$V2.cold.1 + 116
2  libdispatch.dylib          dispatch_assert_queue + 108
3  libswift_Concurrency.dylib _swift_task_checkIsolatedSwift + 48
4  libswift_Concurrency.dylib swift_task_isCurrentExecutorWithFlagsImpl(...) + 356
5  CodexBar                   0x102f64000 + 0x156590    <-- needs symbolication
6  CodexBar                   0x102f64000 + 0x366b88    <-- needs symbolication
7  libdispatch.dylib          _dispatch_client_callout + 16
8  libdispatch.dylib          _dispatch_continuation_pop + 596
9  libdispatch.dylib          _dispatch_source_latch_and_call + 392
10 libdispatch.dylib          _dispatch_source_invoke + 844
11 libdispatch.dylib          _dispatch_root_queue_drain_deferred_item + 216
12 libdispatch.dylib          _dispatch_kevent_worker_thread + 536
13 libsystem_pthread.dylib    _pthread_wqthread + 348
14 libsystem_pthread.dylib    start_wqthread + 8

Symbolication info (for the two CodexBar frames)

  • Binary UUID: 0e337532-640d-370f-9655-84626e6e9d94
  • arch: arm64, load base: 0x102f64000
  • Frame offsets: 0x156590, 0x366b88

With the matching dSYM:

atos -arch arm64 -o CodexBar.app.dSYM/Contents/Resources/DWARF/CodexBar \
  -l 0x102f64000 0x1030ba590 0x1032cab88

Likely cause

A DispatchSource (or other libdispatch source) handler is installed on a background/global queue (utility QoS), but the handler body calls into code isolated to @MainActor (or another global actor / custom serial executor). Under the Swift 6 concurrency runtime, swift_task_isCurrentExecutor now asserts (traps) instead of silently returning false when the current thread doesn't match the expected executor, so any actor-isolated call from the raw source handler hard-crashes.

Typical fixes:

  • Hop explicitly inside the source handler: Task { @MainActor in … } / await MainActor.run { … }, or
  • Set the source's target queue to the main queue, or
  • Mark the handler closure / called method correctly so it isn't assumed to be on the actor.

Given the utility-qos queue and the irregular cadence, candidates are the background scanners reworked in recent releases (token-cost / session-corpus scanning moved onto dedicated queues in 0.33.x, run-loop/event-tracking changes in 0.35.0).

Happy to provide the full .ips files.

veveup avatar Jun 21 '26 09:06 veveup

Another data point β€” same crash on macOS 26.3.1 (older than the versions reported so far).

Confirming the identical signature on a lower macOS version than the three already reported here (27.0 / 26.5.1 / 26.5 beta), which rules out this being macOS-27-specific:

CodexBar 0.37.0 (build 90)
macOS 26.3.1 (25D771280a)
Hardware Mac14,9 (MacBook Pro 14", Apple Silicon arm64)

9 identical crash reports over ~18h (2026-06-20 22:52 β†’ 2026-06-21 17:03, UTC+8), all with the same stack:

exception   = EXC_BREAKPOINT (SIGTRAP), codes 0x1, 0x...a5c0
termination = SIGNAL 5 (Trace/BPT trap: 5)
queue       = com.apple.root.utility-qos
  _dispatch_assert_queue_fail
  dispatch_assert_queue$V2.cold.1
  dispatch_assert_queue
  _swift_task_checkIsolatedSwift
  swift_task_isCurrentExecutorWithFlagsImpl(...)
  <CodexBar frame>
  <CodexBar frame>
  _dispatch_client_callout β†’ _dispatch_source_latch_and_call β†’ _dispatch_source_invoke

Matches the memory-pressure DispatchSource-on-utility-queue β†’ MainActor-isolated monitor root cause already identified. No crashes before updating to 0.37.0. Looking forward to the 0.37.1 release with the merged fix β€” thanks for the quick diagnosis.

Phat-Po avatar Jun 21 '26 11:06 Phat-Po

I had the same issue and downgraded to 0.36.1 in the meanwhile.

CodexBar is published through the author's personal tap (steipete/tap). Because third-party taps live as real git checkouts on disk – not served by Homebrew's JSON API – you can roll the cask file back to any past release and install that exact version – 0.36.1 in our case:

  • brew tap steipete/tap
    • Clones the author's tap locally so its full version history is available
  • TAP="$(brew --repository steipete/tap)"
    • Stores the tap's path in a variable for the commands that follow
  • git -C "$TAP" checkout 6812fb7542579cea67d004d4bd77b0422c2ad3e5 -- Casks/codexbar.rb
    • Rolls the cask file back to its 0.36.1 revision – this commit is the one that bumped CodexBar to 0.36.1
    • For a different version, swap this hash – find it under https://github.com/steipete/homebrew-tap/commits/main/Casks/codexbar.rb
  • brew uninstall --cask codexbar 2>/dev/null
    • Removes any existing install first to avoid a conflict on the bundled CodexBarCLI symlink (2>/dev/null hides the error if it wasn't installed)
  • HOMEBREW_NO_AUTO_UPDATE=1 brew install --cask --force steipete/tap/codexbar
    • Installs the pinned 0.36.1
    • HOMEBREW_NO_AUTO_UPDATE=1 is essential – without it Homebrew auto-updates the tap, resetting it to the latest commit and undoing the rollback before install
  • git -C "$TAP" checkout HEAD -- Casks/codexbar.rb
    • Restores the cask file to the latest version so future brew update runs stay clean

All commands at once:

brew tap steipete/tap
TAP="$(brew --repository steipete/tap)"
git -C "$TAP" checkout 6812fb7542579cea67d004d4bd77b0422c2ad3e5 -- Casks/codexbar.rb
brew uninstall --cask codexbar 2>/dev/null
HOMEBREW_NO_AUTO_UPDATE=1 brew install --cask --force steipete/tap/codexbar
git -C "$TAP" checkout HEAD -- Casks/codexbar.rb

IsaacCheng9 avatar Jun 21 '26 20:06 IsaacCheng9

Confirming this on macOS 26.5 (25F71) as well, not only macOS 27 β€” CodexBar 0.37.0 (build 90), Apple Silicon.

Identical signature: EXC_BREAKPOINT (SIGTRAP), faulting thread on com.apple.root.utility-qos:

_dispatch_assert_queue_fail
dispatch_assert_queue$V2.cold.1
dispatch_assert_queue
_swift_task_checkIsolatedSwift
swift_task_isCurrentExecutorWithFlagsImpl
CodexBar  (+0x156590)
CodexBar  (+0x366b88)
_dispatch_client_callout
_dispatch_continuation_pop
_dispatch_source_latch_and_call
_dispatch_source_invoke          <- fired from a dispatch source
_dispatch_root_queue_drain_deferred_item
_dispatch_kevent_worker_thread

So the crash is a dispatch-source callback running on a background utility-QoS queue that then calls @MainActor/actor-isolated code β€” Swift 6's dynamic swift_task_isCurrentExecutor check (SE-0423) makes the executor mismatch fatal on macOS 26+ (it only logged a warning on earlier OS). It looks like the periodic usage-refresh poller.

One note that may help triage: it crashes quickly after launch, not on a 30-minute timer β€” the ~30-min spacing you may see in ~/Library/Logs/DiagnosticReports is just ReportCrash deduplicating identical crashes, not the real frequency. Launching the app's Mach-O directly (e.g. via a launchd KeepAlive agent) reproduces it within ~10s reliably.

Happy to attach a full .ips if useful.

markiewiczsergei avatar Jun 21 '26 23:06 markiewiczsergei

Fixed by 8c4bdd63 and shipped in CodexBar 0.37.1.

Release verification completed: notarization/stapling and Gatekeeper checks passed, Sparkle appcast build 91 and its enclosure signature were verified, the app/dSYM and all CLI assets are published, and Homebrew cask/formula 0.37.1 both fetch successfully.

steipete avatar Jun 21 '26 23:06 steipete