fix(agent): reload control capture across app switches - #671
Open
Phecda wants to merge 2 commits into
Open
Conversation
Phecda
force-pushed
the
fix/stabilize-control-capture
branch
from
August 20, 2026 02:07
c8e15fe to
4dc4375
Compare
Phecda
marked this pull request as ready for review
August 20, 2026 03:51
Greptile SummaryThe PR keeps each device’s HID++ capture session alive while app-specific capture specifications change, applying incremental control-mode updates and retrying failed reloads.
Confidence Score: 5/5The PR appears safe to merge, with no concrete blocking or independently actionable non-blocking defect identified. The session reconciliation, incremental hardware transitions, runtime mapping updates, retry behavior, and lifecycle restart conditions form a consistent capture flow across application switches.
|
| Filename | Overview |
|---|---|
| crates/openlogi-agent-core/src/watchers/gesture.rs | Reconciles compatible plan changes through a watch channel while preserving restart behavior for route, generation, ownership, removal, and session failures. |
| crates/openlogi-hid/src/gesture.rs | Adds incremental capture-mode reconfiguration, listener-visible runtime state, retry handling, and in-place thumb-wheel transitions without an actionable correctness defect identified. |
| crates/openlogi-hid/src/gesture/tests.rs | Adds focused tests for control-mode selection and cleanup of in-progress gesture state when a source is removed. |
| crates/openlogi-agent-core/src/capture_plan.rs | Adds regression coverage confirming that a per-app button override changes only that app’s diversion set. |
| crates/openlogi-hid/src/lib.rs | Re-exports the new capture-session entry point that accepts live specification updates. |
Sequence Diagram
sequenceDiagram
participant App as Foreground-app watcher
participant Manager as Capture manager
participant Session as Live capture session
participant Device as HID++ device
App->>Manager: Publish updated DeviceCapturePlan
Manager->>Session: Send complete CaptureSpec
Session->>Device: Apply changed control modes
alt Reload succeeds
Session->>Session: Publish updated runtime mappings
Session-->>Manager: Keep channel and listener alive
else HID++ write fails
Session->>Session: Retain latest requested spec
Session->>Device: Retry after delay
end
Reviews (1): Last reviewed commit: "fix(agent): reload control capture specs..." | Re-trigger Greptile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Foreground-app changes previously stopped and rebuilt the HID++ control-capture session so the new app-specific configuration could take effect. On the tested MX Master 3, rebuilding left a gap of more than one second between
control capture stoppedandcontrol capture active.During that gap, diverted controls temporarily returned to their firmware-native behavior. In practice, using the auxiliary button could open the macOS application switcher instead of executing the active OpenLogi binding.
This change keeps the existing capture channel, listener, and session alive across normal app switches and reloads the complete app-specific
CaptureSpecin place.Changes
CaptureSpecto the active capture session instead of restarting it.Behavior
Before this change:
After this change:
control capture reloadedwithoutcontrol capture stopped.Testing
cargo fmt --all -- --checkcargo clippy --workspace --all-targets -- -D warningscargo test --workspaceRUSTDOCFLAGS="-D warnings" cargo doc -p openlogi-hid -p openlogi-hidpp -p openlogi-hidpp-derive --no-deps --document-private-itemscontrol capture reloadedwithoutcontrol capture stopped, and the configured auxiliary-button behavior remained active across app switches.