You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat(playback): end native playback left paused past an admin timeout - #5180
A player that is left paused keeps posting progress every 10 seconds, so its session never goes idle. Until the attempt expires 24 hours later it holds a stream slot and a transcode slot, and for a transcode, an FFmpeg process and its GPU session. On a shared server a few forgotten paused players can use up the transcode slots.
This adds an admin setting, Playback → Paused playback → "End paused playback after" (default 15 minutes; 0 turns it off). The server ends a native video session that has stayed paused that long while its client keeps reporting, and keeps the viewer's position. Clients that advertise the new paused_timeout_v1 feature leave the player with "Playback stopped because it was paused for too long." Older builds get the answer they already handle for an administrator's end, and leave with that wording.
Approach
Which sessions. The lifecycle sweep, every 15 s on each API server, picks native sessions whose lifecycle row has said paused for at least the timeout and whose client sent a paused sample within the last 2 minutes. It skips Watch Together rooms, Cast receiver plays (output.current_sink = cast_receiver) and audio-only files (audiobooks, podcasts). A session whose client stopped reporting stays with the existing 30-minute idle expiry.
The claim.ExpirePausedAttempt locks the attempt row, then reads the lifecycle row in a second statement. That way a resume that commits while the claim waits keeps the session live; a single UPDATE joining the lifecycle row would read it as of the statement's start. The claim rechecks the Cast and Watch Together exemptions under the lock.
Who ends it. The server holding the session ends it from its own copy. A session no server has synced for 45 s is ended from the attempt row. A holder also drops its copy when another server's claim got there first. Candidates are paged, so skipped rows can't hold eligible sessions back. The end is recorded as expired, with a watch-provider pause (a stop when the play had completed).
Wire contract. New client feature paused_timeout_v1 (attempt-sticky, advertised on /api/v2) and problem type playback_session_paused_timeout (410). Progress, replan and the control-ticket mint answer it to attempts that advertised the feature, and playback_session_ended otherwise. Media requests keep the existing 410. No socket frame is sent; the next progress report delivers the answer. Documented in docs/architecture/playback-lifecycle.md, protocol v3 §6.3, docs/playback-api.md and docs/realtime-api.md.
Web. The setting is on the Playback settings page and in admin search. The player advertises the feature, reports pause and resume as they happen, and exits with its own toast on the new answer.
Jellyfin and Audiobookshelf sessions are not native and are not changed. A Jellyfin client revives a missing session from its own reports, so it would need its own design.
Validation
Go build, vet, and unit tests for playback, planstore, handlers, apiv2 and config: pass.
Database contracts (the playback and handler pins plus eight new ones for the claim race, exemptions, ownership, paging and stale copies): pass. Each new test fails with its fix removed.
make lint-changed: 0 issues. Web typecheck, eslint and Vitest (player and settings): pass.
End to end on an isolated sandbox with the timeout at 1 minute:
an updated client is ended about 80 s after pausing and gets playback_session_paused_timeout from progress, replan and the ticket mint;
a legacy client gets playback_session_ended from the same routes;
playing sessions, a session resumed in time, and a client that stopped reporting keep going;
the web player shows the toast and returns to the item page.
Reviewed by GPT-6.2 Sol and Gemini 4 Neon over two rounds; the confirmed findings are fixed.
A later review fixed four defects: a failed settings read used the 15-minute default even when the timeout was off (TestPausedTimeoutSweepWaitsForTheSettingDB fails without the fix), a claim the sweep deadline cut short was skipped rather than retried, the Watch Together exemption read ended rooms, and an unused web helper. After those fixes, the full DB contract suite, make lint-changed, and the web player tests pass.
End to end again on a fresh sandbox built from 8ff6488ca8, after those fixes: the updated and legacy clients were ended 65 s after pausing with the same problem types, the playing and resumed sessions kept going, and with the timeout at 0 a session paused for 145 s kept going.
Before/after pairs at desktop and phone width for the Playback settings page and the paused-timeout exit, the protocol results for updated and legacy clients, and the test summary.
Risks
On by default at 15 minutes after upgrade. Until users update, an old Apple or Android build paused that long leaves with "An administrator ended this playback session.", and an old Roku build leaves without a notice. Setting 0 keeps today's behavior.
A resume reaches the server with the client's next report. A viewer who resumes within that interval (10 s on the native clients) of the timeout can still be ended; they see the notice and continue from the same position. Follow-up client changes will send a report on each pause and resume to narrow this on updated builds.
Watch Together rooms are exempt, so a paused room keeps its members' sessions until the room's own 24-hour idle limit.
Each sweep adds one batched query per server, and one candidate query when the timeout is on.
A server that hasn't read the setting yet (its first settings read failed) ends nothing until a read succeeds.
Checklist
I read and can explain the complete diff.
This pull request addresses one concern.
Each test this pull request adds meets "Decide what to test" in CONTRIBUTING.md.
The Evidence section shows every change a user can see, or how I checked a change nobody sees.
AI Disclosure
Harness: Claude Code in T3 Code
Tool(s): Claude Code; Codex CLI and Antigravity for the review council
Involvement: Fully AI-generated; the owner reviews before merge
Adversarial review: two council rounds on the server change (gpt-6.2-sol, gemini-4-neon). Fixed: the claim's snapshot race, holder teardown and stale copies, batch starvation, exemption rechecks under the lock, replan ownership before the 410, the room-JSON guard, and the web ticket exit. Dismissed with reasons: races of a few milliseconds that correct themselves on the next request and exist for admin ends today, and cleanup gaps shared by every existing idle end.
Council: gpt, gemini, 2 rounds, reviewed 91a28dd2fb. Review round: Sol 6/10, Opus 7.5/10, Gemini 9/10 on 82618c1; confirmed findings fixed in 4d70c63..8ff6488.
End native playback sessions left paused past an admin timeout
Adds a paused-session timeout sweep that runs during each lifecycle sweep. It pages paused candidates, excludes Cast receivers and open Watch Together rooms, and ends attempts via Postgres.ExpirePausedAttempt in postgres.go.
Adds an admin setting (default 15 minutes, max 1440, 0 disables) parsed by ParsePausedSessionTimeout in paused_timeout.go and cached per handler for one minute. The admin UI gains a minutes field in PausedPlaybackGroup.tsx.
Adds a new attempt-sticky paused_timeout_v1 client feature and a dedicated 410 playback_session_paused_timeout problem type. Clients that advertise the feature get the new problem; others get the existing playback_session_ended. The web player advertises the feature, shows a paused-timeout notice, and exits the session.
The player now also sends progress reports on video play and pause events, not just on the 10-second interval, so the server sees the pause timestamp promptly.
Behavioral Change: CachedSetting.Get in cached_setting.go now delegates to a new Lookup method; ReplanPlaybackV2 in playback_service.go now returns forbidden for attempts owned by another profile and 410 for owned attempts ended by admin or paused timeout. Control-socket minting stops after any 410.
The lifecycle sweep ends a native session whose lifecycle row has said paused for longer than playback.paused_session_timeout_minutes (default 15, 0 off) while its client still reports. Watch Together members, Cast receivers and audio-only files are exempt, and a session another server holds is left to that server. ExpirePausedAttempt locks the attempt and reads the lifecycle row after the lock, so a resume that commits first or while it waits keeps the session. The end is recorded as expired.
Progress, replan and the control-ticket mint answer 410 playback_session_paused_timeout to an attempt that listed the new attempt-sticky client feature paused_timeout_v1, and 410 playback_session_ended otherwise.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
A Paused playback group holds the minutes after which the server ends a paused session, with its two search entries.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…long
The video player advertises paused_timeout_v1. On 410 playback_session_paused_timeout from progress, a replan or a reconnect it leaves the way it does after an administrator's end, but says playback stopped because it was paused for too long.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The lifecycle doc gains its eligibility, claim, ownership and answers; protocol v3 the client feature, the problem type and the client contract; the playback and realtime API docs their 410 answers.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The paused timeout runs only in the lifecycle sweep, which needs
Postgres, so the memory store's ExpirePausedAttempt and the pause
tracking it added to ApplyProgress had no caller.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
ExpirePausedAttempt now refuses an attempt a Cast receiver renders, under
the attempt's lock, and a session an open Watch Together room lists, in
the statement read after the lock. The membership check treats a room
whose runtime has no members object (JSON null from a nil map) as having
no members, instead of failing the statement.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…hould end
- Page candidates by (updated_at, session id), up to three pages a sweep,
continuing from the last sweep's cursor, and leave sessions another
server holds out in SQL, so skipped rows cannot starve eligible ones.
- Drop the copy held here when the end could not be finished (lease held
elsewhere, writers failed), without history; the lifecycle sweep's
stopped-attempt recovery finishes it once.
- Each sweep, run the stale-copy path for held copies whose attempt
another server stopped under the paused timeout's stop id.
- Guard the Watch Together membership check against a members value that
is not an object.
- Keep the claim's interface with its caller, and cache the setting for a
minute so the cache is used.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
ReplanPlaybackV2 answered a stopped attempt's 410 before checking that
the caller owns it, so another profile learned the session had ended.
It now answers 403 first, as progress does.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…imeout
The ticket mint stopped retrying on any 410 but never told the player.
A 410 playback_session_paused_timeout now ends the session the way a
progress report does, with the paused-timeout notice. A 410
playback_session_ended is left as it was: the server answers it for
every stopped attempt, an expiry included.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Progress went out every 10 seconds, so a resume could reach the server
that much late and the paused timeout could end a session the viewer
had just resumed. The video element's play and pause events now send a
report at once, handled like the interval's.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
A holder's copy of a session another server stopped under the paused
timeout went through expireSessionCopy, which expects the reaper to have
removed the copy already: when the stop was finalized elsewhere it only
closed the transcode, so the copy kept its slot, its live row and its
control lane until the reaper ran. The holder now finishes the end under
the finalization lease when nobody has, then drops the copy and its live
row. It does so even while its own timeout reads zero, and a sweep that
runs out of time resumes at the first candidate it did not reach.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Resolved: desktop and phone-width before-and-after captures now cover the Playback settings screen and timeout exit/toast flow, with capture builds identified. This resolves my earlier missing-capture request; it is not merge approval or verification of the latest build.
Original request
Please add before-and-after captures for the Playback settings screen and the timeout exit/toast flow, covering both desktop and phone-width web. The current collection covers desktop after-states but has no phone-width captures or before-state comparisons. Name the build for each capture; a short recording can cover the timed exit flow. The repository’s visible-change evidence policy treats mobile web as a separate surface.
It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.
The change adds a configurable timeout for eligible native playback sessions that remain paused. It adds feature-aware API responses and web-player notices, exposes the timeout in admin settings, and updates documentation and translations. Password-policy translations are also added.
Adds a 15-minute default timeout, a 0–1440-minute setting range, and a disable value of zero. Lifecycle sweeps page through candidates and expire eligible attempts after checking pause state and exemptions. Tests cover candidate paging, races, and local-copy cleanup.
Adds the attempt-sticky paused_timeout_v1 feature and a distinct 410 response for clients that advertise it. Replans check attempt ownership before returning stop details.
Web player end-reason handling web/src/player/player-fetch.ts, web/src/player/playback-session-wire-v3.ts, web/src/player/hooks/usePlaybackSession.ts, web/src/player/hooks/usePlaybackRealtime.ts, web/src/player/hooks/useWatchProgress.ts, web/src/player/components/VideoPlayer.tsx, web/src/player/components/WatchPage.tsx, web/src/player/**/*.test.*
The player advertises the feature, classifies session-ending 410 responses, reports progress on pause and resume, and shows a paused-timeout notice before exiting playback.
Adds the timeout field to admin playback settings and settings search. Locale files add playback timeout labels and session-ended messages. Password-policy labels and validation messages are also translated.
sequenceDiagram
participant WebPlayer
participant PlaybackAPI
participant PlaybackLifecycleSweep
participant PostgresPlanStore
PlaybackLifecycleSweep->>PostgresPlanStore: query and expire eligible paused attempts
WebPlayer->>PlaybackAPI: request progress or control ticket
PlaybackAPI-->>WebPlayer: return feature-dependent 410 response
WebPlayer->>WebPlayer: show paused-timeout notice and exit playback
Loading
Possibly related issues
Silo-Server/silo-server#3540: This PR expires paused native sessions after the configured timeout; sessions that stop reporting progress remain subject to the existing idle expiry, which the issue identifies as a follow-up.
Suggested reviewers:rhainland, blurbery
Merge Risk: Low · up to dd796
The paused-playback timeout looks sound and well tested. Remaining issues are small: an ambiguous reconnect sentence in the docs, a possibly misleading setting description, and two rare edge cases in the player exit and replan freshness check. None of them should block merge.
Architecture risk: Low · up to dd796
The change affects 4 systems.
Changed systems:web, internal, docs, scripts
Architecture concerns
No architecture-level concerns identified.
Review details
Systems and components
observed — web (service) was modified; 58 changed files map to changed impact.
observed — internal (api) was modified; 27 changed files map to changed impact.
observed — docs (service) was modified; 7 changed files map to changed impact.
observed — scripts (service) was modified; 1 changed file maps to changed impact.
Before / after behavior
observed — Modified behavior in docs/playback-api.md: The progress result table adds a paused-too-long case returning 410 playback_session_paused_timeout when the start listed paused_timeout_v1, and 410 playback_session_ended otherwise.
observed — Modified behavior in docs/playback-api.md: Documents that sessions paused longer than playback.paused_session_timeout_minutes (default 15; 0 disables the timeout) are stopped under a server-minted stop ID and recorded as expired. Progress, replan, and control-ticket requests return the feature-dependent 410 reason; affected players leave playback. Watch Together members, Cast receivers, audio-only files, and sessions that stop reporting progress are excluded.
observed — Modified behavior in docs/playback-api.md: Replan’s ended-session responses now distinguish paused-timeout endings: attempts listing paused_timeout_v1 receive 410 playback_session_paused_timeout; other paused-timeout attempts receive 410 playback_session_ended. The existing administrator-ended 410 and other-ended 404 cases remain.
observed — Modified behavior in docs/realtime-api.md: The stopped-attempt documentation adds the paused-timeout case: when the attempt listed paused_timeout_v1, the response is 410 playback_session_paused_timeout; otherwise it is 410 playback_session_ended. Both cases tell the client to stop minting and not retry.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title 'feat(playback): end native playback left paused past an admin timeout' matches the main change: an admin-configurable timeout that ends native video sessions left paused. The changeset adds…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Description check
The description states a clear, specific purpose: an admin setting that ends native video sessions left paused past a timeout, with the wire contract, exemptions, validation, and risks described. It r…
Full details: Title check
Explanation
The title 'feat(playback): end native playback left paused past an admin timeout' matches the main change: an admin-configurable timeout that ends native video sessions left paused. The changeset adds the setting, the sweep, the claim query, the 410 problem type, and the web toast. The title is specific and concise, and it names the primary behavior.
Full details: Description check
Explanation
The description states a clear, specific purpose: an admin setting that ends native video sessions left paused past a timeout, with the wire contract, exemptions, validation, and risks described. It relates directly to the changeset, which implements the paused-session timeout sweep, the new paused_timeout_v1 feature, the 410 problem type, the locale and settings UI, and the player changes.
Finishing Touches
Generate unit tests (beta)
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
Caution
Some comments are outside the diff and can’t be posted inline due to GitHub limitations.
⚠️ Outside diff range comments (1)
Minor · Terminate reconnect on ended-session 410 responses. · playback-protocol-v3.md:1498-1503
docs/architecture/playback-protocol-v3.md:1498-1503 Minor · Functional Correctness · Quick win
Terminate reconnect on ended-session 410 responses.
Reconnect step 3 starts a fresh attempt for every answer other than a network failure, 5xx, 408, or 429. A replan from the media-error path can return 410 playback_session_paused_timeout for attempts that list paused_timeout_v1, or 410 playback_session_ended otherwise. Section 6.3 requires the client to leave playback on both. Read literally, step 3 starts a new session after the server has ended the previous one.
Add a terminal branch for both ended-session 410 problem types before the fresh-attempt fallback. Keep the retry behavior for transient failures. Keep the fresh-attempt behavior for 404 and the other answers that step 3 already covers.
Review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Organization UI
Review profile: CHILL
Plan: Advanced
Run ID: ab8affff-a6ad-43c9-9df5-747e3023905d
Commits
Reviewing files that changed from the base of the PR and between 3b2b321 and 7d315fa.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.
…ut_v1
The decision fixtures list the server's /api/v2 features, which now
include paused_timeout_v1.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ssified
The sweep decides that a session is not audio-only from the attempt's
effective file, but a replan can move the attempt to another file before
the claim. The claim now requires the attempt still to play that file.
A page's files also fall back to one-by-one reads when the batched read
fails, so one unreadable file no longer holds every session on the page.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.
Reviewing changes in Silo
Include the related issue, expected behavior, and validation steps in the PR description.
For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
Follow this repository's AGENTS.md and CONTRIBUTING.md.
Request another review with @kody start-review in a PR comment.
React with 👍 or 👎 to give feedback on individual suggestions.
Review settingsReview Options
The following review options are enabled or disabled:
Options
Enabled
Bug
✅
Performance
✅
Security
✅
Business Logic
❌
⚠️ 4 Kody Rule(s) were not evaluated
These rules declare that they need repository context beyond this diff, and the review could not retrieve it, so they were not judged on this pull request:
Preserve optional store capabilities through production wrappers
Detach mandatory cleanup from request cancellation and bound its lifetime
Preserve durable media identity and share identity-evidence precedence
Bound decoder throughput trades and share direct-play eligibility
Reconnect step 3 read as starting a new attempt for a 410 too; both
ended-session answers leave playback, as section 6.3 says.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Outside-diff comment on docs/architecture/playback-protocol-v3.md reconnect step 3: fixed in a713f25. Step 3 now says a 410 playback_session_ended or 410 playback_session_paused_timeout leaves playback and starts nothing (§6.3); transient failures still wait, and 404 and the other answers still start a new attempt.
Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.
Reviewing changes in Silo
Include the related issue, expected behavior, and validation steps in the PR description.
For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
Follow this repository's AGENTS.md and CONTRIBUTING.md.
Request another review with @kody start-review in a PR comment.
React with 👍 or 👎 to give feedback on individual suggestions.
Review settingsReview Options
The following review options are enabled or disabled:
Options
Enabled
Bug
✅
Performance
✅
Security
✅
Business Logic
❌
⚠️ 4 Kody Rule(s) were not evaluated
These rules declare that they need repository context beyond this diff, and the review could not retrieve it, so they were not judged on this pull request:
Preserve optional store capabilities through production wrappers
Detach mandatory cleanup from request cancellation and bound its lifetime
Preserve durable media identity and share identity-evidence precedence
Bound decoder throughput trades and share direct-play eligibility
On "Base the paused freshness check on the last accepted sample" (internal/playback/planstore/postgres.go ~606): keeping it as is. The check is meant to tell a client that still talks to the server from one that went quiet, and only the client's own requests move a live attempt's updated_at (an accepted sample in ApplyProgress, or its replan in CompleteReplan). A replan within the window therefore comes from a client that is alive and, with the lifecycle row still paused for the whole timeout, still paused, which is the case the paused timeout is for. Tracking the sample's own time would need a new column for no change in which sessions end.
Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.
Reviewing changes in Silo
Include the related issue, expected behavior, and validation steps in the PR description.
For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
Follow this repository's AGENTS.md and CONTRIBUTING.md.
Request another review with @kody start-review in a PR comment.
React with 👍 or 👎 to give feedback on individual suggestions.
Review settingsReview Options
The following review options are enabled or disabled:
Options
Enabled
Bug
✅
Performance
✅
Security
✅
Business Logic
❌
⚠️ 4 Kody Rule(s) were not evaluated
These rules declare that they need repository context beyond this diff, and the review could not retrieve it, so they were not judged on this pull request:
Preserve optional store capabilities through production wrappers
Detach mandatory cleanup from request cancellation and bound its lifetime
Preserve durable media identity and share identity-evidence precedence
Bound decoder throughput trades and share direct-play eligibility
Files skipped from review as they are similar to previous changes: 42
web/src/locales/ar-XB.json
web/src/locales/ar.json
web/src/locales/bg.json
web/src/locales/ca.json
web/src/locales/cs.json
web/src/locales/da.json
web/src/locales/de.json
web/src/locales/el.json
web/src/locales/en-XA.json
web/src/locales/en.json
web/src/locales/es.json
web/src/locales/et.json
web/src/locales/fi.json
web/src/locales/fr.json
web/src/locales/he.json
web/src/locales/hi.json
web/src/locales/hr.json
web/src/locales/hu.json
web/src/locales/id.json
web/src/locales/it.json
web/src/locales/ja.json
web/src/locales/keys.ts
web/src/locales/ko.json
web/src/locales/lt.json
web/src/locales/lv.json
web/src/locales/ms.json
web/src/locales/nb.json
web/src/locales/nl.json
web/src/locales/pl.json
web/src/locales/pt-BR.json
web/src/locales/pt-PT.json
web/src/locales/ro.json
web/src/locales/ru.json
web/src/locales/sk.json
web/src/locales/sl.json
web/src/locales/sv.json
web/src/locales/th.json
web/src/locales/tr.json
web/src/locales/uk.json
web/src/locales/vi.json
web/src/locales/zh-Hans.json
web/src/locales/zh-Hant.json
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.
Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.
Reviewing changes in Silo
Include the related issue, expected behavior, and validation steps in the PR description.
For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
Follow this repository's AGENTS.md and CONTRIBUTING.md.
Request another review with @kody start-review in a PR comment.
React with 👍 or 👎 to give feedback on individual suggestions.
Review settingsReview Options
The following review options are enabled or disabled:
Options
Enabled
Bug
✅
Performance
✅
Security
✅
Business Logic
❌
⚠️ 4 Kody Rule(s) were not evaluated
These rules declare that they need repository context beyond this diff, and the review could not retrieve it, so they were not judged on this pull request:
Preserve optional store capabilities through production wrappers
Detach mandatory cleanup from request cancellation and bound its lifetime
Preserve durable media identity and share identity-evidence precedence
Bound decoder throughput trades and share direct-play eligibility
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Organization UI
Review profile: CHILL
Plan: Advanced
Run ID: 7c46967a-4405-4ac0-bfdc-871e54f21b21
Commits
Reviewing files that changed from the base of the PR and between 213d57f and dd7966b.
Files selected for processing: 1
docs/architecture/playback-protocol-v3.md
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.
Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.
Reviewing changes in Silo
Include the related issue, expected behavior, and validation steps in the PR description.
For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
Follow this repository's AGENTS.md and CONTRIBUTING.md.
Request another review with @kody start-review in a PR comment.
React with 👍 or 👎 to give feedback on individual suggestions.
Review settingsReview Options
The following review options are enabled or disabled:
Options
Enabled
Bug
✅
Performance
✅
Security
✅
Business Logic
❌
⚠️ 4 Kody Rule(s) were not evaluated
These rules declare that they need repository context beyond this diff, and the review could not retrieve it, so they were not judged on this pull request:
Preserve optional store capabilities through production wrappers
Detach mandatory cleanup from request cancellation and bound its lifetime
Preserve durable media identity and share identity-evidence precedence
Bound decoder throughput trades and share direct-play eligibility
Takes main's push sender test fix (#5209), which covers the same expired
fixture credential as this branch's 65ed4b3.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ions
A server whose first read of playback.paused_session_timeout_minutes failed
answered with the 15-minute default, so it could end paused sessions on a
server where the administrator had turned the timeout off. CachedSetting
gains Lookup, which reports whether its answer came from a read, and the
sweep ends nothing until one succeeds. An unsaved setting still reads as
the default.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…short
The cursor moved past a candidate even when the sweep's deadline cancelled
its claim, so that session waited until the cursor wrapped instead of being
retried on the next sweep.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ded rooms
The sweep and the claim each spelled out the Watch Together membership
check. It is now one fragment, and it names the open phases so the
(phase, created_at) index skips the ended rooms the table keeps.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The reason will be displayed to describe this comment to others. Learn more.
🤖 Claude Code (claude-opus-5-5)
Review of 82618c1, the head after merging main. Four findings below, all introduced by this branch. I'm fixing each one in a commit on this branch, so there's no need to change them yourself. The summary comment covers what else was checked and what's left for the maintainers to settle.
Reviewed head: 8ff6488 (82618c1 plus four fix commits). I merged main into the branch first; the only conflict was push_sender_test.go, where main's #5209 fixed the same expired fixture credential, so the branch now uses main's version.
Fixed on this branch
A failed settings read could end sessions the administrator kept (4d70c63). Until a read succeeded, the sweep used the 15-minute default, even on a server where the timeout is set to 0. The sweep now waits until it has read the setting. TestPausedTimeoutSweepWaitsForTheSettingDB fails without the guard and passes with it.
A claim cut off by the sweep deadline was skipped (c7085fe). The cursor no longer moves past it.
The Watch Together exemption read ended rooms, in two copies (f1a237f). Both queries now share one fragment that names the open phases.
The resume window on native clients. A viewer who presses play within one report interval (10 s on Apple, Android and Roku) of the timeout can still be ended, because the server learns of the resume from the next progress report. The PR already discloses this. Two ways to narrow it: make "report pause and resume as they happen" part of the paused_timeout_v1 contract in §6.3, so the native PRs do what the web player now does; or have the claim treat recent media requests on a held session as a sign of a resume. The first is smaller and stays on the client side.
A stale copy can still mint a control ticket. A server that holds a copy whose session another server ended can mint a control ticket until its next sweep drops the copy (about 15 s). The player's next progress report still gets the 410 and leaves, so the only effect is a short-lived socket.
History details on a rare failure path. When finishing an end fails, or another caller holds the finalization lease, the copy and its live row go before history is written. The recovery then writes history without the last synced client and device details. Main's existing copy drops behave the same way.
Problem type versus a reason field. The new playback_session_paused_timeout type follows the existing feature-negotiation pattern. A reason member on playback_session_ended would need no negotiation, but Problem can't carry extension members today. I'd keep the current design; it should be settled before /api/v2 locks at 1.0.
The progress and replan operations already answer 410 on main without declaring it in OpenAPI. A follow-up is drafted and not filed yet.
Verification
Merged head: Go build, vet, and unit tests for playback, planstore, handlers, apiv2, config and notifications pass.
Fixes: the full DB contract suite ran against a fresh pgvector/pg18 database. All 934 tests that ran passed. The 49 backup tests skipped because the test host has no pg_dump; this change doesn't touch them. make lint-changed reports 0 issues. Web typecheck, eslint and the player Vitest suite (826 tests) pass.
The new setting-read test failed on 82618c1 and passes after the fix. The fixes change nothing a user sees, so the evidence page from the earlier end-to-end run still applies. I didn't repeat that run live.
Validated features
No passed case on the v1.0 board is affected. No passed case pauses native video for 15 minutes or more, and the access-group limits case (#1196 C1) tests limits, not long pauses. Validation tasks: none still holds.
User manual
The new admin setting and its default need a siloserver.org issue, and none is open. Recommended page: docs/running-a-server/playback.md (the Playback settings page), for Paused playback → End paused playback after: what it ends, the 15-minute default, 0 to turn it off, and which plays are exempt.
Apple and Android
Each client has its own PR, linked in the description: Apple #1261, Android #1043, Roku #107.
Council
One round on 82618c1: Sol (gpt-6.2-sol, medium) 6/10, Opus (claude-opus-5-5, medium) 7.5/10, Gemini (gemini-4-neon, medium) 9/10. Gemini's cursor and room-index findings are fixed above. The other findings are either the open items above or not defects:
Opus suggested deciding audio-only in SQL from base_type. That would drop the attached-picture audio case IsAudioOnly covers.
Sol's room-attach race needs a room join at the exact moment of the claim on a session paused past the timeout.
Verdict
Fit: 8/10 · Readiness: 8/10 — conditional (assuming CI is green)
Fit: it closes a real resource leak on shared servers: a forgotten pause holds a transcode slot for a day. It does this with one setting and a sensible default. It adds surface area (a setting, a client feature, a problem type) and changes behavior for everyone on upgrade, which holds it below 9.
Readiness: the approach holds up and the confirmed defects are fixed. What remains is the native resume window, a product choice, and a live re-run on the final head, which I didn't do.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
enhancementNew feature or requestpriority: P2Limited scope, workaround exists, or polishsize/XXXL3000+ added + deleted lines (all files); change volume, not priority.
1 participant
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Related issue: N/A
Validation tasks: none (no validated case covers how long a paused session lives)
Other clients: Apple Silo-Server/silo-apple#1261; Android Silo-Server/silo-android#1043; Roku Silo-Server/silo-roku#107; Web in this pull request
A player that is left paused keeps posting progress every 10 seconds, so its session never goes idle. Until the attempt expires 24 hours later it holds a stream slot and a transcode slot, and for a transcode, an FFmpeg process and its GPU session. On a shared server a few forgotten paused players can use up the transcode slots.
This adds an admin setting, Playback → Paused playback → "End paused playback after" (default 15 minutes; 0 turns it off). The server ends a native video session that has stayed paused that long while its client keeps reporting, and keeps the viewer's position. Clients that advertise the new
paused_timeout_v1feature leave the player with "Playback stopped because it was paused for too long." Older builds get the answer they already handle for an administrator's end, and leave with that wording.Approach
output.current_sink = cast_receiver) and audio-only files (audiobooks, podcasts). A session whose client stopped reporting stays with the existing 30-minute idle expiry.ExpirePausedAttemptlocks the attempt row, then reads the lifecycle row in a second statement. That way a resume that commits while the claim waits keeps the session live; a singleUPDATEjoining the lifecycle row would read it as of the statement's start. The claim rechecks the Cast and Watch Together exemptions under the lock.expired, with a watch-provider pause (a stop when the play had completed).paused_timeout_v1(attempt-sticky, advertised on /api/v2) and problem typeplayback_session_paused_timeout(410). Progress, replan and the control-ticket mint answer it to attempts that advertised the feature, andplayback_session_endedotherwise. Media requests keep the existing 410. No socket frame is sent; the next progress report delivers the answer. Documented indocs/architecture/playback-lifecycle.md, protocol v3 §6.3,docs/playback-api.mdanddocs/realtime-api.md.Validation
make lint-changed: 0 issues. Web typecheck, eslint and Vitest (player and settings): pass.playback_session_paused_timeoutfrom progress, replan and the ticket mint;playback_session_endedfrom the same routes;TestPausedTimeoutSweepWaitsForTheSettingDBfails without the fix), a claim the sweep deadline cut short was skipped rather than retried, the Watch Together exemption read ended rooms, and an unused web helper. After those fixes, the full DB contract suite,make lint-changed, and the web player tests pass.8ff6488ca8, after those fixes: the updated and legacy clients were ended 65 s after pausing with the same problem types, the playing and resumed sessions kept going, and with the timeout at 0 a session paused for 145 s kept going.Evidence
Evidence: https://evidence.siloserver.org/r/silo-server/paused-playback-timeout/
Before/after pairs at desktop and phone width for the Playback settings page and the paused-timeout exit, the protocol results for updated and legacy clients, and the test summary.
Risks
Checklist
AI Disclosure
Council: gpt, gemini, 2 rounds, reviewed 91a28dd2fb. Review round: Sol 6/10, Opus 7.5/10, Gemini 9/10 on 82618c1; confirmed findings fixed in 4d70c63..8ff6488.
🤖 Generated with Claude Code
Note
End native playback sessions left paused past an admin timeout
Postgres.ExpirePausedAttemptin postgres.go.ParsePausedSessionTimeoutin paused_timeout.go and cached per handler for one minute. The admin UI gains a minutes field in PausedPlaybackGroup.tsx.paused_timeout_v1client feature and a dedicated410 playback_session_paused_timeoutproblem type. Clients that advertise the feature get the new problem; others get the existingplayback_session_ended. The web player advertises the feature, shows a paused-timeout notice, and exits the session.CachedSetting.Getin cached_setting.go now delegates to a newLookupmethod;ReplanPlaybackV2in playback_service.go now returns forbidden for attempts owned by another profile and 410 for owned attempts ended by admin or paused timeout. Control-socket minting stops after any 410.Macroscope summarized 44d08c0.