Skip to content

fix(macos): verify live process instance when AppKit launch date is skewed - #379

Open
princejain756 wants to merge 1 commit into
vercel-labs:mainfrom
princejain756:fix/macos-skewed-owner-launch-date
Open

princejain756 wants to merge 1 commit into
vercel-labs:mainfrom
princejain756:fix/macos-skewed-owner-launch-date

Conversation

@princejain756

Copy link
Copy Markdown

Summary

Login-item apps can report an NSRunningApplication.launchDate more than 5 s off the libproc process start, and the global window inventory read that offset as owner churn on every attempt, so list-windows and window screenshots timed out on a stable desktop. A launch-time disagreement now falls back to the live-instance check the scoped path already uses, and the timeout carries the offending pid and phase.

Related issues

Closes #374

Type of change

  • fix: - bug fix

How tested

  • cargo fmt --all -- --check
  • cargo clippy "${HOST_PKGS[@]}" --all-targets -- -D warnings
  • cargo test "${HOST_PKGS[@]}" --lib
  • cargo test -p agent-desktop
  • cargo test -p agent-desktop-ffi --tests
  • AGENT_DESKTOP_E2E_EXCLUSIVE=1 bash tests/e2e/run.sh (requires --release build + AX permission; run when behavior changes)

Also verified by hand: list-windows on a live desktop still returns ok: true, and the new regression test fails against main (process_generation_changed for the skewed-launch input) and passes on this branch. The reporter's skew detector prints no affected apps on this machine, matching the issue's note that the condition cannot be created on demand; the unit tests drive the exact -9 s offset Grammarly and Raycast showed.

Checklist

  • PR title uses a conventional-commit prefix (type: description, lowercase, no capital after colon)
  • cargo fmt and cargo clippy -D warnings are clean
  • All tests pass
  • No unwrap() added in non-test code
  • No inline comments added (only /// doc-comments on public items)
  • All modified files are within the 400 LOC limit
  • Skill docs updated if a command, flag, or JSON output changed (skills/agent-desktop/ or the platform skill under skills/agent-desktop-macos/, skills/agent-desktop-windows/ or skills/agent-desktop-linux/)

Skill docs note: the change adds last_pid and last_phase to the global_window_inventory_unstable timeout details. That kind is not enumerated in skills/, so no shipped doc went stale.

…kewed

Apps launched as login items can report an NSRunningApplication.launchDate
more than 5 s off the libproc process start. The global window inventory
treated that offset as a generation change on every attempt, so
list-windows and window screenshots retried until the deadline even
though nothing was restarting. A launch-time disagreement now falls back
to the same live-instance check the scoped path uses; a token whose
process is gone still reports churn.

The timeout also dropped the pid and phase from the last churn error,
which is why the failure surfaced only as an unresponsive-app hint. It
now carries last_pid and last_phase.

Fixes vercel-labs#374
@vercel

vercel Bot commented Oct 31, 2026

Copy link
Copy Markdown

@princejain756 is attempting to deploy a commit to the Vercel Labs Team on Vercel.

A member of the Team first needs to authorize it.

This branch has not been deployed

No deployments
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.

[Bug]: macOS: an app whose launchDate is more than 5 s off its process start fails every list-windows and window screenshot

1 participant