Skip to content

Improve reliable paste verification and avoid FluidVoice self-target duplication#231

Merged
altic-dev merged 7 commits into
mainfrom
b/issue-213-reliable-paste
Mar 27, 2026
Merged

Improve reliable paste verification and avoid FluidVoice self-target duplication#231
altic-dev merged 7 commits into
mainfrom
b/issue-213-reliable-paste

Conversation

@altic-dev

Copy link
Copy Markdown
Owner

Summary

  • improve reliable paste verification by using AppleScript-based readback for scriptable apps like Xcode and Notes, while keeping Accessibility verification as the general fallback
  • keep clipboard restore safer by waiting for stronger verification before restoring the previous pasteboard contents
  • avoid double insertion when FluidVoice itself is frontmost by skipping clipboard copy and external typing in the onboarding/playground self-target case
  • bump the app version to 1.5.10

Validation

  • swiftformat --config .swiftformat Sources
  • swiftlint --strict --config .swiftlint.yml Sources/
  • ./build_incremental.sh

Notes

  • local release notes for 1.5.10 were updated separately and intentionally not included in this PR

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d3590968e1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +543 to +547
Self.pasteboardRestoreQueue.async {
_ = self.waitForFocusedTextVerification(
from: focusedTextSnapshot,
expectedText: text,
timeoutMicros: restoreDelayMicros

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Serialize clipboard lifecycle before returning from paste path

withTemporaryPasteboardString now dispatches clipboard restoration asynchronously and returns immediately, which allows a second paste operation to start while the first operation still owns the temporary clipboard contents. In that overlap, the second call snapshots the first call’s temporary text (not the user’s original clipboard), the first restore is skipped by the change-count guard, and the second restore can permanently restore stale dictated text instead of the original clipboard. This is reproducible when two reliable-paste insertions happen within the 5-second verification window.

Useful? React with 👍 / 👎.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e664395a9e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +386 to +389
if let preferredTargetPID, preferredTargetPID > 0 {
self.log("[TypingService] Trying clipboard-to-PID insertion first")
if self.insertTextViaClipboardToPid(text, targetPID: preferredTargetPID) {
self.log("[TypingService] Reliable Paste dispatched via clipboard-to-PID")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Preserve fallback when preferred-PID paste cannot be confirmed

This new early return makes reliable paste trust insertTextViaClipboardToPid before trying global/menu paste, but that helper reports success after posting Cmd+V events without confirming delivery. If preferredTargetPID is stale (for example, the original target app exited before insertion), this branch returns true and skips the fallbacks that previously still delivered text to the active app, causing silent output loss.

Useful? React with 👍 / 👎.

let frontmostName = frontmostApp?.localizedName ?? "Unknown"
let isFluidFrontmost = frontmostApp?.bundleIdentifier?.contains("fluid") == true
let shouldTypeExternally = shouldPersistOutputs && (!isFluidFrontmost || self.isTranscriptionFocused == false)
let shouldTypeExternally = shouldPersistOutputs && !isFluidFrontmost

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep external typing enabled when FluidVoice is frontmost but unfocused

This condition now suppresses external typing for all isFluidFrontmost cases, but FluidVoice can be frontmost while its transcription editor is not the active destination (e.g., control UI/popover flow). In that state, the code no longer restores focus or calls typeTextToActiveField, and clipboard copy is also disabled above, so dictated text is not delivered to the original target app.

Useful? React with 👍 / 👎.

@altic-dev altic-dev merged commit 78d245f into main Mar 27, 2026
1 check passed
@altic-dev

Copy link
Copy Markdown
Owner Author

#213 covered!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant