fix(macos): prevent crash on launch when no microphone available#5656
Closed
sfo2001 wants to merge 1 commit intoopenclaw:mainfrom
Closed
fix(macos): prevent crash on launch when no microphone available#5656sfo2001 wants to merge 1 commit intoopenclaw:mainfrom
sfo2001 wants to merge 1 commit intoopenclaw:mainfrom
Conversation
4f4407b to
cc04084
Compare
Closed
457dfd9 to
36928e3
Compare
bbb8e4c to
524bbf8
Compare
bfc1ccb to
f92900f
Compare
126f41c to
a9ed2da
Compare
Guard against missing audio input device before accessing AVAudioEngine.inputNode. On Macs without built-in microphone (e.g., Mac mini) with no external mic connected, accessing inputNode can crash with SIGABRT. Uses existing AudioInputDeviceObserver.defaultInputDeviceUID() which already uses Core Audio APIs to check for input devices. Fixes openclaw#5529 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
a9ed2da to
c4135b2
Compare
Contributor
|
Closing as AI-assisted stale-fix triage. Linked issue #5529 ("[Bug]: macOS App crashes on launch when no audio input device is available") is currently closed and was closed on 2026-02-03T19:15:37Z with state reason completed. If this specific implementation is still needed on current main, please reopen #5656 (or open a new focused fix PR) and reference #5529 for fast re-triage. |
18 tasks
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
Prevents macOS app crash on launch when no audio input device is available (e.g., Mac mini without external microphone).
Fixes #5529
Root Cause
On macOS, accessing
AVAudioEngine.inputNodewhen no audio input device exists triggers a SIGABRT crash instead of failing gracefully. The existing guard forformat.channelCount > 0(line 171) is never reached because the crash occurs earlier when accessinginputNode.Fix
Added a guard checking
AVCaptureDevice.default(for: .audio) != nilbefore accessinginputNode. This pattern is already used elsewhere in the codebase (CameraCaptureService.swift:149).Test plan
Requires hardware testing - I don't have access to a Mac without built-in microphone.
To test:
With microphone connected:
Greptile Overview
Greptile Summary
This PR adds an early guard in
VoiceWakeRuntime.start(with:)to avoid a macOS crash when accessingAVAudioEngine.inputNodeon machines with no audio input device (e.g., Mac mini without an external mic). The change checks for the presence of an audio capture device before touchinginputNode, and throws a descriptive error that gets logged and causes the voice-wake runtime to stop cleanly.Confidence Score: 4/5
AVCaptureDevice.default(for: .audio)may not precisely match the conditions under whichAVAudioEngine.inputNodecrashes, so it may not cover all edge cases (permissions/routing).Context used:
dashboard- CLAUDE.md (source)dashboard- AGENTS.md (source)