Skip to content

fix(macos): request Input Monitoring and Bluetooth from the agent - #1296

Open
EyJunge1 wants to merge 6 commits into
AprilNEA:masterfrom
EyJunge1:fix/macos-agent-permission-prompts
Open

EyJunge1 wants to merge 6 commits into
AprilNEA:masterfrom
EyJunge1:fix/macos-agent-permission-prompts

Conversation

@EyJunge1

@EyJunge1 EyJunge1 commented Sep 7, 2026

Copy link
Copy Markdown

Summary

  • Raise Accessibility, Input Monitoring, and Bluetooth consent from OpenLogi Agent (org.openlogi.agent), not the GUI — TCC is per identity, which is why Settings could show a grant while the agent still could not open HID ([Bug]: Permissions - Input monitoring #1261).
  • The GUI asks for any missing agent rights after its first Ready snapshot; Settings Grant buttons use the same RPCs. System Settings opens only when the grant is already denied (or the user declined).
  • Arming never prompts (login or GUI-demand). A fresh Input Monitoring Allow relaunches the agent because IOHIDCheckAccess stays stale in the granting process. Bluetooth CBCentralManager is created on the AppKit main queue; authorization is polled off the tray thread. NSBluetoothAlwaysUsageDescription is stamped on the agent Info.plist.

Closes #1261

@EyJunge1
EyJunge1 requested a review from AprilNEA as a code owner September 7, 2026 15:17
@greptile-apps

greptile-apps Bot commented Sep 7, 2026

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

The PR appears safe to merge; the previously reported permission-flow failures are resolved and no actionable new defect remains.

Summary

This PR moves macOS Accessibility, Input Monitoring, and Bluetooth consent requests to the agent identity and reports their status to the desktop over IPC.

  • Adds agent-owned Input Monitoring and CoreBluetooth prompt implementations.
  • Relays permission state and prompt requests through the IPC protocol.
  • Sequences automatic prompts around the required Input Monitoring relaunch.
  • Adds Bluetooth permission watching and the agent bundle usage description.
  • Updates Settings behavior, localization, tests, and macOS permission documentation.
Diagram
sequenceDiagram
    participant GUI as OpenLogi Desktop
    participant Agent as OpenLogi Agent
    participant macOS as macOS TCC
    GUI->>Agent: Observe Ready permission status
    GUI->>Agent: Request missing Accessibility/Input Monitoring
    Agent->>macOS: Invoke permission API as agent identity
    alt Input Monitoring granted
        Agent->>Agent: Graceful shutdown and relaunch
        Agent-->>GUI: Reconnect with refreshed status
    end
    GUI->>Agent: Request Bluetooth when Input Monitoring is granted
    Agent->>macOS: Create CBCentralManager on main queue
    Agent-->>GUI: Publish updated Bluetooth status
Loading

Reviews (8) · Last reviewed commit: "fix(macos): relaunch through the lifecyc..."

Comment thread crates/openlogi-desktop/src/services/ipc.rs
Comment thread crates/openlogi-desktop/src/state/agent.rs Outdated
Comment thread crates/openlogi-agent/src/permissions_macos.rs
Comment thread crates/openlogi-desktop/src/services/ipc.rs Outdated
Comment thread crates/openlogi-desktop/src/services/ipc.rs Outdated
@davidbudnick davidbudnick added type: bug Something is broken or behaves incorrectly platform: macos macOS-specific issue labels Sep 8, 2026
@EyJunge1
EyJunge1 force-pushed the fix/macos-agent-permission-prompts branch from 2c505f8 to c90fd63 Compare September 12, 2026 11:27
TCC grants land on the process that asks. The GUI previously reported
agent-owned rights from the wrong identity, so Input Monitoring looked
denied even after the user ticked OpenLogi Agent. Native sheets now come
from the agent after the first Ready snapshot; System Settings is only
the Denied fallback.

Closes AprilNEA#1261
…d Bluetooth

Introduced a mechanism to manage agent-owned permission prompts more effectively. The GUI now tracks which permissions have already been requested during the session, ensuring that Bluetooth requests are only made after Input Monitoring is granted. This change prevents overlapping permission requests and improves user experience by managing the timing of permission prompts.

Closes AprilNEA#1261
Grant polling blocked the serialized client loop for up to 60s while the sheet was unanswered. Run that wait on a spawned task so observe and device commands keep flowing.
An Input Monitoring Allow drops the waiter's client. Treat that as a reconnect, not a refusal, so System Settings does not cover a still-pending Accessibility sheet.
Linux and Windows never construct those IPC commands, so -D warnings
fails clippy and MSRV. Also drop the rustdoc link to macos-only bluetooth.
…grant

Master renamed the immediate-exit helper to schedule-then-teardown. The
IPC prompt now asks the lifecycle to schedule a successor and exit after
firmware cleanup, so HID++ diversion is not abandoned mid-grant.
@EyJunge1
EyJunge1 force-pushed the fix/macos-agent-permission-prompts branch from c90fd63 to d3dc828 Compare September 17, 2026 14:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

platform: macos macOS-specific issue type: bug Something is broken or behaves incorrectly

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Permissions - Input monitoring

2 participants