You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix: Bound memory use for long dictation recordings - #878
Add a production-used long-dictation policy inside ASRService that applies the existing 20-minute file-transcription bound to live preview and final dictation work, while leaving shorter recordings on their current single-pass path. Once a recording reaches that bound, retain the last successful live preview but skip further full-prefix preview copies/inference; at stop, split normal dictation PCM into ordered, non-empty ranges no larger than the bound, fold any sub-second tail into the preceding range, and run transcribeFinal serially for each range through the existing TranscriptionExecutor. Combine non-empty chunk results in order, derive aggregate confidence from completed chunks, and apply filler removal, dictionary replacement, spoken-punctuation formatting, audio snapshot handling, and the existing ContentView history flow once to the combined result.
FluidVoice can terminate while finalizing a roughly 50–80 minute local dictation, leaving no transcription history entry because ContentView only persists history after ASRService.stop() returns text. The issue thread provides a repeatable long-recording case on Apple Silicon, and the maintainer identifies memory pressure from retaining and processing the growing recording as the likely cause. The current streaming path repeatedly obtains the entire accumulated PCM prefix, while the final path sends the full recording through one provider inference; both operations grow without a duration bound. File transcription already avoids the same class of failure by processing long audio in 20-minute chunks.
Closes #(issue number), or links to an accepted Discussion/roadmap item.
Testing
Tested on Intel Mac
Not verified: this needs a person on the named hardware or environment.
Tested on Apple Silicon Mac
Not verified: this needs a person on the named hardware or environment.
Tested on macOS version:
Not verified: this needs a person on the named hardware or environment.
Ran linter locally: swiftlint --strict --config .swiftlint.yml Sources
Not run: no test command resolved in this workspace, so nothing was executed to pass.
Ran formatter locally: swiftformat --config .swiftformat Sources
Not run: no test command resolved in this workspace, so nothing was executed to pass.
Ran tests locally:
A recording below 20 minutes remains eligible for streaming preview and produces one final range covering every sample, preserving the existing short-recording path. - A 50-minute, 16 kHz sample count becomes three ordered final ranges whose union covers every sample exactly once and whose individual sizes never exceed 20 minutes; preview work is rejected after the bound instead of requesting the whole prefix again. - A recording exactly on the boundary produces one range, while a recording just over the boundary does not create a sub-second final request: the short remainder is folded into the prior range without dropping or duplicating samples.
Screenshots / Video
Attach screenshots or a video for UI, UX, settings, onboarding, overlay, menu bar, or visual behavior changes.
No UI/visual changes; screenshots/video are not applicable.
Not verified: this needs a person on the named hardware or environment.
Notes
Add reviewer context, rollout notes, or known tradeoffs here.
This PR has been closed because it still does not follow the required PR template after the 48-hour correction window.
Please open a new PR with the required description, related issue or accepted Discussion, testing notes, and screenshot/video evidence when applicable.
This PR bounds long-dictation transcription work by pausing full-prefix streaming previews at 20 minutes and serially transcribing ordered final chunks.
Keeps shorter recordings on the existing single-pass path.
Selects quiet chunk boundaries while preventing empty or sub-second tails.
Combines usable chunk text and confidence before applying the existing post-processing flow.
Adds coverage for range construction, preview cutoff, result aggregation, and error propagation.
Confidence Score: 5/5
The PR appears safe to merge, with no concrete blocking or independently actionable non-blocking issue identified.
The changed path preserves single-pass behavior for short recordings, covers long recordings with contiguous bounded ranges, processes chunks serially, and retains the established stop and provider lifecycle behavior.
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
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.
Description
Add a production-used long-dictation policy inside
ASRServicethat applies the existing 20-minute file-transcription bound to live preview and final dictation work, while leaving shorter recordings on their current single-pass path. Once a recording reaches that bound, retain the last successful live preview but skip further full-prefix preview copies/inference; at stop, split normal dictation PCM into ordered, non-empty ranges no larger than the bound, fold any sub-second tail into the preceding range, and runtranscribeFinalserially for each range through the existingTranscriptionExecutor. Combine non-empty chunk results in order, derive aggregate confidence from completed chunks, and apply filler removal, dictionary replacement, spoken-punctuation formatting, audio snapshot handling, and the existingContentViewhistory flow once to the combined result.FluidVoice can terminate while finalizing a roughly 50–80 minute local dictation, leaving no transcription history entry because
ContentViewonly persists history afterASRService.stop()returns text. The issue thread provides a repeatable long-recording case on Apple Silicon, and the maintainer identifies memory pressure from retaining and processing the growing recording as the likely cause. The current streaming path repeatedly obtains the entire accumulated PCM prefix, while the final path sends the full recording through one provider inference; both operations grow without a duration bound. File transcription already avoids the same class of failure by processing long audio in 20-minute chunks.Closes #843
Type of Change
Related Issue or Discussion
Closes #(issue number), or links to an accepted Discussion/roadmap item.
Testing
Not verified: this needs a person on the named hardware or environment.
Not verified: this needs a person on the named hardware or environment.
Not verified: this needs a person on the named hardware or environment.
swiftlint --strict --config .swiftlint.yml SourcesNot run: no test command resolved in this workspace, so nothing was executed to pass.
swiftformat --config .swiftformat SourcesNot run: no test command resolved in this workspace, so nothing was executed to pass.
Screenshots / Video
Attach screenshots or a video for UI, UX, settings, onboarding, overlay, menu bar, or visual behavior changes.
Not verified: this needs a person on the named hardware or environment.
Notes
Add reviewer context, rollout notes, or known tradeoffs here.