Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.
Python agent-orchestrationai-agentai-coding-assistantclaude-codecoding-agentcomputer-usedesktop-applocal-firstmcppersonal-jarvisvoice-assistantvoice-coding
fix(platform): a suppressed macOS permission prompt stops promising a restart-only path
rubenluetke10-beep0117cada06ef
diff --git a/jarvis/platform/permissions.py b/jarvis/platform/permissions.pyindex c6051c36a1..d1b12c09fd 100644--- a/jarvis/platform/permissions.py+++ b/jarvis/platform/permissions.py@@ -605,24 +605,32 @@ class SystemPermissionPort:return "Bring Personal Jarvis to the foreground and try again."return None- def _native_request(self, permission_id: PermissionId) -> None:+ def _native_request(self, permission_id: PermissionId) -> bool | None:+ """Fire the native prompt API; return its boolean where one exists.++ The CG*/AX requesters report ``True`` when access is (already) granted+ and ``False`` otherwise. ``False`` covers BOTH "the dialog is up right+ now" and "macOS silently suppressed the dialog because an earlier+ decision is on record" — the caller words its answer so it stays true+ in either case. ``None`` = the API reports nothing (microphone,+ Keychain replay).+ """if permission_id is PermissionId.CREDENTIAL_STORE:# Replaying the failed Keychain read is the only supported way to# make macOS show the prompt again; the outcome (allowed or denied# once more) lands honestly in the after-snapshot.self._credential_store_recover()- return+ return Noneif permission_id is PermissionId.MICROPHONE:av = self._load("AVFoundation")av.AVCaptureDevice.requestAccessForMediaType_completionHandler_(av.AVMediaTypeAudio, lambda _granted: None)- return+ return Noneif permission_id is PermissionId.ACCESSIBILITY:app_services = self._load("ApplicationServices")prompt_key = app_services.kAXTrustedCheckOptionPrompt- app_services.AXIsProcessTrustedWithOptions({prompt_key: True})- return+ return bool(app_services.AXIsProcessTrustedWithOptions({prompt_key: True}))quartz = self._load("Quartz")name = {PermissionId.SCREEN_RECORDING: "CGRequestScreenCaptureAccess",@@ -631,13 +639,11 @@ class SystemPermissionPort:}[permission_id]requester = getattr(quartz, name, None)if callable(requester):- requester()- return+ return bool(requester())if permission_id is PermissionId.EVENT_POSTING:app_services = self._load("ApplicationServices")prompt_key = app_services.kAXTrustedCheckOptionPrompt- app_services.AXIsProcessTrustedWithOptions({prompt_key: True})- return+ return bool(app_services.AXIsProcessTrustedWithOptions({prompt_key: True}))raise RuntimeError(f"Native permission request is unavailable: {name}")def request(self, permission_id: PermissionId, *, dry_run: bool = False) -> PermissionOperation:@@ -684,7 +690,7 @@ class SystemPermissionPort:before,)try:- self._native_request(permission_id)+ prompted = self._native_request(permission_id)except Exception as exc: # noqa: BLE001 - native request boundaryreturn PermissionOperation(False,@@ -700,6 +706,23 @@ class SystemPermissionPort:if restart:self._restart_required.add(permission_id)after = self.snapshot()+ message = (+ "Permission requested. Restart Personal Jarvis after granting access."+ if restart+ else "Permission requested; the status will update after your choice."+ )+ if prompted is False:+ # macOS prompts each app identity exactly once. A requester that+ # reports False may have the dialog up right now — or may have+ # been silently suppressed because a denial is already on record+ # (the Screen Recording preflight cannot tell those apart).+ # Promising only a restart in that second case is the dead-button+ # class of BUG-083: the user restarts forever and is never asked.+ message += (+ " If no system dialog appeared, macOS has already recorded an "+ "earlier decision — enable Personal Jarvis in System Settings "+ "> Privacy & Security for this permission."+ )return PermissionOperation(True,permission_id.value,@@ -707,11 +730,7 @@ class SystemPermissionPort:True,False,restart,- (- "Permission requested. Restart Personal Jarvis after granting access."- if restart- else "Permission requested; the status will update after your choice."- ),+ message,after,)diff --git a/tests/unit/platform/test_permissions.py b/tests/unit/platform/test_permissions.pyindex 2bc6f0ddf9..9762af6635 100644--- a/tests/unit/platform/test_permissions.py+++ b/tests/unit/platform/test_permissions.py@@ -286,6 +286,33 @@ def test_request_screen_capture_calls_native_api_and_requires_restart() -> None:assert _permission(result.snapshot, PermissionId.SCREEN_RECORDING)["restart_required"] is True+def test_request_reporting_false_points_at_system_settings() -> None:+ """A suppressed prompt must not promise a restart-only path (BUG-083 class).++ macOS prompts each app identity exactly once; a previously denied Screen+ Recording makes CGRequestScreenCaptureAccess return False WITHOUT any+ dialog. The user needs the System Settings pointer, not a restart loop.+ """+ modules, screen, _ = _native_modules()+ modules["Quartz"].CGRequestScreenCaptureAccess = lambda: False++ result = _port(modules).request(PermissionId.SCREEN_RECORDING)++ assert result.ok is True+ assert screen["granted"] is False+ assert "System Settings" in result.message+ assert "If no system dialog appeared" in result.message+++def test_request_reporting_true_keeps_the_plain_restart_message() -> None:+ modules, _, _ = _native_modules()++ result = _port(modules).request(PermissionId.SCREEN_RECORDING)++ assert result.ok is True+ assert "If no system dialog appeared" not in result.message++def test_restart_requirement_persists_until_the_process_restarts() -> None:modules, _, _ = _native_modules()port = _port(modules)