music-assistant-server

Branch:dev-lidarr-plugin

Commit Details

Stop the music when a group dissolves around its leader (#6083)

# What does this implement/fix?

When you unjoin a speaker that leads a sync group and the group cannot
hand playback to a
remaining member, the group is dissolved and the leader is stopped. That
stop only reached
the device: the queue session stayed open, so its preloading kept
pulling audio and a
provider serving a live session (Spotify) stayed tethered to Music
Assistant for another
track or two. A power off got the same fix in #6074 and #6077.

The group has no member to hand playback to when the others cannot play
audio themselves
(a display, visualizer or light joined to a speaker) or have gone
offline. A group that
still has a speaker left hands leadership over exactly as before.

- The dissolve now ends the queue itself when the leader was playing its
own queue, and
falls back to the device stop otherwise (another player's queue, or a
live external
  source with no queue at all)
- The playback position is saved on the way out, so pressing play
resumes where the group
  left off instead of restarting the track
- The power off and the dissolve now share one helper, so the rule lives
in one place
- Tests for the dissolve, both fallbacks, and the leadership transfer

**Related issue (if applicable):**

- Same fix as #6074 and #6077, one path further along
- #6084 sends more traffic through this path: a stereo pair powering off
now ungroups,
  which reaches this dissolve when it was a leader without an heir

## Types of changes

- [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.
Forgejo

Author

Marcel van der Veldt<[email protected]>
August 28, 2026 at 10:26 AM UTC

Committer

Marcel van der Veldt<[email protected]>
August 29, 2026 at 12:28 AM UTC
150additions
11deletions
2files changed

Parent commits

Changes

2 files
+150-11

Changed Files (2)

music_assistant/controllers/players/
tests/controllers/players/
music_assistant/controllers/players/controller.py
+21-2
tests/controllers/players/test_player_grouping.py
+129-9