Skip to content

fix(computer): stabilize macOS desktop input focus - #2829

Merged
quanru merged 3 commits into
mainfrom
agent/stabilize-macos-desktop-smoke
Jul 20, 2026
Merged

fix(computer): stabilize macOS desktop input focus#2829
quanru merged 3 commits into
mainfrom
agent/stabilize-macos-desktop-smoke

Conversation

@quanruzhuoxiu

@quanruzhuoxiu quanruzhuoxiu commented Jul 20, 2026

Copy link
Copy Markdown
Collaborator

What changed

  • route targeted macOS keyboard focus through the held pointer-tap path instead of a bare native click
  • cover targeted keyboard focus with a unit regression test
  • publish an AppKit inputReadyGeneration only after the fixture is visible, active, and key
  • synchronize actions on that generation instead of a fixed 250 ms delay
  • allow the fixture button to accept the activation click while hosted macOS transitions the app to the foreground

Root cause

GitHub-hosted macOS can report a process as frontmost before AppKit has completed its activation transition. The previous fixture treated an activation signal plus a fixed delay as input readiness, so the first global click could be consumed by AppKit solely to activate the app and never reach the button. Targeted keyboard actions also used a short bare click rather than the held/focus-aware macOS pointer path, allowing the same activation race to leave text input unfocused.

This change keeps the real global input path under test while replacing the timing guess with an AppKit-owned readiness handshake. It does not add Vitest retries.

Validation

  • git diff --check
  • Biome checks for all changed TypeScript files
  • macOS Desktop workflow: three consecutive live-smoke passes and three complete workflow passes before the targeted-keyboard follow-up
  • latest macOS Desktop workflow (pending)

@quanru
quanru marked this pull request as ready for review July 20, 2026 07:29

@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: 487d7d4fe6

ℹ️ 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 +185 to +187
guard attemptsRemaining > 0 else {
writeState()
return

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 polling until the fixture becomes ready

When hosted macOS takes more than about 2 seconds to complete AppKit activation, this branch stops the readiness loop permanently and only rewrites the current state, so a later isActive/isKeyWindow transition will never bump inputReadyGeneration or create the initial ready metadata. The TypeScript side waits 30s for launch and 3s per activation, but those timeouts cannot help once the fixture has stopped polling, which can turn a slow-but-successful activation into a smoke-test timeout.

Useful? React with 👍 / 👎.

@quanruzhuoxiu quanruzhuoxiu changed the title test(computer): stabilize macOS desktop input readiness fix(computer): stabilize macOS desktop input focus Jul 20, 2026
@quanruzhuoxiu
quanruzhuoxiu force-pushed the agent/stabilize-macos-desktop-smoke branch from cd121bb to 883e269 Compare July 20, 2026 08:10
@quanru
quanru merged commit 7c92c25 into main Jul 20, 2026
13 of 14 checks passed
@quanru
quanru deleted the agent/stabilize-macos-desktop-smoke branch July 20, 2026 08:46
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.

2 participants