Repository navigation
fix(jellycompat): keep Jellyfin play sessions for 24 hours by default - #2922
Conversation
The router gives compat play sessions the 24h stream-token lifetime, but jellyfin_compat.playback_session_ttl overrides it whenever it is set, and every database was seeded with 6h. PlaySessionId-only HLS and attachment requests started failing six hours after PlaybackInfo. Default the setting to 24h in the config, the database loader and the admin defaults, and migrate a stored 6h (the old seed) to 24h while leaving any other value an administrator chose. The durable store now takes the lifetime its in-memory cache resolves instead of its own 6h fallback. Closes #2899 Co-Authored-By: Claude Opus 5.5 <[email protected]>
"Forget idle playback after" suggested an idle timeout, but a Jellyfin play session ends a fixed time after playback starts, paused or not. Rename the field and say so in its hint. Drop test rows the boundary cases already cover. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 26 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
| UPDATE server_settings | ||
| SET value = '24h' | ||
| WHERE key = 'jellyfin_compat.playback_session_ttl' | ||
| AND value = '6h'; |
There was a problem hiding this comment.
Configuration overwrite in migrations/sql/20261022130254_jellyfin_compat_play_session_ttl_24h.sql changes administrator-selected 6h values for server_settings key jellyfin_compat.playback_session_ttl to 24h, violating the requirement to preserve administrator choices. The key/value settings schema provides no provenance to distinguish explicitly selected six-hour lifetimes from seeded defaults, so value matching alone cannot safely identify settings to migrate.
Prompt for LLM
File migrations/sql/20261022130254_jellyfin_compat_play_session_ttl_24h.sql:
Line 6 to 9:
Configuration overwrite in `migrations/sql/20261022130254_jellyfin_compat_play_session_ttl_24h.sql` changes administrator-selected `6h` values for `server_settings` key `jellyfin_compat.playback_session_ttl` to `24h`, violating the requirement to preserve administrator choices. The key/value settings schema provides no provenance to distinguish explicitly selected six-hour lifetimes from seeded defaults, so value matching alone cannot safely identify settings to migrate.
Talk to Kody by mentioning @kody
Was this suggestion helpful? React with 👍 or 👎 to help Kody learn from this interaction.
There was a problem hiding this comment.
This is deliberate, and the PR's Risks section discloses it. As you say, server_settings stores only key and value, so a 6h an administrator typed can't be told apart from the 6h that 001_schema.sql seeded on every install. That leaves two options:
- Move every stored
6h, which is this PR. A deliberate6hbecomes24h, and the administrator can set it back on the Compatibility page. - Move only databases no administrator has touched, gated on no users or no
setup.completedlike20260923181531. Every existing deployment would keep the 6-hour lifetime this PR fixes, so only fresh installs would benefit.
The issue asks for the first, the way 20260806224241 and 20260809133921 moved their old seeds. Any other value an administrator chose, such as 12h, is kept. The migration test covers that, and so does an upgraded database in the PR's evidence. I'm leaving this open for the maintainer to decide.
There was a problem hiding this comment.
Agreed. My suggestion treated preserving an explicitly selected 6h as an unconditional requirement, but this PR deliberately accepts that indistinguishable case to fix existing installations.
The migration’s guard preserves values other than 6h; it cannot preserve deliberate 6h choices without also retaining the seeded default. Given the documented trade-off, this is an intentional behavior change for maintainer approval, not an overlooked migration bug.
I would not block this PR on the original suggestion. Leaving the decision with the maintainer makes sense.
Problem
Closes #2899
Related issue: N/A
Validation tasks: none
Jellyfin apps lose their stream six hours after they start playing. After that, every request that carries only
PlaySessionIdreturns 401: HLS playlists, segments, and font attachments. A movie paused overnight or a long play can't continue. This change makes those play sessions last 24 hours by default, as the compat router intends, and keeps any value an administrator chose.The router gives compat play sessions the 24-hour stream-token lifetime (
playback.MaxTokenTTL), butjellyfin_compat.playback_session_ttlreplaces it whenever it is set. Every database is seeded with6h, and the config, database loader, and admin defaults all said6h, so 6 hours is what runs. The lifetime counts from PlaybackInfo and activity doesn't extend it.Approach
24hin the config, the database loader, and the admin defaults.6hto24h. A stored6hcan't be told apart from an administrator who typed6h, so both move. Any other value stays, and a database without the row uses the new code default. The001_schema.sqlseed is unchanged because merged migrations are immutable; fresh installs reach24hthrough the new migration.NewDurableCompatPlaybackStoretakes the lifetime its in-memory store resolves, instead of its own 6-hour fallback.The expiry stays absolute. A sliding expiry would need a Postgres write on segment requests, which the durable store keeps off that path, and this bug doesn't need it.
Device profiles use the same setting (
NewDeviceProfileStore), so a client's registered capabilities are also kept for 24 hours instead of 6. Clients re-register them on every capabilities post and PlaybackInfo, so the stored profile is the device's latest.Validation
main, a Jellyfin PlaybackInfo session was stored with a 6-hour lifetime. After its timestamps were moved 6 h 1 m back and the server restarted, its HLS master playlist returned 401 to a request carrying onlyPlaySessionId.6hto24hon startup. A new session was stored with a 24-hour lifetime, and after the same shift and restart its master playlist and first segment returned 200.12hthrough the admin API kept12hafter the migration. An empty database migrated from scratch ends at24h.fails-on-base, it fails onmain(401 at 23 h 59 m) and passes here. The migration test (old seed, admin value, missing row) runs against Postgres and is listed indb-contracts.txt. Removing the migration'svalue = '6h'guard makes it fail.make lint-changed(0 issues),make lint-router-recovery, the contract and fixture checks, andmake verify-migrationsall pass. Inmake test-go,internal/mediasamplefails the same way onmain(host ffmpeg), and oneinternal/subtitles/aipanic did not repeat in 5 reruns; neither package depends on this change. The jellycompat and migrations packages pass against Postgres.make test-webfailures (shuffle chrome and the PGS parser, both timing-sensitive) pass when rerun.Evidence
The Compatibility settings field before (
Forget idle playback after,6h) and after (End playback sessions after,24h), on desktop and at phone width, plus the before and after server transcripts and the tests' failing runs onmain.Evidence: https://evidence.siloserver.org/r/silo-server/issue-2899/
Risks
6hgets24hafter the upgrade and has to set it again.PlaySessionIdcan stream its one item for up to 24 hours instead of 6, while the session is never stopped and its owner stays signed in. Request logs already record the ID.Checklist
AI Disclosure
/siloskill and review subagents; T3 Codedelegate_taskfor the cross-provider reviews; GitHub CLI🤖 Generated with Claude Code
Note
Raise Jellyfin compatibility play session TTL default to 24 hours
defaultJellyfinCompatPlaybackSessionTTLconstant used bysetDefaults,LoadFromDB, and the admin-settings defaults.NewDurableCompatPlaybackStore; the durable store now copies the TTL resolved by the in-memory playback store.migrations/sql/20261022130254_jellyfin_compat_play_session_ttl_24h.sql.Macroscope summarized d6e43a3.