Repository navigation
Description
Problem
A transient music-source failure while resolving or starting the next track can leave playback idle with a non-empty queue. Recovery must cover explicit play/next/skip and natural completion, while allowing the operator to choose bounded retry and exhaustion behavior.
Proposed public behavior
Add a provider-independent Playback recovery section to the authenticated Web configuration. Persist it through the existing runtime-settings mechanism. Initial proposed settings:
| Setting | Proposed default | Validation / meaning |
|---|---|---|
| Automatic recovery | enabled | Disabling cancels pending recovery; subsequent failures retain current error reporting. |
| Retry count | 3 | 0–10 retries after the initial attempt; 0 means no additional attempts. |
| Initial retry delay | 15 s | 5–300 s; exponential backoff, capped by the maximum delay. |
| Maximum retry delay | 60 s | At least the initial delay, at most 3,600 s; invalid combinations are rejected atomically. |
| After retries are exhausted | temporarily skip | skip preserves the queue record for a later pass; wait retains the target and retries after cooldown. Neither deletes a track solely for a transient error. |
| Cooldown | 300 s | 30–3,600 s; applies to wait mode and the source-outage safeguard. |
| Consecutive exhausted targets before cooldown | 3 | 1–100; prevents rapid traversal/request amplification during a provider-wide outage. |
Defaults and exact ranges can be agreed during implementation review; they must be explicit rather than hidden constants. Settings follow the project's database persistence / first-start environment import convention. Changing settings must not interrupt a healthy track. Snapshot settings for a recovery run; an explicit disable cancels pending work immediately.
Recovery contract
- Retry only classified transient failures (e.g. network timeouts, rate limiting, mapped upstream risk/service-unavailable errors). Authentication, permission, payment/preview restrictions and permanent unavailability require their own existing handling. No blanket retry of all exceptions or HTTP 4xx.
- Use one player recovery worker with a generation/intent guard. Stop, clear, pause, a new playback target and shutdown cancel stale work. An old track's completion/error must not replace a newer manual target.
- Handle natural completion, explicit play/next/skip, selected queue entries and the first attempted playback of a newly enqueued track through the same policy. Do not claim an HTTP playback failure succeeded merely because background recovery was scheduled.
- Skip mode keeps later healthy tracks reachable in sequential, shuffle and repeat modes; deferred entries must be revisited on a later pass, not silently orphaned. A provider-wide outage enters cooldown, not a tight queue scan.
- Preserve request attribution and explicit per-track quality/source choices across attempts.
- Expose safe status to the console: pending target, attempt/count, next retry time, cooldown and last classified reason. Never expose signed URLs, cookies or upstream response bodies. Stop/next controls must remain usable while waiting.
Acceptance criteria
- Console fields validate, persist, reload and apply with documented timing. Invalid updates do not partially change policy.
- Deterministic fake-clock tests cover every ingress, success after retry, both exhaustion policies, zero retries, repeated outages, later-track reachability and deferred revisit.
- Cancellation/race tests cover stop, pause, clear, new intent and old-track events; no duplicate workers or stale playback.
- Provider classifications are exercised independently of audio transport failures; UI status agrees with actual scheduled work.
The configurable implementation is tracked in reopened PR #26, including the console settings, policy, status and regression coverage described above.
Activity
[-]Automatic playback stops permanently after a transient music-source error[/-][+]Configure bounded playback recovery and exhausted-track policy in the console[/+]release: prepare v1.0.0 multi-server milestone