Skip to content

fix(ipc,agent,desktop): surface Input Monitoring via agent status and fix registry bincode - #760

Merged
AprilNEA merged 1 commit into
AprilNEA:masterfrom
rekcilyssup:fix/permissions-input-monitoring-606
Aug 23, 2026
Merged

fix(ipc,agent,desktop): surface Input Monitoring via agent status and fix registry bincode#760
AprilNEA merged 1 commit into
AprilNEA:masterfrom
rekcilyssup:fix/permissions-input-monitoring-606

Conversation

@rekcilyssup

Copy link
Copy Markdown
Contributor

Summary

Fixes #606 and #571.

#606: Settings → Permissions → Input Monitoring checked IOHIDCheckAccess in the GUI process (openlogi-permissions::input_monitoring()), but HID devices are opened by the agent under a distinct code-signing identity (org.openlogi.agent). The row therefore showed the GUI's grant, not whether discovery can actually open HID. This mirrors the already-correct Accessibility handling.

#571: StandaloneDevice::registry_model_id used skip_serializing_if, truncating bincode when None and making every AgentSnapshot undecodable while such a device is present.

Changes

  • crates/openlogi-ipc/src/ipc.rs:55 — bump PROTOCOL_VERSION 23→25: v24 fixes bincode for registry_model_id, v25 appends AgentStatus::input_monitoring_granted (with #[expect(clippy::struct_excessive_bools)])
  • crates/openlogi-core/src/device.rs:410 — drop skip_serializing_if, keep #[serde(default)]
  • crates/openlogi-agent-core/src/watchers/input_monitoring.rs (new) + watchers/mod.rs — poll openlogi_hid::permissions::has_access() like the accessibility watcher
  • crates/openlogi-agent-core/src/observable.rs:46 — seed and publish input_monitoring_granted; add set_input_monitoring_granted
  • crates/openlogi-agent/src/main.rs:318 — spawn watcher and handle input_monitoring_rx; #[expect(clippy::too_many_lines)] for select
  • crates/openlogi-agent/src/bin/mock_agent.rs:620 — mock status granted, remove Snapshot fails to decode when a standalone device has no registry_model_id #571 workaround comment
  • crates/openlogi-desktop/src/windows/settings/permissions.rs:54 — read AppState::agent_status().input_monitoring_granted instead of local permissions::input_monitoring() (Unknown while not connected)
  • crates/openlogi-ipc/tests/wire_format.rs:66 — make assert_wire round-trip (deserialize + re-encode) without requiring PartialEq on tarpc types; regenerate goldens for AgentStatus/snapshot/observation and registry_model_id = None (…6100)

Testing

  • DEVELOPER_DIR=/Library/Developer/CommandLineTools cargo test -p openlogi-ipc --test wire_format — 13 passed (snapshot/observation with new bool, standalone None now decodable)
  • cargo test -p openlogi-agent-core --lib observable — 10 passed
  • cargo clippy -p openlogi-core -p openlogi-ipc -p openlogi-agent-core -p openlogi-agent --all-targets -- -D warnings — clean (after adding expects)
  • RUSTDOCFLAGS="-D warnings" cargo doc --workspace --no-deps --exclude openlogi-ui --exclude openlogi-desktop --exclude openlogi-overlay — clean
  • Manual: not runtime-tested on hardware — logic is polling has_access() and wiring through IPC; mock serves granted.

Notes

Depends on #759 (v24). This branch stacks v25 on top and currently includes #571's fix as well; will rebase to keep 24→25 sequential once #759 merges (or this can supersede #759 if preferred).

Fixes #571
Fixes #606

@rekcilyssup
rekcilyssup requested a review from AprilNEA as a code owner August 21, 2026 14:25
@greptile-apps

greptile-apps Bot commented Aug 21, 2026

Copy link
Copy Markdown

Greptile Summary

The PR moves macOS Input Monitoring status reporting to the hardware-owning agent and corrects the positional bincode representation of an absent standalone registry model ID.

  • Adds an agent-side Input Monitoring watcher and publishes its state through generation-stamped IPC observations.
  • Updates the desktop Permissions page to consume the agent-reported status.
  • Always serializes registry_model_id, appends the new status field, bumps the protocol version, and strengthens wire-format round-trip coverage.

Confidence Score: 5/5

The PR appears safe to merge because no blocking failure remains within the eligible follow-up-review scope.

No blocking failure remains.

Important Files Changed

Filename Overview
crates/openlogi-agent-core/src/watchers/input_monitoring.rs Adds a polling watcher that reports changes to the agent process’s macOS Input Monitoring grant.
crates/openlogi-agent-core/src/observable.rs Seeds and publishes Input Monitoring state through the existing generation-stamped observation model.
crates/openlogi-agent/src/main.rs Starts the permission watcher and applies its updates to observable agent state.
crates/openlogi-desktop/src/windows/settings/permissions.rs Renders Input Monitoring from agent status and uses Unknown while no agent status is available.
crates/openlogi-core/src/device.rs Ensures an absent standalone registry model ID still emits its positional bincode field.
crates/openlogi-ipc/src/ipc.rs Appends Input Monitoring state to AgentStatus and versions both intentional wire-format changes.
crates/openlogi-ipc/tests/wire_format.rs Updates wire goldens and verifies that serialized values deserialize and re-encode identically.

Sequence Diagram

sequenceDiagram
    participant macOS
    participant Watcher as Agent permission watcher
    participant State as ObservableState
    participant IPC as Agent IPC
    participant UI as Permissions UI
    Watcher->>macOS: Check Input Monitoring access
    macOS-->>Watcher: Granted or denied
    Watcher->>State: Update input_monitoring_granted
    State->>State: Increment generation when changed
    UI->>IPC: observe(last generation)
    IPC-->>UI: Complete AgentSnapshot
    UI->>UI: Render Granted, Denied, or Unknown
Loading

Reviews (2): Last reviewed commit: "fix(ipc): surface Input Monitoring via a..." | Re-trigger Greptile

@davidbudnick davidbudnick added type: bug Something is broken or behaves incorrectly platform: all Cross-platform issue labels Aug 21, 2026
davidbudnick
davidbudnick previously approved these changes Aug 21, 2026
@davidbudnick davidbudnick added this to the v0.7.5 milestone Aug 21, 2026
…model_id bincode

Fixes AprilNEA#606 — Input Monitoring row read the GUI process's IOHIDCheckAccess
rather than the agent's, showing a grant that never affects HID discovery.
Add input_monitoring_granted to AgentStatus (append-only, bump
PROTOCOL_VERSION to 25), populate from openlogi_hid::permissions::has_access
via a new input_monitoring watcher and ObservableState setter, and read it
from AppState::agent_status in the Settings page.

Fixes AprilNEA#571 — StandaloneDevice::registry_model_id used
skip_serializing_if, truncating bincode when None and making every
AgentSnapshot undecodable. Drop the attribute, keep #[serde(default)],
regenerate the None golden and make assert_wire round-trip (decode +
re-encode) without requiring PartialEq on tarpc-generated types.

Depends on AprilNEA#759 (v24) — this stacks v25 on top; will rebase to keep
24+25 sequential once AprilNEA#759 lands.
@AprilNEA
AprilNEA force-pushed the fix/permissions-input-monitoring-606 branch from b8cfde2 to 5816f93 Compare August 23, 2026 04:01

@AprilNEA AprilNEA left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@AprilNEA
AprilNEA merged commit 3942d27 into AprilNEA:master Aug 23, 2026
19 checks passed
@AprilNEA AprilNEA mentioned this pull request Aug 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

platform: all Cross-platform issue type: bug Something is broken or behaves incorrectly

Projects

None yet

3 participants