[feature] dictation polish rewrites the sentence instead of tidying it - #324
Merged
Conversation
The prompt asked for filler removal, punctuation and paragraph breaks, and then told the model to "keep the speaker's own wording as much as possible". That last clause forbade everything else the pass was wanted for. Speech comes out with the qualifier before the claim and the correction three clauses after the mistake; the recogniser mishears a homophone; someone counts off "第一點… 第二點…" and gets back a wall of prose. Repairing any of that means changing the wording, so the model left it alone, and the feature read as barely doing anything on either platform. So the licence is broad now — reorder, merge, split, repair misheard words, lay a spoken enumeration out as a numbered list — and the limits move somewhere safer: nothing may be added, nothing said may be dropped, and the transcript is never a request to the model. "Rewrite freely" is one step from "improve", and an improved transcript says things the speaker did not, under their name, in their document. Desktop's round-trip budget goes 2s → 4s. Two was sized for an edit whose output is as long as its input; a rewrite emits more than it was given, and the longest transcripts — the ones with the most to gain — are the slowest. A timeout pastes the raw text, which is indistinguishable from the polish doing nothing, so the tight budget would have delivered the feature only to the short dictations that barely needed it. iOS already allowed six. Both copies of the prompt are word-for-word identical, and a test now reads the Swift literal and asserts it: drift reaches the user as "it behaves differently on my phone", which is close to impossible to report. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
✅ SonarQube Quality Gate passed — pathorsAI_parley0 open issues on this PR. |
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.
Why
The AI polish felt like it barely did anything, on the desktop and on the phone alike. The prompt is why. It asked for filler removal, punctuation and paragraph breaks, and then said:
That clause forbade everything else people actually wanted from the pass. Speech comes out with the qualifier before the claim and the self-correction three clauses after the mistake; the recogniser mishears a homophone; someone counts off "第一點…第二點…第三點…" and gets back a wall of prose. Repairing any of that means changing the wording — so the model didn't. It was doing what it was told.
What changed
The prompt now licenses a rewrite (identical text in
polish.tsandTranscriptPolisher.swift):The limits move to where they belong. A free hand is one step from "improve this", and an improved transcript says things the speaker did not, under their name, in their document. So the prompt now forbids explicitly: adding or inferring content, summarising or dropping anything said, answering a question inside the transcript, changing the language or script, and trading the speaker's register for grander words.
Desktop round-trip budget 2s → 4s (
POLISH_TIMEOUT_MS). Two seconds was sized for an edit whose output is as long as its input. A rewrite emits more than it was given, and the longest transcripts — the ones with the most to gain — are the slowest ones. A timeout pastes the raw text, which the user cannot tell apart from the polish having done nothing, so the tight budget would have shipped the feature only to the short dictations that barely needed it. iOS already allowed 6s (DictationCoordinator.polishBudget), which is part of why the desktop felt worse.Settings copy updated on both platforms (
zh-TW+en) to describe what it now does, including the "nothing is added or summarised away" promise.What deliberately did not change
acceptPolish/acceptkeep the 0.3–2.0 length band. It is the guard that catches the model ignoring "do not summarise", and it is doing more work now than it was before, so it stays where it is — a list-formatted rewrite of a rambling utterance lands around 0.8, well inside. A rejected polish still silently pastes the raw transcript and logs at info.Tests
bunx tsc --noEmitclean,bunx vitest run291/291. The Swift tests could not be run locally — this machine has Command Line Tools but no full Xcode, soXCTestwill not resolve;swift buildon ParleyKit passes, the test file passesswiftc -parse, and the new assertions were checked by evaluating the same conditions against the built prompt. CI (ios-release.yml) runsswift testproperly.Worth a look in review
The prompt is the whole PR — if a limit reads as too loose or too tight, that's the thing to argue about.
🤖 Generated with Claude Code