Skip to content

Harden BLE connection recovery - #98

Merged
proplayer919 merged 2 commits into
mainfrom
proplayer919-fix-firmware-device-flow
Nov 6, 2026
Merged

proplayer919 merged 2 commits into
mainfrom
proplayer919-fix-firmware-device-flow

Conversation

@proplayer919

Copy link
Copy Markdown
Member

Description

Fixes stale BLE connection reuse and incorrect connection routing after command failures. Failed status, authentication, OTA, and reconnect probes now invalidate the matching cached connection so retries establish a fresh connection. BLE snapshots also retain the latest authentication requirement, while connection failures clear stale UI errors and return to the device list instead of guessing an auth screen.

Component

  • Companion UI
  • Companion Backend
  • Device Firmware
  • Shared
  • Other

Closes Issues

#97

Copilot AI balanced review requested due to automatic review settings November 6, 2026 23:39

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Unresolved BLE state and connection-lifecycle issues can hide password controls, retain failed setup connections, and allow delayed teardown to disconnect a replacement connection.

3 open issues
What changed in this PR

This PR addresses #97 by improving BLE connection recovery in the companion app and avoiding authentication routing based on stale device state.

Changes:

  • Invalidate matching cached connections after selected command failures and firmware reconnect probe failures.
  • Track authentication requirements in BLE connection state and scanner snapshots, and serialize BLE firmware writes.
  • Clear previous connection errors when opening a device and return to the device list if connection fails.
File Description
companion/​src/​App.tsx Clears stale errors and returns failed connections to the device list.
companion/​src-tauri/​src/​constants.rs Limits BLE firmware writes to one outstanding request.
companion/​src-tauri/​src/​ble/​state.rs Adds authentication metadata and identity-checked connection removal.
companion/​src-tauri/​src/​ble/​scanner.rs Includes cached authentication requirements in scan snapshots.
companion/​src-tauri/​src/​ble/​commands.rs Adds failure invalidation and records authentication requirements from status responses.

Review effort: Balanced

Comment thread companion/src-tauri/src/ble/commands.rs Resolved
Comment thread companion/src-tauri/src/ble/commands.rs Resolved
Comment thread companion/src-tauri/src/ble/state.rs Resolved
@proplayer919
proplayer919 merged commit 99c510e into main Nov 6, 2026
10 checks passed
@proplayer919
proplayer919 deleted the proplayer919-fix-firmware-device-flow branch November 6, 2026 23:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants