Skip to content

refactor(agent): consolidate capture manager slots - #1183

Open
AprilNEA wants to merge 1 commit into
masterfrom
refactor/capture-manager-slots
Open

refactor(agent): consolidate capture manager slots#1183
AprilNEA wants to merge 1 commit into
masterfrom
refactor/capture-manager-slots

Conversation

@AprilNEA

Copy link
Copy Markdown
Owner

Summary

Consolidate each gesture/keyboard capture owner into one runtime slot so a running capture epoch cannot coexist with post-session recovery state. This is an ownership-state refactor only; HID behavior, ordered input draining, and recovery policy remain unchanged.

Changes

  • openlogi-agent-core: add a shared CaptureSlot with mutually exclusive running and recovering variants while retaining pending firmware restore and restart pacing as independent recovery facts
  • openlogi-agent-core: migrate the multi-device gesture manager from three parallel maps to one physical-device slot map
  • openlogi-agent-core: migrate the keyboard manager from three independent options to one optional slot
  • openlogi-agent-core: cover active-to-recovery transitions, restore/backoff coexistence, stale completion rejection, planned versus unexpected completion pacing, and suspended retry deadlines

Testing

  • cargo test -p openlogi-agent-core capture_session::tests — 6 passed
  • cargo test -p openlogi-agent-core watchers::gesture::tests — 13 passed
  • cargo test -p openlogi-agent-core watchers::keyboard::tests — 5 passed
  • cargo test -p openlogi-agent-core — 221 passed
  • RUSTFLAGS="-D warnings" cargo fmt --all -- --check — passed
  • RUSTFLAGS="-D warnings" cargo clippy -p openlogi-agent-core -p openlogi-agent --all-targets -- -D warnings — passed
  • RUSTFLAGS="-D warnings" cargo test -p openlogi-agent-core -p openlogi-agent — 254 tests passed (221 agent-core, 33 agent binaries); doc-tests passed
  • Not runtime-tested on hardware; verify gesture controls and bound keyboard keys across config changes, pairing/exclusive requests, disconnect/reconnect recovery, and display sleep/wake.

No linked issue.

Copilot AI lite review requested due to automatic review settings August 31, 2026 04:20

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@greptile-apps

greptile-apps Bot commented Aug 31, 2026

Copy link
Copy Markdown

Greptile Summary

This PR consolidates each gesture and keyboard capture owner into a mutually exclusive running-or-recovering slot while preserving restoration and restart-pacing state.

  • Adds reusable CaptureSlot and CaptureRecovery abstractions.
  • Migrates per-device gesture capture from three maps to one slot map.
  • Migrates keyboard capture from three independent options to one optional slot.
  • Adds focused tests for completion transitions, stale epochs, pacing, and suspended deadlines.

Confidence Score: 5/5

The PR appears safe to merge; no concrete regression was identified in capture ownership, restoration, restart pacing, or lifecycle suspension behavior.

The consolidated slots preserve mutually exclusive running and recovery ownership, retain pending restoration and pacing facts together, reject stale completions, and resume deferred work through existing reconciliation triggers.

Important Files Changed

Filename Overview
crates/openlogi-agent-core/src/watchers/capture_session.rs Introduces the shared running/recovering slot state machine and rejects stale or duplicate completions without displacing authoritative state.
crates/openlogi-agent-core/src/watchers/gesture.rs Consolidates gesture sessions, pending restores, and restart deadlines by physical device while retaining retry, dispatch, and lifecycle gating behavior.
crates/openlogi-agent-core/src/watchers/keyboard.rs Consolidates keyboard ownership and recovery state while preserving lease handoff, restoration retries, and restart pacing.
crates/openlogi-agent-core/src/watchers/gesture/tests.rs Updates gesture tests to exercise slot-based planned and unexpected completion pacing plus suspended deadlines.
crates/openlogi-agent-core/src/watchers/keyboard/tests.rs Updates keyboard deadline coverage for the consolidated recovery slot.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
    A[Running capture slot] -->|matching planned completion| B[Recovering slot]
    A -->|matching unexpected completion| C[Recovering with restart pacing]
    A -->|stale completion| A
    B -->|restore still pending| B
    B -->|restore complete and successor wanted| A
    C -->|restore pending| C
    C -->|deadline elapsed and restore complete| A
    B -->|recovery empty and no successor| D[No slot]
    C -->|plan removed and recovery empty| D
Loading

Reviews (1): Last reviewed commit: "refactor(agent): consolidate capture man..." | Re-trigger Greptile

@davidbudnick davidbudnick added type: enhancement Improvement to existing functionality platform: all Cross-platform issue labels Sep 3, 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: enhancement Improvement to existing functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants