From bf060e999770e4f6cee4d4d1bc4fd5ee68854313 Mon Sep 17 00:00:00 2001 From: abrichr Date: Fri, 20 Nov 2026 12:14:40 -0500 Subject: [PATCH 1/7] fix(macos): guide 27.3 app-control permissions conservatively --- docs/getting-started/permissions.md | 48 ++++++++++++++- ...cos-27-3-permission-guidance-2026-11-20.md | 50 ++++++++++++++++ openadapt/cli.py | 17 +++++- openadapt/macos_permissions.py | 54 +++++++++++++++++ .../input_observer/darwin.py | 8 ++- .../openadapt_capture/macos_permissions.py | 54 +++++++++++++++++ .../tests/test_input_observer_darwin.py | 29 ++++++++- .../desktop/openadapt_desktop/capabilities.py | 29 +++++---- .../desktop/openadapt_desktop/dispatch.py | 13 ++-- .../openadapt_desktop/macos_permissions.py | 54 +++++++++++++++++ packages/desktop/src/lib/types.ts | 10 +++- .../desktop/src/screens/Onboarding.test.tsx | 59 ++++++++++++++++++- packages/desktop/src/screens/Onboarding.tsx | 39 ++++++++---- .../tests/test_engine/test_capabilities.py | 20 +++++++ .../tests/test_engine/test_dispatch.py | 5 ++ .../test_engine/test_mac_permission_status.py | 29 +++++++++ .../openadapt_flow/backends/macos_backend.py | 10 ++-- .../openadapt_flow/backends/remote_display.py | 31 ++++++---- .../flow/openadapt_flow/macos_permissions.py | 54 +++++++++++++++++ packages/flow/tests/test_macos_backend.py | 9 ++- .../test_macos_backend_missing_pyobjc.py | 23 ++++++++ tests/test_doctor_setup.py | 21 +++++++ tests/test_macos_permission_guidance.py | 48 +++++++++++++++ 23 files changed, 651 insertions(+), 63 deletions(-) create mode 100644 docs/results/macos-27-3-permission-guidance-2026-11-20.md create mode 100644 openadapt/macos_permissions.py create mode 100644 packages/capture/openadapt_capture/macos_permissions.py create mode 100644 packages/desktop/openadapt_desktop/macos_permissions.py create mode 100644 packages/desktop/tests/test_engine/test_mac_permission_status.py create mode 100644 packages/flow/openadapt_flow/macos_permissions.py create mode 100644 tests/test_macos_permission_guidance.py diff --git a/docs/getting-started/permissions.md b/docs/getting-started/permissions.md index 446e26dd8a..8be28f9951 100644 --- a/docs/getting-started/permissions.md +++ b/docs/getting-started/permissions.md @@ -10,7 +10,8 @@ Native recording and replay use operating system controls: | Surface | Typical local requirements | | --- | --- | -| macOS | Screen Recording and Input Monitoring for capture; Accessibility for actuation | +| macOS before 27.3 | Screen Recording and Input Monitoring for capture; Accessibility for app control | +| macOS 27.3 or later | Screen Recording and Input Monitoring for capture; System & App Protection Override for app control, with the selected target included | | Windows | An interactive desktop; UI Automation and input rights at the target integrity level | | Linux | An interactive X11 or approved portal session plus AT-SPI for structural evidence | | RDP / Citrix | Access to the exact visible local client window and its input path | @@ -27,3 +28,48 @@ openadapt doctor --backend macos Run `openadapt flow record --help` and `openadapt flow replay --help` for the exact installed target options. + +## macOS 27.3 setup + +Apple introduced the new app-control settings in **macOS 27.3 beta 2** on +November 16, 2026. Existing grants remain in effect. Apple notes that some known apps keep +their existing behavior without a new entitlement. See [Apple's announcement](https://developer.apple.com/news/?id=oqng0zjk). + +1. Open **System Settings > Privacy & Security > System & App Protection Override**. +2. Click **+** and add the app that launches OpenAdapt, such as the installed + desktop app or your terminal host. +3. Select **Choose Apps**, add the intended target apps, and choose **Ask First** + or **At Any Time** for each target. An Ask First grant can require another + confirmation during use. +4. For unrestricted control, use the system-protection override option, review + its five action confirmations and authenticate when asked. This is broader + than selecting target apps; it is not required by this guide. +5. Restart the launching app and re-check the intended target. For earlier macOS, + use **Privacy & Security > Accessibility** instead. + +[Apple's permission guide](https://support.apple.com/en-us/149699) describes the +scope controls. Screen Recording and Input Monitoring remain separate checks; +this change does not make Full Disk Access a recording requirement. The new-pane +deep-link identifier is not verified, so Desktop opens Privacy & Security and +provides the manual path. + +## What the checks establish + +`AXIsProcessTrusted` reports trust for the current process. It does not document +which target apps are allowed. On 27.3 or later, doctor and Desktop describe that +result as a process preflight, rather than claiming every target is accessible. +An unavailable API is unknown and must not be reported as granted. Runtime input +continues to refuse when the existing process/target checks cannot establish the +required boundary; a version number never grants access. + +No 27.3 machine was available for this change. The relationship between an +override grant and `AXIsProcessTrusted`, read versus posted-input permissions, +and replay under **Choose Apps** still need beta-machine verification. No +replacement trust API or blanket bypass is assumed. No general-availability date +is established here. + +Apple's [27.3 beta release notes](https://developer.apple.com/documentation/macos-release-notes/macos-27_3-release-notes) +list interaction issues with Safari and other WebKit apps under the new grant +(192510863). They also list a missing activity indicator for some CoreGraphics +input (192728601). The indicator is not proof that input succeeded or failed; +verify the application's actual effect. diff --git a/docs/results/macos-27-3-permission-guidance-2026-11-20.md b/docs/results/macos-27-3-permission-guidance-2026-11-20.md new file mode 100644 index 0000000000..baad0f434b --- /dev/null +++ b/docs/results/macos-27-3-permission-guidance-2026-11-20.md @@ -0,0 +1,50 @@ +# macOS 27.3 permission guidance — 2026-11-20 + +This is a source-only onboarding/diagnostic correction, not beta runtime +qualification. The new PR is held for review and must remain unmerged. + +The defect class is using a legacy global-permission label/check as a claim +about newer app-scoped control. The launcher, engine, recorder and Desktop keep +independent installation boundaries; their small dependency-free guidance +helpers share one tested numeric-version/setup model. No package floor, release +version, native entitlement or workflow is changed. + +## Validation + +| Targeted group | Result | +| --- | --- | +| Launcher guidance and doctor | 53 passed | +| Flow macOS wrappers and refusal/prompt cases | 63 passed | +| Capture input permission cases | 8 passed, 17 deselected | +| Desktop capability and API-result cases | 55 passed | +| Desktop permission dispatch cases | 10 passed, 92 deselected | +| Onboarding UI | 6 passed | +| Desktop TypeScript | Passed, no emit | + +Python checks used CPython 3.12.13 with source paths bound to this checkout. +Desktop test additions used task-local dependencies, including Pydantic2.14.4; +they are not a new locked-runtime qualification. Capture used its existing +complete 3.12.13 test interpreter. UI used Node22.22.2 and the exact npm lock. +All tests ran headlessly through the shared CPU-slot wrapper, sequential package +processes for Python. No native permission API, desktop input or GUI was driven. + +Initial collection failures were environmental: the first Capture interpreter +lacked Flow cryptography; combining the packages collided on their separate +`tests` namespaces; the Flow interpreter lacked Capture's fire dependency. +Each package was then tested separately in its appropriate existing interpreter. +A local path typo was corrected before final formatting/type validation. These +setup failures are not test passes or source defects. The final Capture group +retains its existing SQLAlchemy deprecation warning; Vite retains its config +loader warning. + +## Remaining beta checks + +No macOS27.3 machine was identified. Test the exact new-pane deep link, whether +AX process trust reflects each override mode, UI reads versus posted input, +Choose Apps with allowed/disallowed targets, Ask First cancellation, and old +migrated grants on a beta machine before merging. The code does not invent a +replacement API or bypass a denied preflight. The UI/doctor never treat process +trust as proof of all target-app grants. General-availability timing is unknown. + +Primary references and beta2 known-issue identifiers are in +[the permission guide](../getting-started/permissions.md). diff --git a/openadapt/cli.py b/openadapt/cli.py index 0d589300fa..b35f8adbb7 100644 --- a/openadapt/cli.py +++ b/openadapt/cli.py @@ -2843,9 +2843,12 @@ def _doctor_macos_permissions() -> list[str]: click.echo(" [ERROR] macOS permissions could not be checked.") return ["macos-permissions"] + from openadapt.macos_permissions import control_permission_guidance + + guidance = control_permission_guidance() failures = [] for name, check, pane in ( - ("Accessibility", client.input_trusted, "Accessibility"), + (guidance["label"], client.input_trusted, guidance["label"]), ( "Screen Recording", client.capture_trusted, @@ -2858,7 +2861,17 @@ def _doctor_macos_permissions() -> list[str]: failures.append(name) click.echo(f" [ERROR] {name}: permission could not be checked.") continue - if granted: + if name == guidance["label"] and guidance["setup_mode"] != "legacy": + if not granted: + failures.append(name) + state = "WARN" if granted else "UNCONFIRMED" + detail = "passed" if granted else "did not confirm access" + click.echo( + f" [{state}] {name}: AX process trust preflight {detail}; " + "this does not verify access to the selected app. " + + guidance["instructions"] + ) + elif granted: click.echo(f" [OK] {name}: permission is granted.") else: failures.append(name) diff --git a/openadapt/macos_permissions.py b/openadapt/macos_permissions.py new file mode 100644 index 0000000000..2793f80733 --- /dev/null +++ b/openadapt/macos_permissions.py @@ -0,0 +1,54 @@ +"""Version-aware macOS permission guidance; never an access decision. + +Kept dependency-free in each independently installable package. The shared +conformance cases in tests/test_macos_permission_guidance.py cover all copies. +""" + +from __future__ import annotations + +import platform +import re + + +def control_permission_guidance(version: str | None = None) -> dict[str, str]: + """Describe setup without inferring target access from process AX trust.""" + if version is None: + try: + version = platform.mac_ver()[0] + except Exception: + version = "" + valid = re.fullmatch(r"[0-9]+\.[0-9]+(?:\.[0-9]+)?", version) + scope = "unknown" + if valid: + parts = tuple(int(part) for part in version.split(".")[:2]) + scope = "app_selection" if parts >= (27, 3) else "legacy" + pane = "x-apple.systempreferences:com.apple.preference.security" + if scope == "legacy": + return { + "setup_mode": scope, + "label": "Accessibility", + "settings_url": pane + "?Privacy_Accessibility", + "instructions": "In System Settings > Privacy & Security > Accessibility, " + "enable the app that launches OpenAdapt, then restart that app.", + } + steps = ( + "In System Settings > Privacy & Security > System & App Protection " + "Override, click + and add the app that launches OpenAdapt. Choose Apps, " + "then set each target to Ask First or At Any Time. For unrestricted " + "control, select the system-protection override option, confirm its " + "warnings and authenticate. Restart the launching app, then check the " + "selected target." + ) + return { + "setup_mode": scope, + "label": "System & App Protection Override" + if scope == "app_selection" + else "macOS app control", + # No supported direct link to the new pane has been verified. + "settings_url": pane, + "instructions": steps + if scope == "app_selection" + else "On macOS 27.3 or later: " + + steps + + " On earlier macOS, use Privacy & Security > Accessibility instead.", + } diff --git a/packages/capture/openadapt_capture/input_observer/darwin.py b/packages/capture/openadapt_capture/input_observer/darwin.py index af35daf1f5..2e8e35ed46 100644 --- a/packages/capture/openadapt_capture/input_observer/darwin.py +++ b/packages/capture/openadapt_capture/input_observer/darwin.py @@ -6,6 +6,8 @@ import time from typing import Any +from openadapt_capture.macos_permissions import control_permission_guidance + from .base import ( InputCallback, InputObserverError, @@ -167,8 +169,8 @@ def _setup(self) -> None: ) if not self._has_active_filter_permission(): raise InputObserverPermissionError( - "macOS denied the ordered input barrier. In System Settings > " - f"Privacy & Security > Accessibility, {_PERMISSION_TARGET}" + "macOS process trust for the ordered input barrier is not confirmed. " + + control_permission_guidance()["instructions"] ) event_mask = 0 @@ -243,7 +245,7 @@ def _has_active_filter_permission(self) -> bool: if callable(accessibility_check): return bool(accessibility_check()) raise InputObserverUnavailableError( - "macOS does not expose the Accessibility permission required for " + "macOS does not expose the process-trust check required for " "ordered input" ) diff --git a/packages/capture/openadapt_capture/macos_permissions.py b/packages/capture/openadapt_capture/macos_permissions.py new file mode 100644 index 0000000000..2793f80733 --- /dev/null +++ b/packages/capture/openadapt_capture/macos_permissions.py @@ -0,0 +1,54 @@ +"""Version-aware macOS permission guidance; never an access decision. + +Kept dependency-free in each independently installable package. The shared +conformance cases in tests/test_macos_permission_guidance.py cover all copies. +""" + +from __future__ import annotations + +import platform +import re + + +def control_permission_guidance(version: str | None = None) -> dict[str, str]: + """Describe setup without inferring target access from process AX trust.""" + if version is None: + try: + version = platform.mac_ver()[0] + except Exception: + version = "" + valid = re.fullmatch(r"[0-9]+\.[0-9]+(?:\.[0-9]+)?", version) + scope = "unknown" + if valid: + parts = tuple(int(part) for part in version.split(".")[:2]) + scope = "app_selection" if parts >= (27, 3) else "legacy" + pane = "x-apple.systempreferences:com.apple.preference.security" + if scope == "legacy": + return { + "setup_mode": scope, + "label": "Accessibility", + "settings_url": pane + "?Privacy_Accessibility", + "instructions": "In System Settings > Privacy & Security > Accessibility, " + "enable the app that launches OpenAdapt, then restart that app.", + } + steps = ( + "In System Settings > Privacy & Security > System & App Protection " + "Override, click + and add the app that launches OpenAdapt. Choose Apps, " + "then set each target to Ask First or At Any Time. For unrestricted " + "control, select the system-protection override option, confirm its " + "warnings and authenticate. Restart the launching app, then check the " + "selected target." + ) + return { + "setup_mode": scope, + "label": "System & App Protection Override" + if scope == "app_selection" + else "macOS app control", + # No supported direct link to the new pane has been verified. + "settings_url": pane, + "instructions": steps + if scope == "app_selection" + else "On macOS 27.3 or later: " + + steps + + " On earlier macOS, use Privacy & Security > Accessibility instead.", + } diff --git a/packages/capture/tests/test_input_observer_darwin.py b/packages/capture/tests/test_input_observer_darwin.py index 81699f62a6..b24729feda 100644 --- a/packages/capture/tests/test_input_observer_darwin.py +++ b/packages/capture/tests/test_input_observer_darwin.py @@ -218,9 +218,7 @@ def test_lifecycle_creates_listen_only_tap_and_releases_run_loop() -> None: assert quartz.callback is not None assert quartz.tap_enabled == [True, False] - assert quartz.added_sources == [ - (quartz.loop, quartz.source, quartz.kCFRunLoopDefaultMode) - ] + assert quartz.added_sources == [(quartz.loop, quartz.source, quartz.kCFRunLoopDefaultMode)] assert quartz.removed_sources == quartz.added_sources assert quartz.invalidated_sources == [quartz.source] assert quartz.invalidated_ports == [quartz.tap] @@ -866,3 +864,28 @@ def fail(_event): assert observer._stop_requested.is_set() with pytest.raises(InputObserverError, match="callback boom"): observer.stop() + + +@pytest.mark.parametrize( + "version, pane", + [ + ("27.2", "Accessibility"), + ("27.3", "System & App Protection Override"), + ("27.10", "System & App Protection Override"), + ("28.0", "System & App Protection Override"), + ], +) +def test_active_barrier_permission_guidance_tracks_macos_without_bypassing_denial( + monkeypatch, version, pane +): + monkeypatch.setattr( + "openadapt_capture.macos_permissions.platform.mac_ver", lambda: (version, (), "") + ) + quartz = FakeQuartz() + observer = make_observer( + quartz, lambda _event: None, application_services=FakeApplicationServices(trusted=False) + ) + with pytest.raises(InputObserverPermissionError) as error: + observer.start() + assert pane in str(error.value) + assert quartz.callback is None diff --git a/packages/desktop/openadapt_desktop/capabilities.py b/packages/desktop/openadapt_desktop/capabilities.py index 35cb31beb8..774442ccdc 100644 --- a/packages/desktop/openadapt_desktop/capabilities.py +++ b/packages/desktop/openadapt_desktop/capabilities.py @@ -42,6 +42,8 @@ from pathlib import Path from typing import Literal +from .macos_permissions import control_permission_guidance + CAPABILITY_SCHEMA = "openadapt-desktop.capability-report/v1" CapabilityState = Literal[ @@ -56,16 +58,12 @@ _SURFACE_LABELS = { "web": "web (browser)", "windows": "windows (WAA agent)", - "macos": "macOS (Accessibility)", + "macos": "macOS (AX)", "linux": "linux (AT-SPI)", "rdp": "RDP", "citrix": "Citrix", } -_MAC_ACCESSIBILITY_REMEDIATION = ( - "Open System Settings > Privacy & Security > Accessibility, enable " - "OpenAdapt Desktop, then restart the app." -) _MAC_SCREEN_RECORDING_REMEDIATION = ( "Open System Settings > Privacy & Security > Screen & System Audio " "Recording, enable OpenAdapt Desktop, then restart the app." @@ -351,20 +349,21 @@ def _check_macos() -> SurfaceCapability: driver_version=None, ) driver_version = _dist_version("pyobjc-framework-applicationservices") - if _mac_accessibility_trusted() is False: + guidance = control_permission_guidance() + if _mac_accessibility_trusted() is not True: return SurfaceCapability( surface="macos", state="permission_required", detail=( - "macOS has not granted this app the Accessibility permission " - "(AXIsProcessTrusted is false), so the AX tree cannot be read." + "macOS process AX trust could not be confirmed. " + "Target-app access has not been verified." ), - remediation=_MAC_ACCESSIBILITY_REMEDIATION, - requirement="the macOS Accessibility permission", + remediation=guidance["instructions"], + requirement="the macOS " + guidance["label"] + " permission", driver_name="pyobjc-framework-applicationservices", driver_version=driver_version, ) - if _mac_screen_recording_granted() is False: + if _mac_screen_recording_granted() is not True: return SurfaceCapability( surface="macos", state="permission_required", @@ -381,8 +380,8 @@ def _check_macos() -> SurfaceCapability: surface="macos", state="available", detail=( - "Accessibility and Screen Recording are granted; the native AX " - "surface is ready." + "Process AX trust and Screen Recording preflights passed. " + "Access to the selected target still needs to be checked." ), driver_name="pyobjc-framework-applicationservices", driver_version=driver_version, @@ -481,7 +480,7 @@ def _check_rdp() -> SurfaceCapability: driver_name="pyobjc-framework-quartz", driver_version=None, ) - if _mac_screen_recording_granted() is False: + if _mac_screen_recording_granted() is not True: return SurfaceCapability( surface="rdp", state="permission_required", @@ -584,7 +583,7 @@ def _check_citrix() -> SurfaceCapability: driver_name="Citrix Workspace", driver_version=None, ) - if sys.platform == "darwin" and _mac_screen_recording_granted() is False: + if sys.platform == "darwin" and _mac_screen_recording_granted() is not True: return SurfaceCapability( surface="citrix", state="permission_required", diff --git a/packages/desktop/openadapt_desktop/dispatch.py b/packages/desktop/openadapt_desktop/dispatch.py index 59d0fa0d28..74258a6103 100644 --- a/packages/desktop/openadapt_desktop/dispatch.py +++ b/packages/desktop/openadapt_desktop/dispatch.py @@ -6227,7 +6227,7 @@ def refresh_policy(self, **params: Any) -> dict: def check_permissions(self, **params: Any) -> dict: """Return the prompt-free :class:`PermissionStatus`. - macOS capture needs Screen Recording, Accessibility, and Input + macOS capture needs Screen Recording, app-control trust, and Input Monitoring. This check never requests access. Input Monitoring fails closed if its preflight API is unavailable; non-mac platforms do not use these macOS permissions and report all three as granted. @@ -6241,10 +6241,13 @@ def check_permissions(self, **params: Any) -> dict: screen = _mac_preflight_screen() access = _mac_preflight_accessibility() input_monitoring = _mac_preflight_input_monitoring() + from .macos_permissions import control_permission_guidance + return { "screen_recording": screen, "accessibility": access, "input_monitoring": input_monitoring, + "control_permission": control_permission_guidance(), } def request_input_monitoring(self, **params: Any) -> dict: @@ -6482,22 +6485,22 @@ def _toml_value(value: Any) -> str: return '"' + str(value).replace("\\", "\\\\").replace('"', '\\"') + '"' -def _mac_preflight_screen() -> bool: # pragma: no cover - platform-specific +def _mac_preflight_screen() -> bool | None: # pragma: no cover - platform-specific try: from Quartz import CGPreflightScreenCaptureAccess return bool(CGPreflightScreenCaptureAccess()) except Exception: - return True + return None -def _mac_preflight_accessibility() -> bool: # pragma: no cover - platform-specific +def _mac_preflight_accessibility() -> bool | None: # pragma: no cover - platform-specific try: from ApplicationServices import AXIsProcessTrusted return bool(AXIsProcessTrusted()) except Exception: - return True + return None def _mac_preflight_input_monitoring() -> bool: # pragma: no cover - platform-specific diff --git a/packages/desktop/openadapt_desktop/macos_permissions.py b/packages/desktop/openadapt_desktop/macos_permissions.py new file mode 100644 index 0000000000..2793f80733 --- /dev/null +++ b/packages/desktop/openadapt_desktop/macos_permissions.py @@ -0,0 +1,54 @@ +"""Version-aware macOS permission guidance; never an access decision. + +Kept dependency-free in each independently installable package. The shared +conformance cases in tests/test_macos_permission_guidance.py cover all copies. +""" + +from __future__ import annotations + +import platform +import re + + +def control_permission_guidance(version: str | None = None) -> dict[str, str]: + """Describe setup without inferring target access from process AX trust.""" + if version is None: + try: + version = platform.mac_ver()[0] + except Exception: + version = "" + valid = re.fullmatch(r"[0-9]+\.[0-9]+(?:\.[0-9]+)?", version) + scope = "unknown" + if valid: + parts = tuple(int(part) for part in version.split(".")[:2]) + scope = "app_selection" if parts >= (27, 3) else "legacy" + pane = "x-apple.systempreferences:com.apple.preference.security" + if scope == "legacy": + return { + "setup_mode": scope, + "label": "Accessibility", + "settings_url": pane + "?Privacy_Accessibility", + "instructions": "In System Settings > Privacy & Security > Accessibility, " + "enable the app that launches OpenAdapt, then restart that app.", + } + steps = ( + "In System Settings > Privacy & Security > System & App Protection " + "Override, click + and add the app that launches OpenAdapt. Choose Apps, " + "then set each target to Ask First or At Any Time. For unrestricted " + "control, select the system-protection override option, confirm its " + "warnings and authenticate. Restart the launching app, then check the " + "selected target." + ) + return { + "setup_mode": scope, + "label": "System & App Protection Override" + if scope == "app_selection" + else "macOS app control", + # No supported direct link to the new pane has been verified. + "settings_url": pane, + "instructions": steps + if scope == "app_selection" + else "On macOS 27.3 or later: " + + steps + + " On earlier macOS, use Privacy & Security > Accessibility instead.", + } diff --git a/packages/desktop/src/lib/types.ts b/packages/desktop/src/lib/types.ts index 1743b68536..c86d55d0a8 100644 --- a/packages/desktop/src/lib/types.ts +++ b/packages/desktop/src/lib/types.ts @@ -1089,9 +1089,15 @@ export interface NeedsAttention { } export interface PermissionStatus { - screen_recording: boolean; - accessibility: boolean; + screen_recording: boolean | null; + accessibility: boolean | null; input_monitoring: boolean; + control_permission?: { + setup_mode: "legacy" | "app_selection" | "unknown"; + label: string; + settings_url: string; + instructions: string; + }; } export interface FfmpegRuntimeStatus { diff --git a/packages/desktop/src/screens/Onboarding.test.tsx b/packages/desktop/src/screens/Onboarding.test.tsx index 0a6a44544d..11948718a8 100644 --- a/packages/desktop/src/screens/Onboarding.test.tsx +++ b/packages/desktop/src/screens/Onboarding.test.tsx @@ -1,4 +1,4 @@ -import { cleanup, render, screen, waitFor } from "@testing-library/react"; +import { cleanup, fireEvent, render, screen, waitFor } from "@testing-library/react"; import { afterEach, expect, it, vi } from "vitest"; // The permission card only renders on macOS, and the platform is read once @@ -15,6 +15,7 @@ vi.mock("../lib/engine", async (importOriginal) => { return { ...actual, engineTry: vi.fn(), + openExternal: vi.fn(), ffmpegRuntimeStatus: vi.fn(async () => ({ phase: "ready", source: "managed", @@ -25,7 +26,7 @@ vi.mock("../lib/engine", async (importOriginal) => { }; }); -import { CMD, engineTry } from "../lib/engine"; +import { CMD, engineTry, openExternal } from "../lib/engine"; import { Onboarding } from "./Onboarding"; afterEach(() => { @@ -50,7 +51,14 @@ it("doesn't call permissions missing when the engine can't check them", async () it("still says a permission is needed when the engine reports it missing", async () => { vi.mocked(engineTry).mockImplementation(async (command, _params, fallback) => { if (command === CMD.CHECK_PERMISSIONS) { - return { screen_recording: true, accessibility: false, input_monitoring: true }; + return { + screen_recording: true, accessibility: false, input_monitoring: true, + control_permission: { + setup_mode: "legacy", label: "Accessibility", + settings_url: "x-apple.systempreferences:com.apple.preference.security?Privacy_Accessibility", + instructions: "Use Accessibility on earlier macOS.", + }, + }; } return fallback; }); @@ -61,3 +69,48 @@ it("still says a permission is needed when the engine reports it missing", async expect(screen.getAllByText("granted")).toHaveLength(2); expect(screen.getByText(/Grant the permissions below/)).toBeTruthy(); }); + + +it.each([true, false, null])("shows scoped control guidance without claiming a global grant (%s)", async (trusted) => { + vi.mocked(engineTry).mockImplementation(async (command, _params, fallback) => { + if (command === CMD.CHECK_PERMISSIONS) { + return { + screen_recording: true, accessibility: trusted, input_monitoring: true, + control_permission: { + setup_mode: "app_selection", label: "System & App Protection Override", + settings_url: "x-apple.systempreferences:com.apple.preference.security", + instructions: "Click +, Choose Apps, then select Ask First or At Any Time.", + }, + }; + } + return fallback; + }); + render( {}} />); + expect(await screen.findByText("System & App Protection Override")).toBeTruthy(); + expect(screen.getByText(trusted ? "check target" : "not confirmed")).toBeTruthy(); + expect(screen.getAllByText("granted")).toHaveLength(2); + expect(screen.queryByText("Accessibility")).toBeNull(); + fireEvent.click(screen.getByRole("button", { name: "Open settings" })); + expect(openExternal).toHaveBeenCalledWith("x-apple.systempreferences:com.apple.preference.security"); + const start = screen.getByRole("button", { name: "Choose an app and workflow" }); + expect((start as HTMLButtonElement).disabled).toBe(!trusted); +}); + +it("keeps an unavailable native API unknown on the legacy path", async () => { + vi.mocked(engineTry).mockImplementation(async (command, _params, fallback) => { + if (command === CMD.CHECK_PERMISSIONS) { + return { + screen_recording: null, accessibility: null, input_monitoring: true, + control_permission: { + setup_mode: "legacy", label: "Accessibility", settings_url: "legacy-settings", + instructions: "Use Accessibility on earlier macOS.", + }, + }; + } + return fallback; + }); + render( {}} />); + await waitFor(() => expect(screen.getAllByText("unknown")).toHaveLength(2)); + expect(screen.queryByText("needed")).toBeNull(); + expect((screen.getByRole("button", { name: "Choose an app and workflow" }) as HTMLButtonElement).disabled).toBe(true); +}); diff --git a/packages/desktop/src/screens/Onboarding.tsx b/packages/desktop/src/screens/Onboarding.tsx index 6bfd0c97c1..2d3167404f 100644 --- a/packages/desktop/src/screens/Onboarding.tsx +++ b/packages/desktop/src/screens/Onboarding.tsx @@ -20,8 +20,15 @@ const MAC = // Deep links to the exact System Settings panes (macOS). const SCREEN_PANE = "x-apple.systempreferences:com.apple.preference.security?Privacy_ScreenCapture"; -const AX_PANE = - "x-apple.systempreferences:com.apple.preference.security?Privacy_Accessibility"; +const UNKNOWN_CONTROL = { + setup_mode: "unknown", + label: "macOS app control", + settings_url: "x-apple.systempreferences:com.apple.preference.security", + instructions: + "On macOS 27.3 or later, open System & App Protection Override, add the " + + "launching app with +, then choose the apps it may control. On earlier " + + "macOS, use Accessibility.", +}; const INPUT_PANE = "x-apple.systempreferences:com.apple.preference.security?Privacy_ListenEvent"; @@ -31,8 +38,8 @@ const UNKNOWN: PermissionStatus = { input_monitoring: false, }; -function permissionPill(granted: boolean, known: boolean) { - if (!known) return unknown; +function permissionPill(granted: boolean | null, known: boolean) { + if (!known || granted === null) return unknown; return ( {granted ? "granted" : "needed"} ); @@ -87,12 +94,13 @@ export function Onboarding({ onStart }: { onStart?: () => void }) { } } + const control = perms.control_permission ?? UNKNOWN_CONTROL; const permissionsReady = !MAC || (known && - perms.screen_recording && - perms.accessibility && - perms.input_monitoring); + perms.screen_recording === true && + perms.accessibility === true && + perms.input_monitoring === true); const videoReady = videoRuntime.phase === "ready"; const ready = permissionsReady && videoReady; const videoBusy = ["checking", "downloading", "verifying"].includes( @@ -141,7 +149,7 @@ export function Onboarding({ onStart }: { onStart?: () => void }) {
@@ -153,13 +161,20 @@ export function Onboarding({ onStart }: { onStart?: () => void }) {
- {permissionPill(perms.accessibility, known)} + {control.setup_mode === "legacy" ? ( + permissionPill(perms.accessibility, known) + ) : ( + + {!known ? "unknown" : perms.accessibility ? "check target" : "not confirmed"} + + )} - Accessibility -
+

{control.instructions}

{permissionPill(perms.input_monitoring, known)} diff --git a/packages/desktop/tests/test_engine/test_capabilities.py b/packages/desktop/tests/test_engine/test_capabilities.py index b9d6fae7c8..a2be115e18 100644 --- a/packages/desktop/tests/test_engine/test_capabilities.py +++ b/packages/desktop/tests/test_engine/test_capabilities.py @@ -40,6 +40,8 @@ def _versions(monkeypatch, versions: dict[str, str]) -> None: def _platform(monkeypatch, value: str) -> None: monkeypatch.setattr("openadapt_desktop.capabilities.sys.platform", value) + monkeypatch.setattr(capabilities, "_mac_accessibility_trusted", lambda: True) + monkeypatch.setattr(capabilities, "_mac_screen_recording_granted", lambda: True) class TestWebSurface: @@ -527,3 +529,21 @@ def test_human_output_lists_every_surface(self, tmp_path, monkeypatch, capsys) - out = capsys.readouterr().out for surface in SURFACES: assert surface in out + + +@pytest.mark.parametrize("probe", ["_mac_accessibility_trusted", "_mac_screen_recording_granted"]) +@pytest.mark.parametrize("value", [False, None]) +def test_unknown_or_denied_mac_api_never_becomes_available(monkeypatch, probe, value): + _platform(monkeypatch, "darwin") + _specs(monkeypatch, {"ApplicationServices"}) + monkeypatch.setattr(capabilities, probe, lambda: value) + assert capabilities._check_macos().state == "permission_required" + + +@pytest.mark.parametrize("surface", ["rdp", "citrix"]) +def test_unknown_mac_screen_capture_refuses_client_window_surface(monkeypatch, surface): + _platform(monkeypatch, "darwin") + _specs(monkeypatch, {"Quartz"}) + monkeypatch.setattr(capabilities, "_mac_screen_recording_granted", lambda: None) + monkeypatch.setattr(capabilities, "_citrix_workspace_installed", lambda: (True, "1.0")) + assert getattr(capabilities, "_check_" + surface)().state == "permission_required" diff --git a/packages/desktop/tests/test_engine/test_dispatch.py b/packages/desktop/tests/test_engine/test_dispatch.py index 529b1bef18..444502bc56 100644 --- a/packages/desktop/tests/test_engine/test_dispatch.py +++ b/packages/desktop/tests/test_engine/test_dispatch.py @@ -14,6 +14,7 @@ from openadapt_desktop.db import IndexDB from openadapt_desktop.dispatch import EngineDispatcher, EngineServices from openadapt_desktop.flow_bridge import FlowBridge +from openadapt_desktop.macos_permissions import control_permission_guidance def _precise_report( @@ -2686,6 +2687,7 @@ def test_mac_permission_check_is_prompt_free(self, deps, monkeypatch) -> None: "screen_recording": True, "accessibility": False, "input_monitoring": False, + "control_permission": control_permission_guidance(), } def test_non_mac_input_monitoring_request_returns_granted_shape( @@ -2726,6 +2728,7 @@ def test_mac_input_monitoring_request_rechecks_authoritative_state( "screen_recording": True, "accessibility": True, "input_monitoring": True, + "control_permission": control_permission_guidance(), } assert requests == [True] @@ -2745,6 +2748,7 @@ def test_mac_input_monitoring_request_does_not_assume_success(self, deps, monkey "screen_recording": True, "accessibility": True, "input_monitoring": False, + "control_permission": control_permission_guidance(), } def test_mac_input_monitoring_request_skips_prompt_when_already_granted( @@ -2766,6 +2770,7 @@ def test_mac_input_monitoring_request_skips_prompt_when_already_granted( "screen_recording": True, "accessibility": True, "input_monitoring": True, + "control_permission": control_permission_guidance(), } def test_unknown_command_raises(self, deps) -> None: diff --git a/packages/desktop/tests/test_engine/test_mac_permission_status.py b/packages/desktop/tests/test_engine/test_mac_permission_status.py new file mode 100644 index 0000000000..5e158f570f --- /dev/null +++ b/packages/desktop/tests/test_engine/test_mac_permission_status.py @@ -0,0 +1,29 @@ +"""Unavailable native APIs remain unknown, not a claimed grant.""" + +import sys +from types import ModuleType + +import pytest + +from openadapt_desktop import dispatch + + +@pytest.mark.parametrize( + "module, symbol, check", + [ + ("Quartz", "CGPreflightScreenCaptureAccess", dispatch._mac_preflight_screen), + ("ApplicationServices", "AXIsProcessTrusted", dispatch._mac_preflight_accessibility), + ], +) +@pytest.mark.parametrize("answer", [True, False, None]) +def test_passive_permission_result_preserves_unknown(monkeypatch, module, symbol, check, answer): + fake = ModuleType(module) + + def probe(): + if answer is None: + raise RuntimeError("unavailable synthetic permission API") + return answer + + setattr(fake, symbol, probe) + monkeypatch.setitem(sys.modules, module, fake) + assert check() is answer diff --git a/packages/flow/openadapt_flow/backends/macos_backend.py b/packages/flow/openadapt_flow/backends/macos_backend.py index 91dcd2fbe7..8ebe08a06a 100644 --- a/packages/flow/openadapt_flow/backends/macos_backend.py +++ b/packages/flow/openadapt_flow/backends/macos_backend.py @@ -1467,11 +1467,13 @@ def ensure_foreground( def _ensure_input_trusted(self) -> None: if self._require_input_trust and not self._mac_client.input_trusted(): + from openadapt_flow.macos_permissions import control_permission_guidance + + guidance = control_permission_guidance() raise MacOSBackendError( - "Accessibility is not granted, so macOS would silently drop " - "synthetic input. In System Settings > Privacy & Security > " - "Accessibility, enable the app that launches openadapt-flow, " - "then restart it. Refusing to emit input." + "macOS process input trust is not confirmed. " + + guidance["instructions"] + + " Refusing to emit input." ) def _ensure_input_ready( diff --git a/packages/flow/openadapt_flow/backends/remote_display.py b/packages/flow/openadapt_flow/backends/remote_display.py index 4207343008..0e86568029 100644 --- a/packages/flow/openadapt_flow/backends/remote_display.py +++ b/packages/flow/openadapt_flow/backends/remote_display.py @@ -33,13 +33,11 @@ PHI-free on-screen application/workflow/session markers or a live session digest observer. Those observers never expose captured text. -Permission reality (macOS, and the honest failure mode): window capture needs -**Screen Recording** permission and input injection needs **Accessibility** -permission for the driving app (Terminal / the Python host). If Accessibility is -not granted, ``CGEventPost`` is **silently dropped** — a dropped click that looked -like success is the exact "silent wrong action" this project refuses. So every -input method FAILS LOUD (raises :class:`RemoteDisplayError`) when the process is -not Accessibility-trusted; a caller never mistakes a no-op for a completed action. +Permission checks: capture needs Screen Recording; app control uses Accessibility +before macOS 27.3 and System & App Protection Override on macOS 27.3 or later. +Process AX trust remains a conservative preflight, not proof of target-app scope. +Input still requires the exact target/focus/frame checks below. A denied or +unconfirmed permission must never turn a dropped event into a claimed effect. The macOS bindings are isolated behind :class:`MacWindowClient` (a small :class:`WindowClient` seam) so the coordinate math, the pixel<->point mapping, and @@ -527,7 +525,7 @@ class WindowClient(Protocol): """ def input_trusted(self) -> bool: - """True iff this process may inject OS input (Accessibility granted).""" + """Process input preflight; callers must also verify the exact target.""" ... def frontmost_pid(self) -> Optional[int]: @@ -1614,8 +1612,9 @@ def _ensure_input_ready( if self._require_input_trust and not self._client.input_trusted(): raise RemoteDisplayError( "process is not trusted to inject OS input, so input would be " - "silently dropped. macOS: grant Accessibility to the driving " - "app (System Settings > Privacy & Security > Accessibility). " + "silently dropped. macOS: " + + _mac_control_remedy() + + " " "Windows: the target window belongs to an elevated (or " "unknown-elevation) process and UIPI would discard our input " "— run the driver elevated. Refusing to emit an input that " @@ -2019,6 +2018,12 @@ def _hit_test_pid(x: float, y: float) -> Optional[int]: return None +def _mac_control_remedy() -> str: + from openadapt_flow.macos_permissions import control_permission_guidance + + return control_permission_guidance()["instructions"] + + class MacWindowClient: """Live :class:`WindowClient` over Quartz (capture/input) + AppKit (activate). @@ -2064,7 +2069,11 @@ def request_capture_access(self) -> bool: return False def request_input_access(self) -> bool: - """Ask macOS to show its Accessibility consent prompt.""" + """Request legacy consent; newer macOS requires manual Settings setup.""" + from openadapt_flow.macos_permissions import control_permission_guidance + + if control_permission_guidance()["setup_mode"] != "legacy": + return self.input_trusted() services = _pyobjc_module("ApplicationServices") try: return bool( diff --git a/packages/flow/openadapt_flow/macos_permissions.py b/packages/flow/openadapt_flow/macos_permissions.py new file mode 100644 index 0000000000..2793f80733 --- /dev/null +++ b/packages/flow/openadapt_flow/macos_permissions.py @@ -0,0 +1,54 @@ +"""Version-aware macOS permission guidance; never an access decision. + +Kept dependency-free in each independently installable package. The shared +conformance cases in tests/test_macos_permission_guidance.py cover all copies. +""" + +from __future__ import annotations + +import platform +import re + + +def control_permission_guidance(version: str | None = None) -> dict[str, str]: + """Describe setup without inferring target access from process AX trust.""" + if version is None: + try: + version = platform.mac_ver()[0] + except Exception: + version = "" + valid = re.fullmatch(r"[0-9]+\.[0-9]+(?:\.[0-9]+)?", version) + scope = "unknown" + if valid: + parts = tuple(int(part) for part in version.split(".")[:2]) + scope = "app_selection" if parts >= (27, 3) else "legacy" + pane = "x-apple.systempreferences:com.apple.preference.security" + if scope == "legacy": + return { + "setup_mode": scope, + "label": "Accessibility", + "settings_url": pane + "?Privacy_Accessibility", + "instructions": "In System Settings > Privacy & Security > Accessibility, " + "enable the app that launches OpenAdapt, then restart that app.", + } + steps = ( + "In System Settings > Privacy & Security > System & App Protection " + "Override, click + and add the app that launches OpenAdapt. Choose Apps, " + "then set each target to Ask First or At Any Time. For unrestricted " + "control, select the system-protection override option, confirm its " + "warnings and authenticate. Restart the launching app, then check the " + "selected target." + ) + return { + "setup_mode": scope, + "label": "System & App Protection Override" + if scope == "app_selection" + else "macOS app control", + # No supported direct link to the new pane has been verified. + "settings_url": pane, + "instructions": steps + if scope == "app_selection" + else "On macOS 27.3 or later: " + + steps + + " On earlier macOS, use Privacy & Security > Accessibility instead.", + } diff --git a/packages/flow/tests/test_macos_backend.py b/packages/flow/tests/test_macos_backend.py index bc54076bb4..b886daa33a 100644 --- a/packages/flow/tests/test_macos_backend.py +++ b/packages/flow/tests/test_macos_backend.py @@ -377,14 +377,19 @@ def test_ambiguous_selector_refuses_bound_text_without_any_fallback() -> None: assert not client.calls -def test_capture_and_input_permissions_fail_loud() -> None: +@pytest.mark.parametrize("version, pane", [ + ("27.2", "Accessibility"), ("27.3", "System & App Protection Override"), + ("27.10", "System & App Protection Override"), ("28.0", "System & App Protection Override"), +]) +def test_capture_and_input_permissions_fail_loud(monkeypatch, version, pane) -> None: + monkeypatch.setattr("openadapt_flow.macos_permissions.platform.mac_ver", lambda: (version, (), "")) capture_client = FakeMacClient(capture_trusted=False) with pytest.raises(MacOSBackendError, match="Screen Recording"): backend(capture_client).screenshot() assert not capture_client.calls input_client = FakeMacClient(input_trusted=False) - with pytest.raises(MacOSBackendError, match="Accessibility"): + with pytest.raises(MacOSBackendError, match=pane): backend(input_client).type_text("must not land") assert not input_client.calls diff --git a/packages/flow/tests/test_macos_backend_missing_pyobjc.py b/packages/flow/tests/test_macos_backend_missing_pyobjc.py index c6e43f7384..b3df68c50f 100644 --- a/packages/flow/tests/test_macos_backend_missing_pyobjc.py +++ b/packages/flow/tests/test_macos_backend_missing_pyobjc.py @@ -108,3 +108,26 @@ def test_granted_permissions_still_read_as_trusted( client = MacWindowClient() assert client.capture_trusted() is True assert client.input_trusted() is True + + +@pytest.mark.parametrize("version", ["27.2", "27.3", "27.10.0", "28.0", ""]) +@pytest.mark.parametrize("trusted", [True, False]) +def test_new_permission_setup_never_uses_the_legacy_consent_prompt( + monkeypatch, version, trusted +): + from openadapt_flow.backends import remote_display + + monkeypatch.setattr( + "openadapt_flow.macos_permissions.platform.mac_ver", lambda: (version, (), "") + ) + prompts = [] + services = types.SimpleNamespace( + AXIsProcessTrusted=lambda: trusted, + AXIsProcessTrustedWithOptions=lambda options: ( + prompts.append(options) or trusted + ), + kAXTrustedCheckOptionPrompt="prompt", + ) + monkeypatch.setattr(remote_display, "_pyobjc_module", lambda _name: services) + assert MacWindowClient().request_input_access() is trusted + assert prompts == ([{"prompt": True}] if version == "27.2" else []) diff --git a/tests/test_doctor_setup.py b/tests/test_doctor_setup.py index f51a3ac44a..a7a8d23602 100644 --- a/tests/test_doctor_setup.py +++ b/tests/test_doctor_setup.py @@ -186,6 +186,9 @@ def test_invalid_options_refuse_before_any_diagnostics(monkeypatch, options): def _mac_consent(monkeypatch, input_grant, capture_grant): + monkeypatch.setattr( + "openadapt.macos_permissions.platform.mac_ver", lambda: ("15.0", (), "") + ) calls = [] def check(name, value): @@ -452,3 +455,21 @@ def resolve(*args): "--upgrade", "openadapt-capture>=1.3.0,<2.0.0", ] + + +@pytest.mark.parametrize("version", ["27.3", "27.10.0", "28.0"]) +@pytest.mark.parametrize("trusted", [True, False]) +def test_new_macos_does_not_treat_process_trust_as_target_grant( + monkeypatch, version, trusted +): + _mac_consent(monkeypatch, trusted, True) + monkeypatch.setattr( + "openadapt.macos_permissions.platform.mac_ver", lambda: (version, (), "") + ) + result = CliRunner().invoke(cli.main, ["doctor", "--backend", "macos"]) + assert result.exit_code == (0 if trusted else 1), result.output + assert "System & App Protection Override" in result.output + assert "does not verify access to the selected app" in result.output + assert "Choose Apps" in result.output + assert "[OK] System & App Protection Override" not in result.output + assert "[MISSING] System & App Protection Override" not in result.output diff --git a/tests/test_macos_permission_guidance.py b/tests/test_macos_permission_guidance.py new file mode 100644 index 0000000000..c0225db827 --- /dev/null +++ b/tests/test_macos_permission_guidance.py @@ -0,0 +1,48 @@ +"""One version/scope model across independently installed Python packages.""" + +import runpy +from pathlib import Path + +import pytest + +ROOT = Path(__file__).resolve().parents[1] +GUIDES = [ + runpy.run_path(str(ROOT / path))["control_permission_guidance"] + for path in ( + "openadapt/macos_permissions.py", + "packages/flow/openadapt_flow/macos_permissions.py", + "packages/desktop/openadapt_desktop/macos_permissions.py", + "packages/capture/openadapt_capture/macos_permissions.py", + ) +] + + +def test_numeric_version_boundary_is_the_same_at_every_entry_point(): + for major in (10, 15, 26, 27, 28, 30): + for minor in range(13): + for patch in ("", ".0", ".12"): + version = f"{major}.{minor}{patch}" + expected = "app_selection" if (major, minor) >= (27, 3) else "legacy" + results = [guide(version) for guide in GUIDES] + assert all(result == results[0] for result in results) + for result in results: + assert result["setup_mode"] == expected + if expected == "legacy": + assert result["label"] == "Accessibility" + assert result["settings_url"].endswith("?Privacy_Accessibility") + else: + assert result["label"] == "System & App Protection Override" + assert "?" not in result["settings_url"] + assert "Choose Apps" in result["instructions"] + assert "Ask First" in result["instructions"] + assert "At Any Time" in result["instructions"] + + +@pytest.mark.parametrize("version", ["", "27", "27.x", "27.3beta2", "-1.0", "27.3.0.1"]) +def test_unknown_version_does_not_invent_a_permission_or_pane(version): + for guide in GUIDES: + result = guide(version) + assert result["setup_mode"] == "unknown" + assert result["label"] == "macOS app control" + assert "?" not in result["settings_url"] + assert "earlier macOS" in result["instructions"] From b3a9841e8ece9ba895f5df26120e5d6a378cb0a5 Mon Sep 17 00:00:00 2001 From: abrichr Date: Fri, 20 Nov 2026 12:16:15 -0500 Subject: [PATCH 2/7] fix(desktop): keep permission guidance within the size budget --- docs/results/macos-27-3-permission-guidance-2026-11-20.md | 4 +++- packages/desktop/openadapt_desktop/dispatch.py | 3 +-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/results/macos-27-3-permission-guidance-2026-11-20.md b/docs/results/macos-27-3-permission-guidance-2026-11-20.md index baad0f434b..7a6b205d1c 100644 --- a/docs/results/macos-27-3-permission-guidance-2026-11-20.md +++ b/docs/results/macos-27-3-permission-guidance-2026-11-20.md @@ -33,7 +33,9 @@ lacked Flow cryptography; combining the packages collided on their separate `tests` namespaces; the Flow interpreter lacked Capture's fire dependency. Each package was then tested separately in its appropriate existing interpreter. A local path typo was corrected before final formatting/type validation. These -setup failures are not test passes or source defects. The final Capture group +setup failures are not test passes or source defects. The source-growth check +first found dispatch one line over its existing budget; moving the pure guidance +import to module scope removed the extra line without raising the budget. The final Capture group retains its existing SQLAlchemy deprecation warning; Vite retains its config loader warning. diff --git a/packages/desktop/openadapt_desktop/dispatch.py b/packages/desktop/openadapt_desktop/dispatch.py index 74258a6103..88cca31a8e 100644 --- a/packages/desktop/openadapt_desktop/dispatch.py +++ b/packages/desktop/openadapt_desktop/dispatch.py @@ -45,6 +45,7 @@ from loguru import logger from openadapt_desktop.config import EngineConfig +from openadapt_desktop.macos_permissions import control_permission_guidance from openadapt_desktop.private_fs import ensure_private_dir EmitFn = Callable[[str, dict], None] @@ -6241,8 +6242,6 @@ def check_permissions(self, **params: Any) -> dict: screen = _mac_preflight_screen() access = _mac_preflight_accessibility() input_monitoring = _mac_preflight_input_monitoring() - from .macos_permissions import control_permission_guidance - return { "screen_recording": screen, "accessibility": access, From bc20a3b58025d417a86f13967f6147cb676920e5 Mon Sep 17 00:00:00 2001 From: abrichr Date: Fri, 20 Nov 2026 12:18:42 -0500 Subject: [PATCH 3/7] docs: record macOS review-only release hold --- .../macos-27-3-permission-guidance-2026-11-20.md | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/docs/results/macos-27-3-permission-guidance-2026-11-20.md b/docs/results/macos-27-3-permission-guidance-2026-11-20.md index 7a6b205d1c..43f57e2950 100644 --- a/docs/results/macos-27-3-permission-guidance-2026-11-20.md +++ b/docs/results/macos-27-3-permission-guidance-2026-11-20.md @@ -22,9 +22,9 @@ version, native entitlement or workflow is changed. | Desktop TypeScript | Passed, no emit | Python checks used CPython 3.12.13 with source paths bound to this checkout. -Desktop test additions used task-local dependencies, including Pydantic2.14.4; +Desktop test additions used task-local dependencies, including Pydantic 2.14.4; they are not a new locked-runtime qualification. Capture used its existing -complete 3.12.13 test interpreter. UI used Node22.22.2 and the exact npm lock. +complete 3.12.13 test interpreter. UI used Node 22.22.2 and the exact npm lock. All tests ran headlessly through the shared CPU-slot wrapper, sequential package processes for Python. No native permission API, desktop input or GUI was driven. @@ -41,7 +41,7 @@ loader warning. ## Remaining beta checks -No macOS27.3 machine was identified. Test the exact new-pane deep link, whether +No macOS 27.3 machine was identified. Test the exact new-pane deep link, whether AX process trust reflects each override mode, UI reads versus posted input, Choose Apps with allowed/disallowed targets, Ask First cancellation, and old migrated grants on a beta machine before merging. The code does not invent a @@ -50,3 +50,8 @@ trust as proof of all target-app grants. General-availability timing is unknown. Primary references and beta2 known-issue identifiers are in [the permission guide](../getting-started/permissions.md). + +The unchanged Desktop release-intent check exits 1 and requests at least a patch +bump from 0.30.6 before eventual delivery. No version bump is included because +this PR is explicitly review-only and must remain unmerged. The check is not +waived; release preparation belongs to a later approved candidate. From 9b91c74ed687cd3e073e21d2a51e8ccc47c4a21e Mon Sep 17 00:00:00 2001 From: abrichr Date: Mon, 23 Nov 2026 19:56:41 -0500 Subject: [PATCH 4/7] chore(desktop): release 0.32.3 --- packages/desktop/CHANGELOG.md | 9 +++++++++ packages/desktop/openadapt_desktop/__init__.py | 2 +- packages/desktop/package-lock.json | 4 ++-- packages/desktop/package.json | 2 +- packages/desktop/pyproject.toml | 2 +- packages/desktop/src-tauri/Cargo.lock | 2 +- packages/desktop/src-tauri/Cargo.toml | 2 +- packages/desktop/src-tauri/tauri.conf.json | 2 +- packages/desktop/uv.lock | 2 +- 9 files changed, 18 insertions(+), 9 deletions(-) diff --git a/packages/desktop/CHANGELOG.md b/packages/desktop/CHANGELOG.md index 904bbab7fe..ca9c421ea0 100644 --- a/packages/desktop/CHANGELOG.md +++ b/packages/desktop/CHANGELOG.md @@ -1,6 +1,15 @@ # CHANGELOG +## v0.32.3 (2026-11-23) + +### Bug Fixes + +- **desktop**: keep permission guidance within the size budget +- **macos**: guide 27.3 app-control permissions conservatively + + + ## Unreleased diff --git a/packages/desktop/openadapt_desktop/__init__.py b/packages/desktop/openadapt_desktop/__init__.py index 05f3a6b4d0..4a4953b638 100644 --- a/packages/desktop/openadapt_desktop/__init__.py +++ b/packages/desktop/openadapt_desktop/__init__.py @@ -21,4 +21,4 @@ +-- backends/ Storage backend plugins """ -__version__ = "0.32.2" +__version__ = "0.32.3" diff --git a/packages/desktop/package-lock.json b/packages/desktop/package-lock.json index edbe46f1f3..0430ebcdf2 100644 --- a/packages/desktop/package-lock.json +++ b/packages/desktop/package-lock.json @@ -1,12 +1,12 @@ { "name": "openadapt-desktop", - "version": "0.32.2", + "version": "0.32.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "openadapt-desktop", - "version": "0.32.2", + "version": "0.32.3", "dependencies": { "@tauri-apps/api": "^2", "@tauri-apps/plugin-notification": "^2", diff --git a/packages/desktop/package.json b/packages/desktop/package.json index fa75f72cfb..966a77bf82 100644 --- a/packages/desktop/package.json +++ b/packages/desktop/package.json @@ -1,6 +1,6 @@ { "name": "openadapt-desktop", - "version": "0.32.2", + "version": "0.32.3", "description": "Installed companion for OpenAdapt authoring, teaching, and local pairing", "private": true, "type": "module", diff --git a/packages/desktop/pyproject.toml b/packages/desktop/pyproject.toml index 98316057b3..c8e529baba 100644 --- a/packages/desktop/pyproject.toml +++ b/packages/desktop/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "hatchling.build" [project] name = "openadapt-desktop" -version = "0.32.2" +version = "0.32.3" description = "The OpenAdapt desktop app and local engine: record a data-entry task, run it on a list, and check each saved record" readme = "README.md" requires-python = ">=3.11" diff --git a/packages/desktop/src-tauri/Cargo.lock b/packages/desktop/src-tauri/Cargo.lock index aa6f5c6b7f..4783a3845a 100644 --- a/packages/desktop/src-tauri/Cargo.lock +++ b/packages/desktop/src-tauri/Cargo.lock @@ -2513,7 +2513,7 @@ dependencies = [ [[package]] name = "openadapt-desktop" -version = "0.32.2" +version = "0.32.3" dependencies = [ "hex", "reqwest", diff --git a/packages/desktop/src-tauri/Cargo.toml b/packages/desktop/src-tauri/Cargo.toml index 31933aba9b..1c803f04f1 100644 --- a/packages/desktop/src-tauri/Cargo.toml +++ b/packages/desktop/src-tauri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "openadapt-desktop" -version = "0.32.2" +version = "0.32.3" description = "Installed companion for OpenAdapt authoring, teaching, and local pairing" authors = ["OpenAdapt AI"] license = "MIT" diff --git a/packages/desktop/src-tauri/tauri.conf.json b/packages/desktop/src-tauri/tauri.conf.json index 83f1b0af6d..4a2b950416 100644 --- a/packages/desktop/src-tauri/tauri.conf.json +++ b/packages/desktop/src-tauri/tauri.conf.json @@ -1,7 +1,7 @@ { "$schema": "https://raw.githubusercontent.com/nicoverbruggen/tauri-v2-schema/main/schema.json", "productName": "OpenAdapt Desktop", - "version": "0.32.2", + "version": "0.32.3", "identifier": "ai.openadapt.desktop", "build": { "frontendDist": "../dist", diff --git a/packages/desktop/uv.lock b/packages/desktop/uv.lock index ab525a08fb..fee19a1494 100644 --- a/packages/desktop/uv.lock +++ b/packages/desktop/uv.lock @@ -1172,7 +1172,7 @@ wheels = [ [[package]] name = "openadapt-desktop" -version = "0.32.2" +version = "0.32.3" source = { editable = "." } dependencies = [ { name = "cryptography" }, From a5059210ede19eb2efa00bc2215ee4e22cefc4cf Mon Sep 17 00:00:00 2001 From: abrichr Date: Mon, 23 Nov 2026 20:06:11 -0500 Subject: [PATCH 5/7] chore(desktop): keep dispatch.py within file-size budget --- packages/desktop/openadapt_desktop/dispatch.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/packages/desktop/openadapt_desktop/dispatch.py b/packages/desktop/openadapt_desktop/dispatch.py index 5e12a3f58f..7653e0b7eb 100644 --- a/packages/desktop/openadapt_desktop/dispatch.py +++ b/packages/desktop/openadapt_desktop/dispatch.py @@ -6241,13 +6241,10 @@ def check_permissions(self, **params: Any) -> dict: "accessibility": True, "input_monitoring": True, } - screen = _mac_preflight_screen() - access = _mac_preflight_accessibility() - input_monitoring = _mac_preflight_input_monitoring() return { - "screen_recording": screen, - "accessibility": access, - "input_monitoring": input_monitoring, + "screen_recording": _mac_preflight_screen(), + "accessibility": _mac_preflight_accessibility(), + "input_monitoring": _mac_preflight_input_monitoring(), "control_permission": control_permission_guidance(), } From d50bf8a7ed30abe6babf3be20ec9e6dabfc16403 Mon Sep 17 00:00:00 2001 From: abrichr Date: Mon, 23 Nov 2026 20:45:20 -0500 Subject: [PATCH 6/7] style(flow): format macOS permission backend and test files --- .../openadapt_flow/backends/remote_display.py | 4 +--- packages/flow/tests/test_macos_backend.py | 17 ++++++++++++----- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/packages/flow/openadapt_flow/backends/remote_display.py b/packages/flow/openadapt_flow/backends/remote_display.py index 0e86568029..78beeb1884 100644 --- a/packages/flow/openadapt_flow/backends/remote_display.py +++ b/packages/flow/openadapt_flow/backends/remote_display.py @@ -1612,9 +1612,7 @@ def _ensure_input_ready( if self._require_input_trust and not self._client.input_trusted(): raise RemoteDisplayError( "process is not trusted to inject OS input, so input would be " - "silently dropped. macOS: " - + _mac_control_remedy() - + " " + "silently dropped. macOS: " + _mac_control_remedy() + " " "Windows: the target window belongs to an elevated (or " "unknown-elevation) process and UIPI would discard our input " "— run the driver elevated. Refusing to emit an input that " diff --git a/packages/flow/tests/test_macos_backend.py b/packages/flow/tests/test_macos_backend.py index b886daa33a..2d523d4f63 100644 --- a/packages/flow/tests/test_macos_backend.py +++ b/packages/flow/tests/test_macos_backend.py @@ -377,12 +377,19 @@ def test_ambiguous_selector_refuses_bound_text_without_any_fallback() -> None: assert not client.calls -@pytest.mark.parametrize("version, pane", [ - ("27.2", "Accessibility"), ("27.3", "System & App Protection Override"), - ("27.10", "System & App Protection Override"), ("28.0", "System & App Protection Override"), -]) +@pytest.mark.parametrize( + "version, pane", + [ + ("27.2", "Accessibility"), + ("27.3", "System & App Protection Override"), + ("27.10", "System & App Protection Override"), + ("28.0", "System & App Protection Override"), + ], +) def test_capture_and_input_permissions_fail_loud(monkeypatch, version, pane) -> None: - monkeypatch.setattr("openadapt_flow.macos_permissions.platform.mac_ver", lambda: (version, (), "")) + monkeypatch.setattr( + "openadapt_flow.macos_permissions.platform.mac_ver", lambda: (version, (), "") + ) capture_client = FakeMacClient(capture_trusted=False) with pytest.raises(MacOSBackendError, match="Screen Recording"): backend(capture_client).screenshot() From 06f130de6091256972e0583d362484ce0b77a1ff Mon Sep 17 00:00:00 2001 From: abrichr Date: Mon, 23 Nov 2026 21:07:13 -0500 Subject: [PATCH 7/7] fix(macos): narrow mac_ver exception catch in permission guidance --- openadapt/macos_permissions.py | 2 +- packages/capture/openadapt_capture/macos_permissions.py | 2 +- packages/desktop/openadapt_desktop/macos_permissions.py | 2 +- packages/flow/openadapt_flow/macos_permissions.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/openadapt/macos_permissions.py b/openadapt/macos_permissions.py index 2793f80733..9c2aa378f1 100644 --- a/openadapt/macos_permissions.py +++ b/openadapt/macos_permissions.py @@ -15,7 +15,7 @@ def control_permission_guidance(version: str | None = None) -> dict[str, str]: if version is None: try: version = platform.mac_ver()[0] - except Exception: + except (OSError, ValueError, TypeError, RuntimeError): version = "" valid = re.fullmatch(r"[0-9]+\.[0-9]+(?:\.[0-9]+)?", version) scope = "unknown" diff --git a/packages/capture/openadapt_capture/macos_permissions.py b/packages/capture/openadapt_capture/macos_permissions.py index 2793f80733..9c2aa378f1 100644 --- a/packages/capture/openadapt_capture/macos_permissions.py +++ b/packages/capture/openadapt_capture/macos_permissions.py @@ -15,7 +15,7 @@ def control_permission_guidance(version: str | None = None) -> dict[str, str]: if version is None: try: version = platform.mac_ver()[0] - except Exception: + except (OSError, ValueError, TypeError, RuntimeError): version = "" valid = re.fullmatch(r"[0-9]+\.[0-9]+(?:\.[0-9]+)?", version) scope = "unknown" diff --git a/packages/desktop/openadapt_desktop/macos_permissions.py b/packages/desktop/openadapt_desktop/macos_permissions.py index 2793f80733..9c2aa378f1 100644 --- a/packages/desktop/openadapt_desktop/macos_permissions.py +++ b/packages/desktop/openadapt_desktop/macos_permissions.py @@ -15,7 +15,7 @@ def control_permission_guidance(version: str | None = None) -> dict[str, str]: if version is None: try: version = platform.mac_ver()[0] - except Exception: + except (OSError, ValueError, TypeError, RuntimeError): version = "" valid = re.fullmatch(r"[0-9]+\.[0-9]+(?:\.[0-9]+)?", version) scope = "unknown" diff --git a/packages/flow/openadapt_flow/macos_permissions.py b/packages/flow/openadapt_flow/macos_permissions.py index 2793f80733..9c2aa378f1 100644 --- a/packages/flow/openadapt_flow/macos_permissions.py +++ b/packages/flow/openadapt_flow/macos_permissions.py @@ -15,7 +15,7 @@ def control_permission_guidance(version: str | None = None) -> dict[str, str]: if version is None: try: version = platform.mac_ver()[0] - except Exception: + except (OSError, ValueError, TypeError, RuntimeError): version = "" valid = re.fullmatch(r"[0-9]+\.[0-9]+(?:\.[0-9]+)?", version) scope = "unknown"