fix(macos): prevent crash from missing ClawdbotKit resources and Swift 6.2 library#473
Merged
steipete merged 1 commit intoopenclaw:mainfrom Jan 8, 2026
Conversation
…t library The macOS app was crashing in two scenarios: 1. Bundle.module crash (fixes openclaw#213): When the first tool event arrived, ToolDisplayRegistry tried to load config via ClawdbotKitResources.bundle, which used Bundle.module directly. In packaged apps, Bundle.module couldn't find the resource bundle at the expected path, causing a fatal assertion failure after ~40-80 minutes of runtime. 2. dyld crash (fixes openclaw#417): Swift 6.2 requires libswiftCompatibilitySpan.dylib but SwiftPM doesn't bundle it automatically, causing immediate crash on launch with "Library not loaded" error. Changes: - ClawdbotKitResources.swift: Replace direct Bundle.module access with a safe locator that checks multiple paths and falls back gracefully - package-mac-app.sh: Copy ClawdbotKit_ClawdbotKit.bundle to Resources - package-mac-app.sh: Copy libswiftCompatibilitySpan.dylib from Xcode toolchain to Frameworks Tested on macOS 26.2 with Swift 6.2 - app launches and runs without crashes. Co-Authored-By: Claude Opus 4.5 <[email protected]>
Contributor
Author
CI Failure NoteThe Node.js CI checks are failing, but this is a pre-existing issue on main branch unrelated to this PR. Root cause: Evidence: The last 3 commits on main also failed CI with the same error:
This PR's relevant checks passed:
The lockfile sync issue needs to be addressed separately by running |
This was referenced Jan 8, 2026
Contributor
|
Thanks Samarth! Welcome to the Clawtributors! Say hi on Discord! |
steipete
added a commit
that referenced
this pull request
Jan 8, 2026
Contributor
ashiabbott
pushed a commit
to ashiabbott/openclaw
that referenced
this pull request
Feb 20, 2026
The upstream test used a bare Telegram chat ID ('123456') as the send
target, which fails at resolveActionTarget — Telegram targets require a
directory entry or special bypass. This made the regression test for
mediaLocalRoots threading permanently broken.
Replace with a spy plugin registered on the 'imessage' channel, where
phone-number targets (+15551234567) bypass directory lookup via the
special /^\+\?\d{6,}\$/ path in resolveMessagingTarget. The spy plugin
captures ctx.mediaLocalRoots from handleAction and we assert it contains
the agent workspace directory, verifying the fix in
outbound-send-service.ts (getAgentScopedMediaLocalRoots threading).
Fixes: broken regression test for task openclaw#473 (message tool mediaLocalRoots)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes two related crashes in the macOS menu bar app:
Problem
Crash 1: Bundle.module assertion failure (#213)
After running for 40-80 minutes, when the first tool event arrived through ControlChannel,
ToolDisplayRegistry.resolve()tried to load config viaClawdbotKitResources.bundle. This usedBundle.moduledirectly, which in packaged.appbundles couldn't find the resource bundle at the expected SwiftPM path, causing a fatal assertion:Crash 2: dyld library not loaded (#417)
Swift 6.2 on macOS 26 requires
libswiftCompatibilitySpan.dylib, but SwiftPM doesn't bundle it automatically. This caused immediate crash on launch:Solution
ClawdbotKitResources.swift: Replace directBundle.moduleaccess with a safe bundle locator that:Bundle.main/Resources/ClawdbotKit_ClawdbotKit.bundlefirst (packaged apps)Bundle.module's fatalError)Bundle.mainas final fallback (resource lookups return nil gracefully)package-mac-app.sh:ClawdbotKit_ClawdbotKit.bundleto app's Resources folderlibswiftCompatibilitySpan.dylibfrom Xcode toolchain to Frameworks folderTest Plan
scripts/package-mac-app.shClawdbotKit_ClawdbotKit.bundlepresent in/Applications/Clawdbot.app/Contents/Resources/libswiftCompatibilitySpan.dylibpresent in/Applications/Clawdbot.app/Contents/Frameworks/swift testin ClawdbotKit package)AI Assistance Disclosure
🤖 This PR was developed with Claude Opus 4.5 assistance:
DeviceModelCatalog.swift🦞 Generated with Claude Code