Commit ca60f03
fix: gracefully degrade voice correction when agent connection is lost
Two bugs fixed:
1. recordingState stuck at .processing when no client is available:
sendVoiceCorrectionRequest early-returned with voiceCorrectedText=rawTranscript
but isVoiceCorrectionPending was never set true→false, so onChange never fired
and the .processing UI (spinner hiding the input area) persisted forever.
Fix: also reset recordingState = .idle in onChange(of: voiceCorrectedText),
which fires in ALL code paths since voiceCorrectedText is always set.
2. Long hang when client exists but connection is lost (stale cachedClient):
sendMessage triggered full auto-reconnect logic, keeping the user in
.processing for up to ~30 s before eventually calling onComplete.
Fix: check client.connectionState upfront in sendVoiceCorrectionRequest;
if not .connected, fall back to raw transcript immediately without reconnect.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>1 parent 9cc4846 commit ca60f03
2 files changed
Lines changed: 7 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
518 | 518 | | |
519 | 519 | | |
520 | 520 | | |
521 | | - | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
522 | 525 | | |
523 | 526 | | |
524 | 527 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
283 | 283 | | |
284 | 284 | | |
285 | 285 | | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
286 | 289 | | |
287 | 290 | | |
288 | 291 | | |
| |||
0 commit comments