Repository navigation
feat(macos): add permission probes and hardware validation script (Batch 11) - #18
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f892d3b25d
ℹ️ 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".
|
|
||
| # Construct adapter | ||
| try: | ||
| adapter = MacOSAdapter(pid=pid, bundle_id=bundle_id) |
There was a problem hiding this comment.
Resolve bundle targets before validating
When the advertised --bundle com.apple.TextEdit path is used, this constructs MacOSAdapter with _pid=None, but screenshot validation calls _get_window_bounds() and then _resolve_ax_element(), which still raises unless a PID is set. That makes a valid bundle-only validation fail as soon as Screen Recording is granted and the screenshot check runs; resolve the bundle ID to a PID before constructing the adapter, or reject --bundle until the adapter supports it.
Useful? React with 👍 / 👎.
Batch 11 — macOS hardware validation (gate retained). Path B: validation-first, gate retained until real-device evidence is available. Permission probes added to MacOSAdapter: - _check_accessibility_permission(): AXIsProcessTrusted() for CGEvent injection - _check_screen_recording_permission(): CGPreflightScreenCaptureAccess() for screenshots - _require_accessibility(): returns SECURITY error if missing, before any CGEvent call - _require_screen_recording(): returns None if missing, before screenshot All input methods (click, type_text, key_press, scroll, fill) now check Accessibility permission before CGEvent injection. Previously, CGEventPost would succeed syntactically but the event would be silently dropped by macOS privacy controls — a false-success bug. Additional fixes: - fill() checks permission before any click (no partial side effects) - key_press() now enforces key blocklist before execution (was missing) Hardware validation script (scripts/validate_macos_adapter.py): - Tests construction, permissions, screenshots, input injection, key blocklist, dry-run - Does NOT run in CI — requires real macOS hardware and interactive session - Documents missing implementations: _char_to_keycode returns 0, named target resolution incomplete Gate status: DESKTOP_AGENT_MACOS=1 opt-in RETAINED. Gate removal criteria documented in RELEASE_READINESS.md. Signed-off-by: Alajmah <55954113+Alajmah@users.noreply.github.com>
f892d3b to
3091509
Compare
Batch 11 — macOS hardware validation (gate retained)
Path B: validation-first. Gate remains until real-device evidence is available.
Permission probes
macOS silently drops CGEvent input when Accessibility permission is missing. This was a false-success bug — CGEventPost returns success but the event is ignored. Now all input methods check permissions before injection:
Key blocklist
key_press() now enforces the key blocklist before execution (was missing on macOS).
Hardware validation script
scripts/validate_macos_adapter.py — tests construction, permissions, screenshots, input injection, key blocklist, and dry-run on real macOS hardware. Does NOT run in CI. PID-only (--bundle not supported yet).
Gate status
DESKTOP_AGENT_MACOS=1 opt-in RETAINED. Known remaining blockers for gate removal:
Verification
Issue: #11