/
/
/
# What does this implement/fix? Removing the leader from a playing sync group could hand the group over to the wrong speakers. A sync group switches to another streaming protocol (for example AirPlay) when one of its members can only be reached that way. Once that member leaves, the group notes that it may go back to native streaming on the next start — but the audio keeps running over the original protocol until then. Removing the leader at that moment made the group hand the running session over to the native side of the remaining speakers, so a speaker could drop out of the group while it was still playing, or a grouping command was sent to speakers that were streaming over another protocol. The handoff now always addresses the speakers that are actually carrying the audio. - Resolve the new leader and the handoff targets from the player that owns the live session instead of from the "may go back to native" hint - Keep that hint for the dissolve + re-form path, where it is meant to be used - Added tests covering a leader removal while the group is still streaming over a non-native protocol **Related issue (if applicable):** - n/a — found while reviewing #5595 ## Types of changes <!-- Tick exactly one box. CI (.github/workflows/pr-labels.yaml) derives the label from the ticked box and applies it automatically; the release-notes generator uses that same label to slot this change into the next release notes. --> - [x] 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` - [ ] New music/player/metadata/plugin provider — `new-provider` - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) — `breaking-change` - [ ] Refactor (no behaviour change) — `refactor` - [ ] Documentation only — `documentation` - [ ] Maintenance / chore — `maintenance` - [ ] CI / workflow change — `ci` - [ ] Dependencies bump — `dependencies` ## Checklist - [x] The code change is tested and works locally. - [x] `pre-commit run --all-files` passes. - [x] `pytest` passes, and tests have been added/updated under `tests/` where applicable. - [ ] For changes to shared models, the companion PR in `music-assistant/models` is linked. - [ ] For changes affecting the UI, the companion PR in `music-assistant/frontend` is linked. - [x] I have read and complied with the project's [AI Policy](https://github.com/music-assistant/.github/blob/main/AI_POLICY.md) for any AI-assisted contributions. - [ ] I have [raised a PR against the documentation repository](https://github.com/music-assistant/music-assistant.io/blob/main/CONTRIBUTING.md) targeting the main or beta branch as appropriate.