Skip to content

Fix paired clients losing playback after a cancelled re-pair - #479

Merged
maximmaxim345 merged 3 commits into
mainfrom
fix/restore-long-term-after-failed-re-pair
Oct 5, 2026
Merged

maximmaxim345 merged 3 commits into
mainfrom
fix/restore-long-term-after-failed-re-pair

Conversation

@maximmaxim345

Copy link
Copy Markdown
Member

What does this implement/fix?

Cancelling or failing a pairing attempt on an already paired client left it without playback until it reconnected. The attempt moves the connection off the client's long-term PSK, and nothing moved it back.

Now the server re-handshakes back onto the stored long-term PSK after the leave server/activate, restoring playback and roles on the same connection. If that re-handshake fails, the server closes the connection so the client reconnects.

Related issue or spec PR (if applicable):

Types of changes

  • Bugfix (non-breaking change which fixes an issue): bugfix
  • New feature (non-breaking change which adds functionality): new-feature
  • Enhancement to an existing feature: enhancement
  • Breaking change (changes the public API or the protocol in a way that is not backwards compatible): breaking-change
  • Refactor (no behavior change): refactor
  • Documentation only: documentation
  • Maintenance / chore: maintenance
  • CI / workflow change: ci
  • Dependencies bump: dependencies

@maximmaxim345
maximmaxim345 requested a balanced review from Copilot October 5, 2026 05:57
@github-actions github-actions Bot added the bugfix Fixes a bug label Oct 5, 2026

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.

Copilot review overview

🟡 Changes recommended

Cancellation during restoration can leave the encrypted connection open in an unusable state.

Review effort: Balanced
Findings: 1 High severity

Open (1)
What changed in this PR

Restores paired clients to their long-term PSK after an unfinished re-pairing attempt.

Changes:

  • Re-handshakes back to the stored pairing record.
  • Closes connections when restoration fails.
  • Adds integration coverage for restoration and failure paths.
File Description
aiosendspin/​server/​connection.py Implements session restoration.
aiosendspin/​server/​server.py Updates API documentation.
tests/​integration/​test_noise_pairing_flow.py Tests cancellation, restoration, and failure handling.

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread aiosendspin/server/connection.py Resolved

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.

Copilot review overview

🟡 Changes recommended

Cancellation before the protected re-handshake can still leave the connection open and playback-disabled.

Review effort: Balanced
Findings: 1 High severity

Open (1)
Resolved since last review (1)

Comment thread aiosendspin/server/connection.py Resolved
@maximmaxim345
maximmaxim345 force-pushed the fix/restore-long-term-after-failed-re-pair branch from 420d7b8 to f485ffb Compare October 5, 2026 06:30
@maximmaxim345
maximmaxim345 requested a balanced review from Copilot October 5, 2026 06:30

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.

Copilot review overview

🟢 Approval recommended

The recovery flow is cancellation-safe and comprehensively covered by integration tests.

Review effort: Balanced
Findings: None

Resolved since last review (1)

@maximmaxim345
maximmaxim345 merged commit c32e8dd into main Oct 5, 2026
4 checks passed
@maximmaxim345
maximmaxim345 deleted the fix/restore-long-term-after-failed-re-pair branch October 5, 2026 06:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix Fixes a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants