Skip to content

Record Auto Enter clipboard-read pastes as pasted and skip their dead confirmation wait - #1703

Merged
r3dbars merged 1 commit into
mainfrom
claude/amazing-tu-445c74
Aug 25, 2026
Merged

Record Auto Enter clipboard-read pastes as pasted and skip their dead confirmation wait#1703
r3dbars merged 1 commit into
mainfrom
claude/amazing-tu-445c74

Conversation

@r3dbars

@r3dbars r3dbars commented Aug 25, 2026

Copy link
Copy Markdown
Owner

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

  • Affects: dictation
  • Lane: dictation reliability
  • Why this matters: the delivery metric now reflects what actually shipped (real copied-fallback rate is ~6%, not 38%), dictation history stops claiming "Copied to clipboard" for text that was pasted with the clipboard restored, and every Auto Enter dictation into Electron chat apps gets ~340ms faster to Enter.

What changed

  • Sources/UI/Overlay/DictationSessionController.swift — 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 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 plus DictationAutoSender'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
  • Selected checks from .agents/test-matrix.yml for the files changed
  • bash build.sh --no-open
  • bash run-tests.sh (12,206 passed)
  • Performance budget passed (bash build.sh --no-open runs the bundle gate)
  • bash run-integration-smoke.sh if I touched Sources/Meeting/ or Sources/TranscriptedCore/ — not touched
  • swift test if I touched Package.swift, Sources/TranscriptedCore/, or the public core seam — not touched
  • Manual check: python3 scripts/dev/check-build-source-lists.py and bash run-slow-pasteback-smoke.sh (9/9) for the paster change; verified against 3 days of local events.jsonl/debug.log evidence

Risk Review

  • Privacy / local-first behavior reviewed (no new off-device fields; existing allowlists untouched)
  • Storage path or migration impact reviewed (delivery: pasted is an existing valid day-file value; no format change)
  • Public-facing copy stays concrete and matches current product scope (no copy changes)
  • Release/update impact reviewed (none)
  • Agent PRs link the issue/workpad and stay draft until human review
  • UI changes include sanitized .agent-review/visuals/ evidence — no UI changes
  • No private transcripts, audio, tokens, personal paths, or customer data are included

Notes

Historical delivery=copied events 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 hid target_text_observable during this investigation.

🤖 Generated with Claude Code

… 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>
@r3dbars
r3dbars merged commit 850f249 into main Aug 25, 2026
7 checks passed
@r3dbars
r3dbars deleted the claude/amazing-tu-445c74 branch August 25, 2026 01:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant