fix: reconnect retry for unexpected BLE disconnects #8

Merged
payfrit merged 1 commit from schwifty/reconnect-on-unexpected-disconnect into main 2026-03-22 00:17:30 +00:00
Collaborator

Summary

  • Adds reconnect-retry logic (2 attempts with backoff) for disconnects during .authenticating or .writing states, instead of failing immediately
  • Resets passwordIndex on reconnect so re-auth starts from password #1 (fixes @koda's catch where burned password attempts caused retry failures)
  • Also fixes missing passwordIndex reset in the device-info safety-net reconnect path

What was happening

Any BLE disconnect during authentication or early config writing hit the generic "Unexpected disconnect" handler which failed immediately with no retry. On flaky beacons this killed the entire provisioning.

Test plan

  • Build from this branch and provision a beacon that has flaky BLE
  • Verify provisioning recovers from 1-2 disconnects during auth/write
  • Verify it still fails cleanly after 2 retries exhausted

🤖 Generated with Claude Code

## Summary - Adds reconnect-retry logic (2 attempts with backoff) for disconnects during `.authenticating` or `.writing` states, instead of failing immediately - Resets `passwordIndex` on reconnect so re-auth starts from password #1 (fixes @koda's catch where burned password attempts caused retry failures) - Also fixes missing `passwordIndex` reset in the device-info safety-net reconnect path ## What was happening Any BLE disconnect during authentication or early config writing hit the generic "Unexpected disconnect" handler which failed immediately with no retry. On flaky beacons this killed the entire provisioning. ## Test plan - [ ] Build from this branch and provision a beacon that has flaky BLE - [ ] Verify provisioning recovers from 1-2 disconnects during auth/write - [ ] Verify it still fails cleanly after 2 retries exhausted 🤖 Generated with [Claude Code](https://claude.com/claude-code)
schwifty added 1 commit 2026-03-21 23:54:27 +00:00
Instead of immediately failing on disconnect during authenticating or
writing states, retry up to 2 times with backoff. Resets passwordIndex
on reconnect so re-auth starts fresh (fixes issue where burned password
attempts caused retry failures). Also fixes passwordIndex reset in the
device-info safety-net reconnect path.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
payfrit merged commit 34e8ea0bab into main 2026-03-22 00:17:30 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: payfrit/payfrit-beacon-ios#8
No description provided.