Skip to content

fix(voice): capture stderr and report recording errors to user#638

Open
MrRealORG wants to merge 2 commits into
XiaomiMiMo:mainfrom
MrRealORG:fix/auto-202606150328-voice-error-reporting
Open

fix(voice): capture stderr and report recording errors to user#638
MrRealORG wants to merge 2 commits into
XiaomiMiMo:mainfrom
MrRealORG:fix/auto-202606150328-voice-error-reporting

Conversation

@MrRealORG

Copy link
Copy Markdown

Summary

Partially fixes #614 — When the audio recorder (sox/arecord) is installed but fails at runtime (e.g. `no default audio device configured`), the voice input feature silently did nothing. The recording process stderr was set to `"ignore"`, so the error was swallowed.

Root Cause

`Voice.startStreaming()` spawns the recorder process with `stderr: "ignore"`. When sox starts but immediately exits with an error (no audio device), stdout closes without data, and the user sees the voice button activate but nothing happens — no error message is shown.

Changes

`packages/opencode/src/cli/cmd/tui/util/voice.ts`:

  • Change `stderr` from `"ignore"` to `"pipe"`
  • Add a background reader that captures stderr output
  • After the stdout reader ends, check if the process exited with a non-zero code and has stderr content
  • If so, call `onError` with the actual error message from the recorder

`packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx`:

  • Update `onError` handler to accept the Error parameter and include its message in the toast, so users see the specific error (e.g. "no default audio device configured")

Z User added 2 commits June 14, 2026 19:57
… guard

When pasting text containing '@' or '$' characters, the onContentChange
handler would trigger autocomplete.onInput() for each intermediate text
state, causing a flood of sdk.client.find.files() API requests.

Add an isPasting guard flag that:
- Is set before paste text insertion begins
- Suppresses autocomplete.onInput() in onContentChange during paste
- Is cleared after paste completes with a single final onInput() call

Fixes XiaomiMiMo#579
When the audio recorder (sox/arecord) starts but fails at runtime
(e.g. 'no default audio device configured'), the error was silently
swallowed because stderr was set to 'ignore'. Users saw the voice
button activate but nothing happened.

Changes:
- Change stderr from 'ignore' to 'pipe' in Process.spawn
- Capture stderr output in a background reader
- After stdout ends, check if process exited with error and has stderr
- Call onError callback with the actual error message
- Update UI onError handler to include the error detail in toast

Partially fixes XiaomiMiMo#614
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.

Title: Numpad keys not working & Voice input microphone detection issue

1 participant