fix(computer): stabilize macOS desktop input focus - #2829
Conversation
There was a problem hiding this comment.
💡 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".
| guard attemptsRemaining > 0 else { | ||
| writeState() | ||
| return |
There was a problem hiding this comment.
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 👍 / 👎.
cd121bb to
883e269
Compare
What changed
inputReadyGenerationonly after the fixture is visible, active, and keyRoot 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