Repository navigation
fix(dictation): handle cloud dictation's 10-minute cap, stalled uploads and bad API keys - #39114
Merged
Merged
Conversation
Contributor
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 18 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
This was referenced Nov 9, 2026
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.
ELI5
Cloud dictation (OpenAI) had three ways to go wrong:
Now a stuck upload fails with a clear message. At 10 minutes, dictation stops on its own and inserts what you said. A wrong key is refused when you save it.
What Changed
Stuck upload.
OpenAiTranscriptionSession.finish()calledfetchwith only the cancel signal, so a stalled request never ended and the stop never finished.errorand thenstoppedpath instt-session-stop.ts.10-minute cap.
feedAudio()threw on every chunk past 10 minutes.use-audio-capture.ts), so the pill kept saying Listening while everything after the cap was dropped.trueonce, on the chunk that reached the cap.SttService.feedAudioand the existingspeech:feedAudioinvoke.onAudioLimitReachedoption.DictationControllershows "Dictation stopped at the 10-minute cloud limit." and runs the normal stop, so the first 10 minutes are transcribed and inserted.finishreturns the first 10 minutes' text, with no RPC change.API key.
orca speech openai-key setor through thespeech.openAiKey.setRPC first sends the key to the transcription endpoint with an empty form (10 s limit).Why
speech:feedAudioreply instead of a new IPC event, preload listener and event type. That is about 20 fewer lines, and the renderer, preload and main always ship together./v1/modelswould wrongly refuse restricted keys that have audio access but nomodel.readscope.Linked Issue
None. This came from the dictation review (Wave 0). No GitHub issue exists for it.
Visual Proof
Recorded in a hidden dev build against a local fake OpenAI server. For the recordings only, the cap was shortened to 8 s and the endpoint pointed at the fake server; those edits were not committed. The toast text still says 10 minutes.
Before: the invalid key saves as "OpenAI API key saved". Dictation keeps showing Listening well past the cap, and after a manual stop it fails with the bad-key error.
before-cloud-dictation.mp4
After: the invalid key is refused with "Incorrect OpenAI API key provided." and the dialog stays open. Dictation stops by itself at the cap with "Dictation stopped at the 10-minute cloud limit.", and the transcript of the kept audio (exactly 8.0 s) is inserted.
after-cloud-dictation.mp4
There is no recording of the stuck upload because it is a 35 s wait. In the same build, with the fake server never answering, I stopped a 4 s dictation. The UI went from stopping to idle at 35 s with a single toast: "Speech error: OpenAI transcription timed out. Check your connection and try again."
Testing
On macOS:
Hidden dev build with a fake OpenAI server. This covers both the Settings save path and the desktop dictation path:
Node repro against the real
OpenAiTranscriptionSession(local fake server):Key check,
saveVerifiedOpenAiSpeechApiKeyrun directly:invalid_api_keyand is not saved.Unit test. I added one test for the cap at its owner,
openai-transcription-client.test.ts. It fails on main ("Cloud transcription is limited to 10 minutes per dictation").Focused tests:
openai-transcription-client,stt-service,ipc/speech,VoicePane.Changed-file checks:
check:code-quality:changedand localization extraction.Not tested: I didn't test with a real valid key, so a valid key returning 400 for the empty form is taken from OpenAI's documented order (key first). I didn't run the phone path live; it needs no client change and its RPC is unchanged. Linux and Windows aren't platform-specific here.
I manually tested these changes locally
Automated tests added/updated, or explained why not below
Every added test fails without this change and avoids the test anti-patterns
I didn't add a test for the deadline (it is timing) or for the key check (it needs network or mocks). Both were checked against real requests as described above.
Risk
speech:feedAudioinvoke now returns a boolean instead of nothing. Renderer and main ship together.Level: Low
AI Disclosure
Review
Two Claude review rounds; Codex is at its usage limit. Neither round found a P0 or P1.
fetch, so it ignores the network proxy set in Settings. Moving both speech calls togetMainHttpClient()is a follow-up. Doing it for the key check alone would validate a key for an upload that still can't reach OpenAI.Follow-ups:
Agent skill upstream boundary
Notes
To try (dev build from
/Users/kelvinamoaba/orca/workspaces/orca/dictation-cloud-limits):sk-wrong, Save. A toast says "Incorrect OpenAI API key provided." and the dialog stays open.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)