LearnNewsExamplesServices
Frontmatter
id10422
titleFix AppleScript UI scripting focus steal bleed in Wake Substrate
stateClosed
labels
bugaicore
assigneesneo-gpt
createdAtApr 27, 2026, 2:02 PM
updatedAtJun 3, 2026, 12:00 PM
githubUrlhttps://github.com/neomjs/neo/issues/10422
authorneo-gemini-pro
commentsCount0
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtJun 3, 2026, 12:00 PM

Fix AppleScript UI scripting focus steal bleed in Wake Substrate

neo-gemini-pro
neo-gemini-pro commented on Apr 27, 2026, 2:02 PM

Context

During cross-harness operations, the Bridge Daemon delivers Wake Payloads via osascript. If the user is actively working in a different application (like Antigravity IDE) when the daemon attempts to bring the target application (like Claude Desktop) to the front, macOS UI steal prevention can block the activate command.

The Problem

Because osascript's keystroke command natively routes keystrokes to the globally frontmost application (regardless of the surrounding tell process block), a failed focus steal causes the daemon to dump the Wake Payload and keystroke shortcuts into whatever application the user is currently using. This causes severe input clobbering and cross-contamination of agent messages.

The Architectural Reality

The issue lies in ai/scripts/bridge-daemon.mjs where osascriptArgs executes keystroke "v" without asserting that the application actually became frontmost.

The Fix

Update the AppleScript string in bridge-daemon.mjs to explicitly check if currentApp is not "${appName}" immediately before modifying the clipboard and sending the keystroke "v". If the focus steal failed, the script will gracefully throw an error and abort, preventing the bleed.

Acceptance Criteria

  • Bridge daemon AppleScript explicitly verifies the frontmost process matches the target appName.
  • If the check fails, the script exits without modifying the clipboard.
  • The WAKE payload does not bleed into the wrong application when focus steal is blocked by macOS.

Origin Session ID: 49e9b05a-0581-4fb7-861f-7e4970ea4c2b

tobiu referenced in commit a34e327 - "fix(ai): resolve focus-steal input clobbering and daemon duplication (#10423) on Apr 27, 2026, 3:01 PM
tobiu referenced in commit 75c72cd - "feat(ai): per-identity idle-out A2A heartbeat nudge dispatcher (#10675) (#10690) on May 4, 2026, 3:23 PM
tobiu referenced in commit 0695076 - "fix(ai): guard osascript frontmost delivery (#10422) (#12424) on Jun 3, 2026, 12:00 PM
tobiu closed this issue on Jun 3, 2026, 12:00 PM