Record Auto Enter clipboard-read pastes as pasted and skip their dead confirmation wait - #1703
Merged
Conversation
… confirmation wait Three days of logs showed 38% of dictation deliveries recorded as delivery=copied, but 66 of the 69 were real pastes: the target read the borrowed clipboard 5-49ms after Cmd+V (p50 15ms — its own paste handler, not a clipboard-manager poll), stayed frontmost, got the auto-Enter keypress, and showed the "Paste sent" success UX. The targets are the Auto Enter allowlist apps (Claude Desktop, Cursor, Codex), all Electron-based — they expose no AX text surface unless an assistive client asks, so positive AX paste confirmation can structurally never arrive there. Two changes, deliberately narrower than the clipboard-read-as-confirmation approach removed in ceabaff: - The pasteConfirmationUnavailableAutoSendEligible outcome now maps its recorded delivery to pasted. Recording "copied" claimed the text was left on the clipboard, which is false for this outcome (the clipboard is restored before Enter). The missing AX confirmation stays visible through copy_reason and target_confirmation_mode=clipboard_read_only, and friction telemetry still counts the fallback. Both diagnostics events now emit pasteOutcome.delivery.rawValue so every delivery field agrees with analytics and dictation history. - A confirmation-less target's post-dispatch clipboard read now ends the confirmation wait for Auto Enter targets too (non-Auto-Enter already stopped early). No confirmation can ever arrive for such targets, so the wait burned its full ~350ms window on every dictation into these apps; Enter stays gated behind the clipboard restore and the sender's own frontmost re-check. Non-Auto-Enter unconfirmed pastes keep their honest copied outcome — the text really is left on the clipboard there. Verified: build.sh --no-open, run-tests.sh (12206 passed), check-build-source-lists.py, run-slow-pasteback-smoke.sh (9/9). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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
Three days of local logs showed 38% of dictation deliveries (69 of 180) recorded as
delivery=copied, suggesting paste-back was degrading to clipboard-copy. Investigation showed 66 of the 69 were real pastes misclassified by telemetry: the target read the borrowed clipboard 5–49ms after Cmd+V (p50 15ms — its own synchronous paste handler, far too fast for a clipboard-manager poll), stayed frontmost, received the auto-Enter keypress, and showed the "Paste sent" success UX. The targets are the Auto Enter allowlist apps (Claude Desktop, Cursor, Codex) — all Electron-based, which expose no AX text surface unless an assistive client requests one, so positive AX paste confirmation can structurally never arrive there. On top of the misclassification, each of those dictations burned the full ~350ms confirmation wait on a window in which no confirmation could ever appear.Product Impact
dictationdictation reliabilityWhat changed
Sources/UI/Overlay/DictationSessionController.swift— thepasteConfirmationUnavailableAutoSendEligibleoutcome now maps its recorded delivery topasted. Recording "copied" claimed the text was left on the clipboard, which is false for this outcome (the clipboard is restored before Enter). The missing AX confirmation stays visible throughcopy_reasonandtarget_confirmation_mode=clipboard_read_only, and friction telemetry still counts the fallback. Both diagnostics events now emitpasteOutcome.delivery.rawValueso every delivery field agrees with analytics and persistence.Sources/Support/ClipboardRestoringTextPaster.swift— a confirmation-less target's post-dispatch clipboard read now ends the confirmation wait for Auto Enter targets too (non-Auto-Enter already stopped early). Enter stays gated behind the clipboard restore plusDictationAutoSender's own frontmost re-check.Tests/ClipboardRestoringTextPasterTests.swift— new timing proof that an Auto Enter target read skips the dead wait and still restores the original clipboard, plus source pins for the delivery mapping and event fields.Tests/CIWorkflowContractTests.swift— locked timing-skip proof count 4 → 5 for the new suite.Sources/Support/CLAUDE.md— updated the paster description.Deliberately narrower than the clipboard-read-as-confirmation approach removed in ceabaff: unattributed reads still never flip an outcome to
.pasted, and non-Auto-Enter unconfirmed pastes keep their honest copied outcome — the text really is left on the clipboard there.How I checked it
scripts/dev/agent-preflight.sh.agents/test-matrix.ymlfor the files changedbash build.sh --no-openbash run-tests.sh(12,206 passed)bash build.sh --no-openruns the bundle gate)bash run-integration-smoke.shif I touchedSources/Meeting/orSources/TranscriptedCore/— not touchedswift testif I touchedPackage.swift,Sources/TranscriptedCore/, or the public core seam — not touchedpython3 scripts/dev/check-build-source-lists.pyandbash run-slow-pasteback-smoke.sh(9/9) for the paster change; verified against 3 days of localevents.jsonl/debug.logevidenceRisk Review
delivery: pastedis an existing valid day-file value; no format change).agent-review/visuals/evidence — no UI changesNotes
Historical
delivery=copiedevents recorded before this change should be read as mostly-successful pastes into AX-opaque targets; split log analyses at this change. A separate follow-up task covers the local-log redaction false positive that hidtarget_text_observableduring this investigation.🤖 Generated with Claude Code