music-assistant-server

Branch:dev-lidarr-plugin

Commit Details

AI DJ no longer goes quiet after the queue is cleared (#6142)

# What does this implement/fix?

The AI DJ stays switched on in the player menu but stops speaking after
its queue is cleared and refilled, or after playback jumps back to the
top. Turning it off and on again is the only way to get it back.

Each host decides when to speak from how long ago it last spoke, counted
in songs and minutes from the start of the upcoming queue. Clearing the
queue restarts that count while the record of earlier breaks kept its
old numbers, so every spot looked too soon and got skipped. The four
built-in host personalities go quiet completely; a host built from the
default template keeps its per-song transitions but loses its weather
and news.

- Re-anchor a queue DJ's cadence record when the queue rewinds under it,
or when none of the tracks it was recorded against are left.
- Regression tests for a cleared and refilled queue, a jump back to the
top, a full swap of the upcoming tracks, an hourly host, and forward
playback leaving the record alone.

**Related issue (if applicable):**

- Reported on Discord (no issue filed)

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

Author

Marvin Schenkel<[email protected]>
September 1, 2026 at 12:57 PM UTC

Committer

Marvin Schenkel<[email protected]>
September 4, 2026 at 07:55 AM UTC
330additions
4deletions
2files changed

Parent commits

Changes

2 files
+330-4

Changed Files (2)

music_assistant/providers/ai_radio/
tests/providers/ai_radio/
music_assistant/providers/ai_radio/queue_dj.py
+11-4
tests/providers/ai_radio/test_queue_dj.py
+319