Skip to content

dont crash if there's no mic#477

Closed
cjpais wants to merge 1 commit intomainfrom
dont-crash-no-mic
Closed

dont crash if there's no mic#477
cjpais wants to merge 1 commit intomainfrom
dont-crash-no-mic

Conversation

@cjpais
Copy link
Copy Markdown
Owner

@cjpais cjpais commented Dec 20, 2025

title

@VirenMohindra
Copy link
Copy Markdown
Contributor

VirenMohindra commented Dec 20, 2025

this prevents the crash from #475, which is good. however it introduces silent failures -- if there's no mic, the app won't crash but also won't tell the user anything. they'll press push-to-talk and nothing happens

additionally, if the worker exits early during init, calling stop() later will deadlock because it waits on a response channel from a dead thread

i think we should validate the audio config in open() before spawning the worker thread, so failures are caught and returned to the caller. and this also lets the UI show an appropriate error message

Ok(c) => c,
Err(e) => {
log::error!("Failed to get audio config: {}", e);
return;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this prevents the crash but now open() returns Ok(()) even when the worker immediately exits. the caller (audio manager) sets is_open = true and thinks everything is fine

maybe we do config validation in open() before spawning the worker, or use a oneshot channel to communicate init success / failure back

}
};

if let Err(e) = stream.play() {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

if the worker exits here ^, stop() will deadlock, and it sends Cmd::Stop(resp_tx) to a dead worker and resp_rx.recv() blocks forever waiting for a response that never comes

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

think we should not let open() succeed if init fails

@cjpais
Copy link
Copy Markdown
Owner Author

cjpais commented Dec 20, 2025

Thanks for the review @VirenMohindra, I definitely want to consider a toasting ui of some kind for error handling generally. I think probably having some unified way to throw up to the UI would be helpful for big errors

Tbh I just let Claude write whatever and hadn't even reviewed this, if you would like to submit changes and improvements I would be overjoyed!! I already have a huge backlog and would love to focus on keyboard input stuff instead

@VirenMohindra
Copy link
Copy Markdown
Contributor

if you would like to submit changes and improvements

happy to! def want to clear out my in flight PRs before i jump on this one though, before they get too stale 😅

@cjpais
Copy link
Copy Markdown
Owner Author

cjpais commented Dec 28, 2025

@VirenMohindra i will try and get them in soon! I'm not planning to pull much else in for a week or two. I'm trying to wrap up a rewrite of the keyboard input library generally

thukabjj added a commit to thukabjj/Handy that referenced this pull request Mar 2, 2026
- PR cjpais#477: Graceful handling when no microphone is connected
  - Validate device config before spawning worker thread
  - Use HandyError with user-friendly messages and recovery suggestions

- PR cjpais#930: Transcription hook for external script processing
  - Add transcription_hook_enabled and transcription_hook_path settings
  - Pipe transcription through external scripts for custom processing

- PR cjpais#814: Secure API key storage in OS keychain
  - Add keyring module for macOS Keychain, Windows Credential Manager, Linux Secret Service
  - Commands: set_api_key, get_api_key, delete_api_key, get_masked_api_key

- PR cjpais#455: Text replacements with regex and magic commands
  - Support literal and regex pattern matching
  - Magic commands: [date], [time], [datetime]
  - Import/export functionality for replacement rules

- PR cjpais#851: Per-entry post-process button for history
  - Retroactively post-process transcription history entries
  - Store post-processed text and prompt used

- PR cjpais#618: Wake-word detection for Active Listening trigger
  - Transcript-based wake phrase detection
  - Configurable trigger actions, cooldown, and threshold
DylanBricar added a commit to DylanBricar/Phonara that referenced this pull request Mar 10, 2026
- PR cjpais#944: Volume slider now uses 1% step instead of 10%
- PR cjpais#369: Double-click tray icon opens main window
- PR cjpais#477: App no longer crashes when no microphone is connected
  (graceful fallback to on-demand mode)
- Issue cjpais#858: Corrupt/empty model downloads are detected and re-downloaded
  automatically instead of blocking future download attempts
- Issue cjpais#315: Overlay no longer steals focus on Windows
  (WS_EX_NOACTIVATE + WS_EX_TOOLWINDOW + WS_EX_TRANSPARENT)
- Issue cjpais#263: Overlay size now uses logical coordinates for correct
  DPI scaling on high-DPI displays (150%+)
- Fix log filename from 'parler' to 'phonara'

Co-Authored-By: Claude Opus 4.6 <[email protected]>
DylanBricar added a commit to DylanBricar/Phonara that referenced this pull request Mar 11, 2026
…LLM env URL

- PR cjpais#477: Graceful error handling in audio recorder worker thread instead of
  panicking when no microphone config is available or stream fails to build
- PR cjpais#747: Lazy stream close for bluetooth mic latency - keeps mic stream open
  for 30s after recording stops in OnDemand mode, eliminating BT activation delay
- PR cjpais#633: Support PHONARA_CUSTOM_LLM_BASE_URL env var to override LLM base URL
  at runtime (useful for local LLM services on dynamic ports)
- PR cjpais#872: Bump macOS minimum system version from 10.13 to 10.15
- PR cjpais#976: Add tests confirming long repeating word stutter collapse works

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@cjpais cjpais closed this Mar 14, 2026
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