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
Viewers cannot turn Up Next off on Android. Auto-Play Next Episode only stops the countdown; the card still opens before or at the end of every episode.
Show Next Up on the phone and TV now offers Off. With Off, the player opens no Up Next card before or at the end and starts no next episode; when playback ends it closes the way Back does. A shuffle still moves on, since the viewer asked for one.
Approach
Off writes playback.next_up_enabled false (settings revision 32, feat(web): let Show Next Up be turned off silo-server#4503) and leaves the stored seconds alone; choosing a time turns Next Up back on. One picker owns both keys, so Use profile setting clears both together.
The key is detected from the server's settings manifest, like the buffering quality mode. A server without it is never sent it: Off is hidden and Next Up stays on. A write made before the manifest is read is kept and sent again after the first refresh.
On the TV, an Up Next overlay the viewer opened by hand stays up at the end, without a countdown.
./gradlew testDebugUnitTest with main merged in: shared 2,526, android-shared 2,332, phone 1,016 and Android TV 1,415 tests, 0 failures. On the head, the diagnostics, settings-store and Next Up choice suites, the phone player view model suite and the full TV suite pass, and both apps build with assembleDebug.
Lint (lintDebug for all three modules, lintVitalRelease for both apps) passed with no new findings before main was merged in.
On phone and Android TV emulators against a server built from feat(settings): add a setting that turns Next Up off silo-server#4501: both pickers offer Off, and choosing it stores next_up_enabled = false as that device's value. With Off and Auto-Play on, an episode played past the 30-second prompt point to its end with no Up Next card. The player then closed, the server marked the episode watched, and the next episode did not start.
Checked by reading the code, not on a device: a TV overlay opened by hand with Off, and picture-in-picture at the end. With Off, the phone keeps the ended frame in picture-in-picture and leaves the player once picture-in-picture ends, unless playback was restarted from its controls meanwhile.
Review fixes on this branch, each with a phone test that failed before the fix where the phone fixture can reach it: when Next Up turns off while a card shows, a card before the end goes away as Keep Watching would, and one at the end (the finished card included) closes the player (nextUpTurnedOffBeforeTheEndClearsTheCardAndClosesAtTheEnd, nextUpTurnedOffWhileTheFinishedCardWaitsClosesThePlayer). A countdown armed before Off arrived closes instead of playing the next episode (nextUpTurnedOffDuringTheEndCountdownClosesInsteadOfAdvancing). On TV, only an overlay the viewer opened stays up at the end, and dismissing it there leaves the player. A seek back after playback ends keeps the player open when Next Up turns off afterwards or a slow next-episode lookup finishes, including when the plan gives no duration and when the seek came from the system media controls (nextUpTurnedOffAfterASeekBackFromTheFinishedCardKeepsPlaying, nextUpTurnedOffAfterTheSystemControlsLeaveTheEndKeepsPlaying). On a server without the key, choosing a time no longer pins the picker to this device (AndroidPlayerSettingsStoreTest). On TV, TvPlayerNextUpOffResolverTest covers a slow next-episode lookup that finishes after Off on a plan with no duration: a seek back keeps the player open whether the lookup or the Off collector runs first, and an end nothing moved from still closes. The other TV paths were checked by reading the code.
Review fixes in 0e2a454: "at the end" no longer compares the position with the duration, which blocked the close when the plan's duration runs past the end of the stream or the phone ended in the background (nextUpTurnedOffAtTheEndClosesWhenTheStreamEndsShortOfTheDuration failed before the fix). A countdown that expires with Off closes only while playback is still at the end. On the phone, the check for restarted playback runs for every close request. The phone player view model suite (33) and the TV player suites (79) pass. The last two fixes were checked by reading the code.
Review fix in 53b6474: a seek that the server refuses to re-anchor rolls back without moving the ended item, and Off afterwards now closes the player instead of dismissing the finished card (nextUpTurnedOffAfterARolledBackSeekFromTheFinishedCardClosesThePlayer failed before the fix). The phone player tests (310) and TV player tests (507) pass. The TV side was checked by reading the code.
Review fix in 5423f7c: when the end countdown sees Off before the settings collector does, during a seek still pending from the finished card, it now arms the rollback close the same way the collector does, so a refused re-anchor closes the player instead of leaving it on the ended frame. Both paths share one helper on phone and TV. The phone player tests (323) and TV player tests (517) pass. The fixture can't order the countdown tick between the settings hops, so this was checked by reading the code.
Review fix in d4af5a9: Off at the end now closes the player even when the finished card (phone) or overlay (TV) is already gone, as long as playback never left the end, and asks the screen to close only once per end. A new test on each client fails on 5423f7c and passes on d4af5a9. The full phone and TV unit suites pass.
Review pass on 2026-12-02: main merged in (7f35d33), with the new segmentSkipController argument that main's recap and credits pill (feat(player): time the recap and credits skip pills like Skip Intro #1045) requires in TvPlayerNextUpOffResolverTest. Fixes in e44df67, 6757e2b, 38a1f21, 01aca70 and ea74cc4: a refused seek that rolls back to the end now closes under Off whoever dismissed the finished card, which replaces the closeAtEndIfSeekRollsBack flag (nextUpTurnedOffWhileAScrubFromTheFinishedCardIsPendingClosesWhenItRollsBack failed before the fix). The TV close reports the end position before it exits, as the phone does. A TV retry or renewal at the end forgets the old end (offDuringAReloadFromTheEndDoesNotClose fails without the fix), and a version switch keeps it, since the current item stays mounted if the switch fails. An end the old stream reports while a seek's re-anchor is pending no longer closes the player. The full phone suite (1,034) passes on 01aca70, and the full TV suite (1,434) on ea74cc4. The TV position report and the pending re-anchor fix were checked by reading the code, because neither fixture can reach them.
After the move to revision 32 (b1a8258): the settings conformance tests and AndroidPlayerSettingsStoreTest pass.
Review pass on 2026-12-04: the vendored manifest.json and conformance.json are byte-identical to feat(web): let Show Next Up be turned off silo-server#4503's head (1038dee2c), and the server's cmd/settingsgen regenerates the same SettingKeys.kt. Main merged in (af19cc3). Fixes in b2340c3, 4b72528, a8fae39, 5982241 and be56968, all for Off meeting a pending seek or a version switch at the end: a TV overlay the viewer opened during a refused seek now closes the player when dismissed. A failed TV version switch that kept an ended item now closes, unless a newer seek is still pending. An end no longer survives a seek's adopted stream or a published TV replacement. The full phone (1,034) and TV (1,433) unit suites pass on be56968's code, along with the shared suite (2,556) and the settings tests. No unit fixture drives a refused TV re-anchor, a TV version switch, or an end during a pending re-anchor, so these fixes were checked by reading.
Phone and TV Settings → Playback → Show Next Up, and recordings of playback reaching the end with Off on each. Before, the picker had no Off and the card always opened. Phone, tablet and foldable share the phone settings layout and player.
Risks
The re-vendor above waits on Silo-Server/silo-server#4503 merging; this merges after it. Off is detected from the server's manifest keys, not the revision number, so the app works against either server in the meantime.
Checklist
I read and can explain the complete diff.
This pull request addresses one concern.
The Evidence section shows every change a user can see, or how I checked a change nobody sees.
Visual review: not run; the review fixes change edge paths that the evidence page doesn't show.
Fixed: the end check's position comparison, a countdown closing after a seek back, a second close request queued during picture-in-picture, the countdown dismissing the finished card without arming the rollback close (round 3), a refused seek from a card the seek itself dismissed (round 5), the TV close's stale final position (round 5), a TV reload reading the old end (round 5), an end from the old stream during a pending re-anchor (round 6, 01aca70), a failed TV version switch losing the end (from Kody, ea74cc4), a TV overlay opened during a refused seek (round 7, b2340c3), a failed TV version switch after a cancelled seek (round 7, 4b72528), stale end flags after a seek's stream is adopted (round 7, a8fae39), a failed switch closing over a newer seek (round 8, 5982241), and stale end flags after a TV replacement is published (round 8, be56968). The council hasn't reviewed 5982241 or be56968. Open: an end from the old item that arrives after a seek's stream is adopted but before it mounts can still close the player (round 8, narrow, needs end callbacks tied to their mount). The settings revision now matches Silo-Server/silo-server#4503 (32). Answered: replaying an unconfirmed time write, Off arriving during a TV version switch made from the end (the switch resumes at the end), a remembered Off shown before the server's manifest is read (intended, as for the buffering mode), a reset racing a time's two writes, TV picture-in-picture (the TV app doesn't support it), and Off arriving during an end countdown on a TV overlay the viewer had opened (the end already made it an automatic countdown overlay). A TV version-switch failure that keeps position reports blocked predates this PR.
AI Disclosure
Harness: Claude Code, running in T3 Code
Tool(s): Claude Code, GitHub CLI, Codex CLI (review only)
Adversarial review: four independent reviews (gpt-6.2-sol, gpt-6.2-astra, claude-opus-5-5, claude-fable-5-2) of the branch diff for correctness, repository standards and the discussion's request, repeated on later cleanup; the real findings were fixed before opening
Note
Add "Off" option for Next Up setting on Android and TV
Adds the playback.next_up_enabled settings key (contract revision 32, default true) and exposes it through PlayerSettingsStore.nextUpEnabledFlow, nextUpEnabledSupportedFlow, and setNextUpEnabled. Off is only shown when the server manifest stores the key or Next Up is already disabled; unsupported servers see the setting as enabled.
The playback settings screens on Android and TV use shared NextUpChoice options (0/10/30/60/120 seconds plus Off) via NextUpChoice.kt. Choosing Off writes only the enabled flag; choosing a time writes enabled=true and the prompt seconds.
Both players track the ended state of playback. With Next Up off, no automatic Next Up prompt appears before or at the end, a running countdown no longer auto-advances, and the player requests closure at the end. Seeks away from the end, viewer-opened overlays, room playback, and shuffle playback keep the player open. PlayerScreen and TvPlayerScreen defer the exit during picture-in-picture and cancel it if playback restarts into READY or BUFFERING.
Behavioral Change: settings contract revision bumps from 30 to 32, and refresh reconciliation removes manifest-detected keys from device overrides when the active server does not store them. Servers without the new key force Next Up to enabled regardless of any stored preference.
Added TvPlayerViewModel.settleEndAfterAbandonedMove and called it from the replacement-load failure handler and the seek-recovery rollback branch in TvPlayerViewModel, and cleared end state when a replacement stream is adopted [a8fae39]
Cleared end and close-at-end state when adopting a replacement stream in the PlayerViewModel server-seek recovery method [a8fae39]
…arker
The Show Next Up setting offers "At end" and "N seconds before end", but on
an episode with a credits marker both apps opened the card at the credits
start whatever was chosen. The TV player never read the setting at all.
Both players now open Up Next when playback crosses the chosen number of
seconds before the end of the file, and only when the stream ends for "At
end", as the iOS and tvOS player already does. Credits markers still drive
Skip Credits; skipping credits that run to the end ends the stream, which
opens the card. The TV settings screen now assumes the same 30-second
default as the settings store and the server.
FixesSilo-Server#910
…credits
Moving Up Next to the end of the file also moved the point at which the TV
player treats an episode as finished for the series page. Leaving during
the closing credits then opened the series on the episode just watched,
and leaving after an early prompt during the final scene opened it on the
next one.
Record the closing-credits crossing on its own again, and count the Up
Next prompt only when the stream has ended. Update the comments that still
described the credits-based trigger.
Viewers who would rather go back to the series at the end of an episode
cannot turn the Next Up card off; Auto-play Next only stops its countdown.
The Show Next Up picker on phone and TV now offers Off first. It writes
playback.next_up_enabled (settings revision 30), and choosing a time turns
Next Up back on. With Off the player opens no card before or at the end and
closes the way Back does when playback ends; a shuffle still moves on. One
control owns both Next Up keys, so Use profile setting clears them together.
A server whose settings manifest lacks the key is never sent it: the picker
hides Off and Next Up stays on there, as with the buffering quality mode.
The settings bindings and the vendored manifest move to revision 30.
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 manifest-backed setting to control Next Up, adds Off and timing choices to Android and TV playback settings, and updates both players to handle playback end when Next Up is disabled.
Changes: Next Up setting and playback
Layer / File(s)
Summary
Define and store the Next Up setting shared/.../PlaybackSettingsKeys.kt, shared/.../SettingKeys.kt, shared/commonTest/resources/settings/v1/*, android-shared/.../PlayerSettingsStore.kt, android-shared/.../AndroidPlayerSettingsStore.kt, android-shared/.../AndroidPlayerSettingsStoreTest.kt, android-shared/.../DiagnosticsBundleBuilder.kt
The settings contract defines playback.next_up_enabled as a remote boolean that defaults to true. The Android store exposes its value and support status, writes the setting, and tracks manifest-detected writes. The diagnostics allowlist includes the key.
Expose Off and timing choices in settings android-shared/.../NextUpChoice.kt, android-shared/.../NextUpChoiceTest.kt, androidApp/.../settings/SettingsViewModel.kt, androidApp/.../settings/SettingsPages.kt, androidApp/.../settings/PlaybackSettings.kt, androidTvApp/.../settings/TvSettingsViewModel.kt, androidTvApp/.../settings/TvSettingsScreen.kt
NextUpChoice defines Off and prompt-time options, selection, writes, and labels. Android and TV settings pass enabled and support state to their pickers and apply nullable choices.
Handle playback end when Next Up is disabled androidApp/.../player/PlayerViewModel.kt, androidApp/.../player/PlayerScreen.kt, androidApp/.../player/PlayerViewModelLoadOwnershipIntegrationTest.kt, androidTvApp/.../player/TvPlayerViewModel.kt, androidTvApp/.../player/TvPlayerScreen.kt, androidTvApp/.../player/TvPlayerNextUpOffResolverTest.kt
Both player ViewModels suppress regular-playback Next Up behavior when disabled and emit close requests at playback end. Their screens handle those requests. Tests cover disabling Next Up before playback end, during countdown, while a card is open, and during pending episode resolution.
sequenceDiagram
participant PlayerViewModel
participant PlayerScreen
participant MediaController
PlayerViewModel->>PlayerScreen: Emit closeAtEndRequests
PlayerScreen->>MediaController: Read current position and duration
PlayerScreen->>PlayerViewModel: Report position and duration
With Next Up set to Off, a few rare timing cases can leave the player on its ended frame or cancel a seek made while picture-in-picture is closing. The user can always exit with Back. These are small edge cases and the overall behavior works, but they are worth fixing before merge.
Security architecture risk: Low · up to 7f35d
Next Up Off is limited to the viewer’s playback settings and does not change who controls Watch Party playback. The main risk is that an interrupted save or reset can leave only half of the viewer’s choice applied. Availability also depends on Silo Server publishing the new setting.
Retained concerns
Trivial · reliability · inferred: A timed choice looks like one operation but commits enablement before timing, in separate store calls that each resolve the active scope. Cancellation or a scope change between the calls can leave Next Up enabled at the old time or split the updates across scopes. Returning to the profile setting captures one scope and clears both local markers together, but sends separate deletes; if only one lands, the device still inherits only half of the profile choice until reconciliation succeeds. The merge-base picker could not leave this mixed two-key state.
observed — The new close request is produced inside the player ViewModel and consumed by its screen. The inspected episode-end paths exclude Watch Party transport or room playback before taking the Off exit; shuffle follows its existing branch.
Trust Boundaries and Controls
observed — The active server’s manifest determines key compatibility, not write authority. The existing flusher validates captured identity, profile, token and server before dispatch when authorization tracking is configured. An unknown manifest defers work; a manifest known to lack the key prevents dispatch.
Resilience and Maintainability Implications
inferred — TV’s delivered request invokes the same guarded terminal exit as Back, including session stop. The phone waits for picture-in-picture to end and rechecks live playback before exiting. Neither one-shot request replays to a replacement collector: if an end request is emitted while the screen is not collecting, the ViewModel can record a request without the screen performing cleanup. Whether normal screen recreation reaches that window was not established.
Hardening Proposals
proposed — Capture one settings scope and commit a timed choice in one local transaction. Where the server API still requires per-key writes, track the pair until both operations are acknowledged so the picker does not present a partially applied reset as complete.
Rollout and rollback
inferred — Silo Server now controls whether Off is offered through the key advertised in its manifest, not through revision 31 alone. The fixtures point to unmerged Silo Server PR #4501, and the PR reports that server main used revision 31 for a different key. Before enabling the feature in a release, ship a server contract that advertises the key and refresh the vendored fixtures and bindings from that landed contract. After rollback to a server without the key, a successful manifest refresh restores the enabled behavior and excludes that key from writes; this is not a deletion of a saved local choice.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title "feat(player): let viewers turn Next Up off" matches the main change. The changeset adds an Off choice to the phone and TV Show Next Up setting, backed by the new playback.next_up_enabled ke…
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 that the PR adds an Off option to the phone and Android TV Show Next Up setting, which ends playback without a Next Up card, and the changeset implements this. It also lists the…
Full details: Title check
Explanation
The title "feat(player): let viewers turn Next Up off" matches the main change. The changeset adds an Off choice to the phone and TV Show Next Up setting, backed by the new playback.next_up_enabled key, and makes the player close at the end when Off is set. The title is short, specific, and uses the conventional commit form.
Full details: Description check
Explanation
The description states that the PR adds an Off option to the phone and Android TV Show Next Up setting, which ends playback without a Next Up card, and the changeset implements this. It also lists the settings key, the revision bump, the NextUpChoice picker, the TV and phone player changes, and the tests. The description is specific and related to the changeset, so it passes.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Visible changes lack reviewable evidence: Evidence: EVIDENCE_LINK is a placeholder, not an evidence URL or attached capture.
The Show Next Up picker adds Off (PlaybackSettings.kt, TvSettingsScreen.kt) on Android phone, tablet, foldable folded and open, and Android TV. No before/after captures are attached; provide same-screen pairs for each device configuration.
Turning Next Up off suppresses the card and automatic next episode, then exits at playback end (PlayerViewModel.kt, TvPlayerViewModel.kt) on phone, tablet, foldable folded and open, and TV. The PR says this was not captured; provide recordings of the end-of-playback behavior on each.
On TV, a manually opened Up Next overlay remains at the end without a countdown (TvPlayerViewModel.kt). No recording shows this; include it in the TV playback capture.
Name the device and build or commit for each capture. The reported emulator check and view-model tests do not show these visible changes. Suggested fix: replace the placeholder with the required screenshots and recordings, or attach them under Evidence.
Automated check: Macroscope check run agent (gpt-6-luna). Evidence was not reviewed for correctness.
The reason will be displayed to describe this comment to others. Learn more.
Timing choices do not override an inherited enabled setting
A later profile change to Off disables Next Up despite the device's explicit timing choice. Call store.setNextUpEnabled(true) whenever a timing choice is selected.
Prompt for LLM
File android-shared/src/androidMain/kotlin/org/siloserver/silo/common/settings/NextUpChoice.kt, lines 32-33:
Timing choices do not override an inherited enabled setting
Selecting a timing while the inherited profile value is enabled writes only the timing override, so a later profile change to Off disables Next Up despite the device's explicit timing choice. Write an enabled device override whenever a timing choice is selected.
Suggested code:
store.setNextUpEnabled(true)
store.setNextUpPromptSeconds(choice)
The reason will be displayed to describe this comment to others. Learn more.
Fixed in fa22e02. Where the server stores Off, choosing a time now writes next_up_enabled = true as well as the seconds, so the picker's choice is this device's whole choice. On a server without the key only a saved Off is turned back on, so the key is still never sent there. NextUpChoiceTest covers the writes.
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the update. Writing both values when the server supports the setting addresses the inherited-setting concern, while preserving compatibility with older servers. The added NextUpChoiceTest coverage is helpful.
I haven’t independently verified the commit or run the tests.
The reason will be displayed to describe this comment to others. Learn more.
Disabling Next Up leaves an active TV countdown running
An existing countdown can advance to the next episode after Next Up is disabled. Cancel nextUpCountdownJob and clear nextUpCountdownSeconds when handling the disabled setting.
Prompt for LLM
File androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/player/TvPlayerViewModel.kt, lines 5422-5424:
Disabling Next Up leaves an active TV countdown running
If Next Up is disabled after the automatic overlay has opened, the end event marks the overlay ended without canceling its existing countdown, which then automatically advances to the next episode. Cancel the countdown and clear its displayed value when handling the disabled setting.
Suggested code:
if (_uiState.value.showNextUp) {
nextUpCountdownJob?.cancel()
nextUpCountdownJob = null
_uiState.update { it.copy(nextUpVideoEnded = true, nextUpCountdownSeconds = null) }
}
The reason will be displayed to describe this comment to others. Learn more.
Not realistic: the overlay covers the TV screen while it counts down, so the viewer cannot reach Settings, and the setting is read when playback starts. Only a background settings refresh landing in that last minute or two could flip it. The branch exists for the overlay the viewer opened by hand, which has no countdown. Leaving it.
The reason will be displayed to describe this comment to others. Learn more.
Understood. The countdown scenario depends on a background settings refresh during a narrow window, while the intended manual-overlay case has no countdown. Given that tradeoff, leaving the code as-is is reasonable.
The reason will be displayed to describe this comment to others. Learn more.
Short files never trigger their before-end Next Up prompt
When the lead time is at least the file duration, playback cannot cross promptStart, so the card appears only at the end. Handle the initial playback sample when promptStart is at or before zero.
Prompt for LLM
File shared/src/commonMain/kotlin/org/siloserver/silo/domain/player/NextUpPrompt.kt, lines 22-23:
Short files never trigger their before-end Next Up prompt
When the configured lead time is at least the file duration, the prompt point is zero or negative and playback starting at zero can never cross it, so the card appears only at the end instead of before it. Handle the initial playback sample when the computed prompt point is at or before zero.
The reason will be displayed to describe this comment to others. Learn more.
Understood. This duplicates the finding on #994 and describes existing behavior on main: when a file is no longer than the configured lead time, Up Next appears at the end. It is not a new regression introduced by #995.
Choosing a time wrote only the seconds while Next Up was already on, so
next_up_enabled stayed inherited from the profile. Turning Next Up off for
the profile elsewhere then turned it off on this device too, although its
picker showed a choice of its own. Where the server stores Off, a time now
writes both keys.
…t point
An Up Next overlay the viewer opened by hand has no countdown. Once the
before-end point covered every episode, playback crossing it committed that
same overlay with a countdown, which advanced as soon as the stream ended.
The crossing now leaves a hand-opened overlay alone; the end still commits it
as before.
The closing-credits check that sets the series-page return also skips while
Play Now's handoff is running, as onApproachingEnd did before it moved.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… closes
A time chosen before the server's settings manifest was read wrote only the
seconds, so a profile that turned Next Up off later still turned it off on
this device. A time now always writes Next Up on as well; the flusher holds
that key until the manifest is read and drops it for a server without it.
With Off, the phone closed at the end without reporting the end position,
and the position ticker stops in the background, so the session could save
an earlier position. The close now reports the controller's position first.
On TV, a countdown left from before Off arrived no longer advances when the
stream ends.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The reason will be displayed to describe this comment to others. Learn more.
Review of this PR's own commits (9a0ef16, fa22e02) at fa22e02. Three findings; I'm fixing all three in a commit on this branch, so there's no need to change them yourself.
Fit: 7/10 · Readiness: 7/10 — conditional (assuming CI is green)
Show Next Up gains Off on phone and TV. With Off, the player shows no Up Next card, starts no next episode, and closes at the end. Off appears only when the server's settings manifest has playback.next_up_enabled. The setting itself now comes from Silo-Server/silo-server#4503, at settings revision 32, since #4501 closed in its favor. This pass checked the move to revision 32, merged main, and ran two council rounds. It fixed five more rare cases where Off meets a pending seek or a version switch at the end.
Addressed on this branch
Revision 32 (b1a8258), checked: the vendored manifest.json and conformance.json are byte-identical to #4503's head (1038dee2c), and the server's cmd/settingsgen regenerates the same SettingKeys.kt. No other open server PR claims revision 32.
af19cc3, merge of main (5 commits): the overlap with this branch is a version-variant argument in PlayerViewModel and the Arabic subtitle preview font in TvSettingsScreen. Neither touches the Off paths.
b2340c3 (Sol): on TV, an Up Next overlay the viewer opened while a seek's re-anchor was pending was never marked as ended. If the server then refused the seek, dismissing that overlay left the player on the ended frame. It now closes.
4b72528 (Opus): a version switch cancels a pending seek without a rollback. If the switch then failed and kept an ended item, nothing closed the player under Off. The rollback and the failed load now share one helper, settleEndAfterAbandonedMove().
5982241 (Sol, a regression from 4b72528): a seek made while a version switch loads is queued as a re-anchor. The failed load now leaves the end to that seek instead of closing over it.
a8fae39 (Gemini) and be56968 (Gemini): an end now stops counting once a seek's stream is adopted, or a TV replacement load is published, rather than only when Media3 mounts the new item.
bfc6ff8 (Opus): a doc comment moved back onto closeAtEndWithNextUpOff.
Maintainer decision: does Off apply to movies? Still open. Here, Off also closes the player at the end of a movie. The web player in #4503 applies Off to series episodes only. All clients should follow one rule.
Left open, narrow (round 8, Sol and Opus): after a seek's stream is adopted and before it mounts, an end from the old item still reaches onApproachingEnd. Neither player screen checks which mount produced it, so Off can close the player right after a successful seek. The fix in a8fae39 narrows this window but doesn't close it. A full repair ties end callbacks to their mount, on both clients, and needs its own change and test.
Left open, narrow (from CodeRabbit, unchanged): on the phone, Off at the end in picture-in-picture waits for the window to close. A re-anchoring seek started from the system controls during that wait can still be closed over.
Optional cleanup: phone and TV each keep their own copy of the end-of-playback flags. Opus suggests one shared class, with each player keeping only its own exemptions.
Validation
Tests: on the merged code, the full phone (1,034) and TV (1,433) unit suites pass, along with shared (2,556) and the settings and diagnostics tests in android-shared. Phone code hasn't changed since a8fae39, where the phone suite last ran. The TV suite ran on be56968.
Checked by reading only: every fix in this pass. No unit fixture drives a refused TV re-anchor, a TV version switch, or an end during a pending re-anchor.
Not run on a device in this pass. The earlier emulator run against a server with the setting covers the main Off end, which these fixes don't change.
Rounds 1–6 are in the PR body. Round 8 found every round-7 fix resolved and raised the three issues fixed in 5982241, be56968 and bfc6ff8, plus the open adoption-to-mount window. The council hasn't reviewed 5982241 or be56968.
Answered, not changed: Off arriving during a TV version switch made from the end. The switch resumes at the ended position, and Off only arrives then if it's changed on another device. Sol notes that a longer cut wouldn't end at that position; that stays a rare case. Also answered: a remembered Off shown before the server's manifest is read. That's intended, as for the buffering mode, and a server without the key turns Next Up back on once its manifest is read.
For the maintainers
Fit 7: viewers asked for this, and Apple, Roku and web are adding the same setting. As a new setting it holds at 7, and the movie question is still open.
Readiness 7: the approach holds, and every finding this pass is fixed except the narrow adoption-to-mount window and the picture-in-picture case. It stays conditional on #4503 merging and the re-vendor after it, those two narrow cases, and the latest fixes being checked by reading and tests only, without a council round on be56968.
The evidence link is present for the picker, but the PR says the playback behavior was not captured.
With Next Up Off, playback suppresses the card and automatic next episode, then exits at the end; the prompt also now triggers at the configured lead time instead of at credits markers. Add recordings of these playback flows on Android phone, tablet, foldable folded and open, and Android TV.
On Android TV, include a recording showing a manually opened Up Next overlay remaining visible at the end without a countdown.
The linked evidence page should let reviewers verify the picker on phone, tablet, foldable folded and open, and TV.
Automated check: Macroscope check run agent (gpt-6-luna). Evidence was not reviewed for correctness.
Turning Next Up off at the end closed the player only while the finished
card or overlay still showed. If it was already gone but playback never
left the end (dismissed, or a seek from it rolled back while Next Up was
back on), Off left an ended player open with nothing on screen. Check the
end before the visibility guard on phone and TV, and ask the screen to
close only once per end.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Main's recap and credits pill (Silo-Server#1045) added a segmentSkipController
parameter to TvPlayerViewModel; pass one in TvPlayerNextUpOffResolverTest.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…d card
A seek from the finished card that the server refused rolled back to the
end, but closed under Off only when Off itself had dismissed the card. A
scrub or skip dismisses it first, so Off arriving while that seek was
pending left an ended player open with nothing on screen. The rollback now
closes whenever playback is back at the end with Off on and no close was
asked for at this end, which makes the separate rollback flag unnecessary.
On TV, the close at the end now reports the end position before it exits,
as the phone does: the stop journals the last reported position, and a
close right after a credits skip to the end could come before the next
position poll. TV Keep Watching at the end also records that it asked to
close.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The phone clears its end-of-playback state on every load; TV cleared it
only for a next episode or a Watch Party load. After a version switch or
retry at the end, Off arriving through that load's settings refresh read
the old end and closed the player mid-reload.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A timed choice looks like one operation but commits enablement before timing, in separate store calls that each resolve the active scope. Cancellation or a scope change between the calls can leave Next Up enabled at the old time or split the updates across scopes. Returning to the profile setting captures one scope and clears both local markers together, but sends separate deletes; if only one lands, the device still inherits only half of the profile choice until reconciliation succeeds. The merge-base picker could not leave this mixed two-key state.
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: 4e52bebc-9a6f-4151-8991-cc37872d3560
Commits
Reviewing files that changed from the base of the PR and between 5423f7c and 7f35d33.
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.
The reason will be displayed to describe this comment to others. Learn more.
Minor · Functional Correctness · Quick win
A seek during deferred end closure can be lost.
When Off closes playback at the end in picture-in-picture, a seek that needs a server re-anchor can start before the window closes. The mounted media stays in STATE_ENDED until the replacement mounts. When picture-in-picture ends first, the guard at PlayerScreen.kt:733-738 sees STATE_ENDED and calls exitPlayer(). onExit() then cancels the queued re-anchor and the seek, so playback closes instead of resuming at the requested position.
Check for a pending seek or re-anchor before closing the player. Wait for it to settle. After a rollback, close as before. After a replacement mounts, keep playback. Close immediately when no seek is pending.
Relevant code: PlayerViewModel.kt:3858-3876 (re-anchor queueing), PlayerViewModel.kt:3390-3401 (cancellation in resetPlaybackRecoveryState).
The reason will be displayed to describe this comment to others. Learn more.
Confirmed as a narrow case, and left for the maintainers. Off closes at the end while the phone is in picture-in-picture, so the close waits for the window to end. If a seek that needs a server re-anchor starts from the system controls during that wait, and the window ends before the seek settles, the guard still sees STATE_ENDED and exits. Fixing it means handing the close back to the seek: give up the pending close while a re-anchor is in flight, and let the rollback ask again. That interacts with the rollback's own close, so it needs its own change and test rather than a quick edit here. Outside picture-in-picture, 01aca70 already keeps an end during a pending re-anchor from closing.
The reason will be displayed to describe this comment to others. Learn more.
@Quick104 Thanks for confirming. I won’t mark the finding as addressed.
Learnings added
Learnt from: Quick104
Repo: Silo-Server/silo-android PR: 995
File: androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/PlayerScreen.kt:733-738
Timestamp: 2026-12-02T20:54:13.867Z
Learning: Within repository "Silo-Server/silo-android", only for files matching one of ["androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/PlayerScreen.kt"]: In the phone PlayerScreen.kt, a close-at-end request for Next Up Off can already be waiting for picture-in-picture to end when a seek requiring a server re-anchor starts. Media3 can still report STATE_ENDED while the re-anchor is pending, so that state alone does not justify the deferred close. Coordinate the close with seek settlement, including re-evaluating closure if rollback leaves playback ended.
Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.
The reason will be displayed to describe this comment to others. Learn more.
Minor · Functional Correctness · Quick win
Retain pending closure until the screen acknowledges it.
If the screen is recreated while its collector waits for PiP to end, cancellation discards that wait. LaunchedEffect is cancelled when it leaves the composition, and replay = 0 supplies no request to the replacement collector. (developer.android.com)
The supplied recreation path retains the ViewModel and media. closeAtEndRequested therefore remains true, but no pending request remains available. Playback can stay on the ended frame after PiP ends.
Store an acknowledged pending-close state tied to the current end. Clear it when playback leaves the end or a new load starts. Revalidate it before navigation so recreation does not close resumed playback.
The reason will be displayed to describe this comment to others. Learn more.
This doesn't apply here. The player activity declares orientation|screenSize|smallestScreenSize|screenLayout and the other changes in android:configChanges, so entering or leaving picture-in-picture doesn't recreate it, and LaunchedEffect(Unit) keeps waiting. A process death would lose the view model and its closeAtEndRequested too, so no request can be stranded.
The reason will be displayed to describe this comment to others. Learn more.
Analysis chain
Script executed:
#!/bin/bashprintf'%s\n''--- Manifest locations and configuration ---'
fd -a '^AndroidManifest\.xml$'.|whileread -r f;doecho"--- $f"; rg -n -C5 'configChanges|supportsPictureInPicture|<activity|android:name='"$f"| head -200;doneprintf'%s\n''--- PlayerScreen outline ---'
ast-grep outline androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/PlayerScreen.kt --items all --match 'PlayerScreen|Picture|PiP|Close'2>&1| head -180
printf'%s\n''--- Close and PiP collection ---'
rg -n -C8 'closeAtEndRequests|snapshotFlow|isInPictureInPictureMode|LaunchedEffect\(Unit\)' androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/PlayerScreen.kt
printf'%s\n''--- Recreation and viewmodel ownership references ---'
rg -n -C3 'recreate\(|ActivityScenario|recreation|configuration change|configChanges|PlayerScreen\(' androidApp --glob '*.kt' --glob '*.xml'| head -260
printf'%s\n''--- Repository guidance files ---'
fd -a '^AGENTS\.md$'.| head -100
Length of output: 51999
Script executed:
#!/bin/bashprintf'%s\n''--- Repository guidance ---'
cat -n AGENTS.md | head -220
printf'%s\n''--- MainActivity outline and configuration handling ---'
ast-grep outline androidApp/src/androidMain/kotlin/org/siloserver/silo/android/MainActivity.kt --items all --match 'MainActivity|onConfigurationChanged|onPictureInPictureModeChanged|attachBaseContext'
cat -n androidApp/src/androidMain/kotlin/org/siloserver/silo/android/MainActivity.kt | sed -n '145,205p;335,385p'printf'%s\n''--- Locale implementation locations and references ---'
rg -n -C5 'object AppLocales|class AppLocales|fun needsRecreate|AppLocales\.needsRecreate|AppLocales\.apply' --glob '*.kt'printf'%s\n''--- Player collection and teardown ---'
cat -n androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/PlayerScreen.kt | sed -n '250,285p;625,745p;770,845p'printf'%s\n''--- Player navigation and ViewModel ownership ---'
ast-grep outline androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/navigation/AppNavigation.kt --items all --match 'AppNavigation|Player'
cat -n androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/navigation/AppNavigation.kt | sed -n '2200,2325p'
Length of output: 47298
Script executed:
#!/bin/bash
ast-grep outline android-shared/src/androidMain/kotlin/org/siloserver/silo/common/i18n/AppLocales.kt --items all --match 'AppLocales|apply|wrap|needsRecreate'
ast-grep outline android-shared/src/androidMain/kotlin/org/siloserver/silo/common/i18n/AppLanguageStore.kt --items all --match 'AppLanguageStore|applyLocked|foreground|check|attach'
cat -n android-shared/src/androidMain/kotlin/org/siloserver/silo/common/i18n/AppLocales.kt | sed -n '40,150p'
cat -n android-shared/src/androidMain/kotlin/org/siloserver/silo/common/i18n/AppLanguageStore.kt | sed -n '45,180p;240,310p'
rg -n -C4 'AppLanguageStore|foregroundActivity|setForeground|onActivityStarted|onActivityResumed|needsRecreate' android-shared/src/androidMain/kotlin/org/siloserver/silo/common/i18n androidApp/src/androidMain/kotlin/org/siloserver/silo/android/MainActivity.kt --glob '*.kt'
Length of output: 28602
Script executed:
#!/bin/bash
cat -n android-shared/src/androidMain/kotlin/org/siloserver/silo/common/i18n/AppLanguageStore.kt | sed -n '165,250p'
rg -n -C4 'appLanguageStore\.refresh\(|AppLanguageStore.*refresh|languageStore\.refresh\(|ServerDrivenConfigRefresher' android-shared androidApp --glob '*.kt'| head -180
Length of output: 29875
@Quick104 You’re right that a normal PiP transition does not itself recreate the activity. I overlooked the manifest configuration.
There is another recreation path. On Android 12 and earlier, if a refresh applies a profile language while PiP is active, AppLanguageStore.applyLocked() can call activity.recreate() (AppLanguageStore.kt, Line 291). PlayerScreen retains the ViewModel and service player during configuration recreation.
If that recreation cancels the waiting collector, replay = 0 cannot deliver the request again. I have not reproduced this sequence on a device. A useful check would end playback in PiP, apply a profile language through a refresh, then leave PiP.
I am not withdrawing the finding.
Learnings added
Learnt from: Quick104
Repo: Silo-Server/silo-android PR: 995
File: androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/PlayerViewModel.kt:1103-1103
Timestamp: 2026-12-02T20:55:13.974Z
Learning: Within repository "Silo-Server/silo-android", only for files matching one of ["androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/PlayerViewModel.kt"]: In the phone PlayerViewModel, the player activity handles orientation, screenSize, smallestScreenSize, and screenLayout configuration changes. Do not assume a normal PiP transition alone recreates the activity. Separately assess other screen recreations: the ViewModel and playback service can survive them, unlike process death.
Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.
The reason will be displayed to describe this comment to others. Learn more.
Review of 7f35d33, which merges main (13 commits) into this branch. Three findings, all on rare paths where Next Up turns off while playback sits at the end. The council's round 5 found them: Sol and Gemini found the first one separately. I'm fixing all three in commits on this branch, so there's no need to change anything yourself.
One more thing the merge needed: main's recap and credits pill (#1045) added a required segmentSkipController argument to TvPlayerViewModel, so TvPlayerNextUpOffResolverTest stopped compiling. The merge commit passes it.
Low, TV: a reload at the end could close the player under Off. Phone loadContent clears the end state on every load. TV clears it only for a next episode or a Watch Party load. After a version switch or retry at the end, with the finished overlay already dismissed, Off arriving through that load's own refreshFromServer() reads the old end, and the collector closes the player mid-reload. Repair: clear endedSinceSeek, mediaEnded, and closeAtEndRequested at the start of TV loadContent, as the phone does. (This is on unchanged lines, so it's here rather than inline.)
The reason will be displayed to describe this comment to others. Learn more.
A stale end request can close playback after a seek
A close request collected after a seek or playback resumption can still trigger stopPlaybackAndExit. Before exiting, revalidate the end observation and known-duration position using the current controller, not the value captured by LaunchedEffect(Unit).
File androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/player/TvPlayerScreen.kt, line 674:
A stale end request can close playback after a seek
Revalidate the current player’s end observation and, when its duration is known, its position immediately before stopping playback. A close request can be collected after a seek or playback resumption; reporting the current position above does not prevent this unconditional exit. Read the current controller rather than relying on the value captured when the `LaunchedEffect(Unit)` started.
Kody rule violation: [Invalidate playback\-end observations when playback resumes](https://kodus.siloserver.org/settings/code-review/1247142403/kody-rules/d8a3f519-724d-4ae2-9e23-b63a8416cba3?teamId=ba9922fc-c0ea-4cf8-87bb-9d4f42ffc73e)
The reason will be displayed to describe this comment to others. Learn more.
Not changing this. closeAtEndRequests is collected on the main thread right after the view model emits it, so nothing can seek or resume in between. The view model emits only when playback is at the end with no seek re-anchor pending (01aca70). exitPlayer already reads the current mediaController, which is Compose state, not a value captured when the effect started. Since e44df67 the close also reports that controller's position before exiting.
The reason will be displayed to describe this comment to others. Learn more.
Understood—I won’t push for this change. The view model’s end and pending-seek checks, together with reading the current controller for the position report, address the scenarios described.
One caveat: running the emitter and collector on the main thread alone doesn’t prove they execute without an intervening event; that depends on the flow and coroutine scheduling. I haven’t independently verified that ordering here.
The reason will be displayed to describe this comment to others. Learn more.
Failed version switches discard the retained player's end state
After a failed version switch, turning off Next Up can dismiss the finished card without closing playback. Preserve or restore endedSinceSeek, mediaEnded, and closeAtEndRequested when the original player remains mounted.
Prompt for LLM
File androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/player/TvPlayerViewModel.kt, lines 2879-2881:
Failed version switches discard the retained player's end state
A failed version switch preserves the already-ended player but permanently clears its end observations, so switching Next Up off afterward dismisses the finished card without closing playback. Preserve or restore the end observations when a replacement load fails and the original player remains mounted.
The reason will be displayed to describe this comment to others. Learn more.
Confirmed and fixed in ea74cc4. A version switch keeps the current item mounted until the replacement mounts, and keeps it when the switch fails, so TV loadContent now clears the end state only for loads that replace the item (!preserveCurrentPlaybackOnFailure: a retry or a renewal). offDuringAReloadFromTheEndDoesNotClose still covers the retry case, and the full TV unit suite (1,434) passes.
The reason will be displayed to describe this comment to others. Learn more.
Thanks for confirming. The reported fix preserves the end state when a version switch fails, while still clearing it for retries and renewals. The retry test remains in place, and the full TV unit suite reportedly passes.
A focused test for a failed version switch followed by turning Next Up off would provide direct regression coverage for the original issue.
With Next Up off, rewinding a moment before the end on a stream that needs
a server re-anchor could close the player: the old stream ended while the
re-anchor was still pending, and that end closed at once. While a seek's
re-anchor is in flight, an end no longer closes and no longer counts as
"at the end" for the Off collector. The seek either moves playback (the new
mount leaves the end) or rolls back, and the rollback closes, as before.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The reason will be displayed to describe this comment to others. Learn more.
Council round 6 on 6757e2b. Opus and Gemini confirmed every round-5 fix. One new finding below, from Sol. I'm fixing it in a commit on this branch, so there's no need to change it yourself. Two smaller items:
TV test for the reload fix (from Opus): I'm adding offDuringAReloadFromTheEndDoesNotClose to TvPlayerNextUpOffResolverTest. It fails without 6757e2b (expected:<0> but was:<1>).
Older TV issue, not from this PR (from Sol): when the server refuses a TV version switch, failReplacementLoad never releases transportMountGate's pending-load block. The original version keeps playing, but position reports stay blocked until the next load, so the stop on any later exit, Back included, journals the position from before the switch. This is already on main and is left out of this PR.
6757e2b cleared the end state on every load. A version switch keeps the
current item mounted until the replacement mounts, and keeps it when the
switch fails, so clearing there left an ended player that Off then only
dismissed. Clear it only for loads that replace the item (a retry, a
renewal).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The reason will be displayed to describe this comment to others. Learn more.
A replacement stream ending during seek recovery never closes
Discarding STATE_ENDED during seek recovery can leave playback open with Next Up off. Re-evaluate pending end events after successful recovery, distinguish the replacement stream from the old stream, and check the mobile guard for the same issue.
Prompt for LLM
File androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/player/TvPlayerViewModel.kt, lines 5705-5708:
A replacement stream ending during seek recovery never closes
A replacement stream can report `STATE_ENDED` while its seek recovery is still in flight, so this guard discards the only end event and leaves playback open with Next Up off. Re-evaluate a pending end when recovery completes successfully, distinguishing the replacement stream from the old stream; the mobile guard has the same problem.
The reason will be displayed to describe this comment to others. Learn more.
Not changing this. While a re-anchor is in flight, no replacement stream is mounted yet: the replacement mounts only after the re-anchor is adopted. One case comes close: a seek queued behind an adopted re-anchor keeps the recovery in flight while the first replacement plays. If that replacement ends meanwhile, its end is skipped, but the queued seek then settles one of two ways. An adopted re-anchor mounts a new item, and that item reports its own end. A refused one rolls back, and the rollback closes because mediaEnded is still set. Either way, Off still closes at a real end. The phone guard in 01aca70 works the same way.
The reason will be displayed to describe this comment to others. Learn more.
That explanation addresses the concern: if the queued re-anchor is adopted, the new item can report its own end; if it is refused, rollback closes the player because mediaEnded remains set. On that basis, I withdraw the suggestion.
I haven’t independently verified those paths in the code.
…ack under Off
With Next Up off, an end that arrives while a seek's re-anchor is pending
leaves the decision to the seek, so an Up Next overlay the viewer opened in
that window was never marked as ended. When the server refused the seek and
playback rolled back to the end, dismissing that overlay left the player on
the ended frame instead of closing.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…he item
A version switch cancels a pending seek's re-anchor without a rollback. With
Next Up off, an end the old stream reached during that seek was left to the
seek, so when the switch then failed and kept the ended item, nothing closed
the player. The rollback and the failed replacement load now share one
helper that restores the end and closes, or marks an overlay the viewer
opened as ended.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The adopted stream replaces the item an end belonged to, but the end flags
stayed set until Media3 mounted the new item. With Next Up off, Off arriving
or the next-episode lookup finishing in that window could close the player
right after the seek succeeded. Phone and TV now clear the end when they
publish the adopted stream.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The reason will be displayed to describe this comment to others. Learn more.
Review of af19cc3, which is this branch with current main merged in. A new council round covered the commits since the last one (01aca70, 38a1f21, ea74cc4 and the revision 32 re-vendor). It found three rare edge cases where Off meets a pending seek or a failed version switch. I'm fixing all three in commits on this branch. The full summary follows in the review summary comment.
A seek made while a version switch loads queues a re-anchor against the
mounted item. If the switch then failed, the failed load settled an end
under Off and closed the player before that seek ran. The failed load now
leaves the end to a pending seek, which settles it through its adoption or
rollback.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A version switch keeps the current item's end in case the switch fails.
Once the replacement is confirmed, that end no longer stands, but the flags
stayed set until Media3 mounted the new item, so a failure in that window
could close the new version. Clear them at publication, as seek adoption
does.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The reason will be displayed to describe this comment to others. Learn more.
Second council round, on a8fae39. It checked the three fixes from the first round and found two more cases where an end under Off survives a move it shouldn't. One of them came from my fix in 4b72528. I'm fixing those and a misplaced doc comment on this branch. One narrow window, between adopting a seek's stream and mounting it, is left open for the maintainers, with a suggested repair.
The reason will be displayed to describe this comment to others. Learn more.
Low, narrow window, left open for the maintainers: an end from the old item can still arrive after adoption and before the mount.
Trigger: Next Up is off, and a seek's re-anchor is adopted. The flags clear here, and the in-flight guard drops. If the old Media3 item reaches STATE_ENDED before the adopted stream mounts, the screen forwards that end. PlayerScreen's listener doesn't check which mount produced it, and neither does TvPlayerScreen's. onApproachingEnd sets the flags again and closes the player right after a successful seek. A phone close deferred in picture-in-picture is held the same way.
This window existed before this pass, and the clear above narrows it. A full repair ties end callbacks to the mount that produced them. For example, set an "adopted, awaiting mount" flag at adoption, ignore videoEnded while it's set, and clear it when Media3 leaves the end or a load resets. That touches both clients and several reset paths, and no unit fixture can reach the window. It needs its own change and test rather than another fix in this review.
The reason will be displayed to describe this comment to others. Learn more.
Publication confirmation can erase the replacement stream's end event
A replacement stream can end during confirmation, and clearing its end observation prevents the settings collector from closing the player if Next Up is turned off. Clear endedSinceSeek, mediaEnded, and closeAtEndRequested synchronously with publication, or associate end events with their mount.
Prompt for LLM
File androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/player/TvPlayerViewModel.kt, lines 3331-3333:
Publication confirmation can erase the replacement stream's end event
The replacement UI is published before the suspending confirmation, so Media3 can report the replacement stream's end before these assignments erase its end observation. If Next Up is turned off afterward, the settings collector cannot recognize that playback has ended and leaves the player open; clear the predecessor's end synchronously with publication or associate end events with their mount.
Was this suggestion helpful? React with 👍 or 👎 to help Kody learn from this interaction.
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 requestneeds-reviewNeeds maintainer review to resolve uncertain classification, scope, or changed evidence.priority: P2Limited scope, workaround exists, or polishsize/XXL1000–2999 added + deleted lines (all files); change volume, not priority.stackedStacked on another open PR or branch
2 participants
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: Silo-Server/silo-server Discussion #4443
Validation tasks: changes #344 C1, #345 C1, #345 C3
Other clients: Apple Silo-Server/silo-apple#1219; Roku Silo-Server/silo-roku#97; Web Silo-Server/silo-server#4503
Depends on Silo-Server/silo-server#4503 (the setting, at settings revision 32), which replaced Silo-Server/silo-server#4501. #994 (Up Next from the end of the file) has merged, and main is merged into this branch.
Viewers cannot turn Up Next off on Android. Auto-Play Next Episode only stops the countdown; the card still opens before or at the end of every episode.
Show Next Up on the phone and TV now offers Off. With Off, the player opens no Up Next card before or at the end and starts no next episode; when playback ends it closes the way Back does. A shuffle still moves on, since the viewer asked for one.
Approach
playback.next_up_enabledfalse (settings revision 32, feat(web): let Show Next Up be turned off silo-server#4503) and leaves the stored seconds alone; choosing a time turns Next Up back on. One picker owns both keys, so Use profile setting clears both together.next_up_enabledat revision 32 from feat(web): let Show Next Up be turned off silo-server#4503 (server main used revision 31 forplayback.connection_path, feat(directconn): let native clients stream over a direct UDP path silo-server#5469). The vendoredmanifest.jsonandconformance.jsonare byte-identical copies of #4503's 1038dee2c, andSettingKeys.ktis regenerated from it. Once #4503 merges, re-vendor these files andSOURCEfrom its merged commit and regenerateSettingKeys.kt.Validation
./gradlew testDebugUnitTestwith main merged in: shared 2,526, android-shared 2,332, phone 1,016 and Android TV 1,415 tests, 0 failures. On the head, the diagnostics, settings-store and Next Up choice suites, the phone player view model suite and the full TV suite pass, and both apps build withassembleDebug.Lint (
lintDebugfor all three modules,lintVitalReleasefor both apps) passed with no new findings before main was merged in.On phone and Android TV emulators against a server built from feat(settings): add a setting that turns Next Up off silo-server#4501: both pickers offer Off, and choosing it stores
next_up_enabled = falseas that device's value. With Off and Auto-Play on, an episode played past the 30-second prompt point to its end with no Up Next card. The player then closed, the server marked the episode watched, and the next episode did not start.Checked by reading the code, not on a device: a TV overlay opened by hand with Off, and picture-in-picture at the end. With Off, the phone keeps the ended frame in picture-in-picture and leaves the player once picture-in-picture ends, unless playback was restarted from its controls meanwhile.
Review fixes on this branch, each with a phone test that failed before the fix where the phone fixture can reach it: when Next Up turns off while a card shows, a card before the end goes away as Keep Watching would, and one at the end (the finished card included) closes the player (
nextUpTurnedOffBeforeTheEndClearsTheCardAndClosesAtTheEnd,nextUpTurnedOffWhileTheFinishedCardWaitsClosesThePlayer). A countdown armed before Off arrived closes instead of playing the next episode (nextUpTurnedOffDuringTheEndCountdownClosesInsteadOfAdvancing). On TV, only an overlay the viewer opened stays up at the end, and dismissing it there leaves the player. A seek back after playback ends keeps the player open when Next Up turns off afterwards or a slow next-episode lookup finishes, including when the plan gives no duration and when the seek came from the system media controls (nextUpTurnedOffAfterASeekBackFromTheFinishedCardKeepsPlaying,nextUpTurnedOffAfterTheSystemControlsLeaveTheEndKeepsPlaying). On a server without the key, choosing a time no longer pins the picker to this device (AndroidPlayerSettingsStoreTest). On TV,TvPlayerNextUpOffResolverTestcovers a slow next-episode lookup that finishes after Off on a plan with no duration: a seek back keeps the player open whether the lookup or the Off collector runs first, and an end nothing moved from still closes. The other TV paths were checked by reading the code.Review fixes in 0e2a454: "at the end" no longer compares the position with the duration, which blocked the close when the plan's duration runs past the end of the stream or the phone ended in the background (
nextUpTurnedOffAtTheEndClosesWhenTheStreamEndsShortOfTheDurationfailed before the fix). A countdown that expires with Off closes only while playback is still at the end. On the phone, the check for restarted playback runs for every close request. The phone player view model suite (33) and the TV player suites (79) pass. The last two fixes were checked by reading the code.Review fix in 53b6474: a seek that the server refuses to re-anchor rolls back without moving the ended item, and Off afterwards now closes the player instead of dismissing the finished card (
nextUpTurnedOffAfterARolledBackSeekFromTheFinishedCardClosesThePlayerfailed before the fix). The phone player tests (310) and TV player tests (507) pass. The TV side was checked by reading the code.Review fix in 5423f7c: when the end countdown sees Off before the settings collector does, during a seek still pending from the finished card, it now arms the rollback close the same way the collector does, so a refused re-anchor closes the player instead of leaving it on the ended frame. Both paths share one helper on phone and TV. The phone player tests (323) and TV player tests (517) pass. The fixture can't order the countdown tick between the settings hops, so this was checked by reading the code.
Review fix in d4af5a9: Off at the end now closes the player even when the finished card (phone) or overlay (TV) is already gone, as long as playback never left the end, and asks the screen to close only once per end. A new test on each client fails on 5423f7c and passes on d4af5a9. The full phone and TV unit suites pass.
Review pass on 2026-12-02: main merged in (7f35d33), with the new
segmentSkipControllerargument that main's recap and credits pill (feat(player): time the recap and credits skip pills like Skip Intro #1045) requires inTvPlayerNextUpOffResolverTest. Fixes in e44df67, 6757e2b, 38a1f21, 01aca70 and ea74cc4: a refused seek that rolls back to the end now closes under Off whoever dismissed the finished card, which replaces thecloseAtEndIfSeekRollsBackflag (nextUpTurnedOffWhileAScrubFromTheFinishedCardIsPendingClosesWhenItRollsBackfailed before the fix). The TV close reports the end position before it exits, as the phone does. A TV retry or renewal at the end forgets the old end (offDuringAReloadFromTheEndDoesNotClosefails without the fix), and a version switch keeps it, since the current item stays mounted if the switch fails. An end the old stream reports while a seek's re-anchor is pending no longer closes the player. The full phone suite (1,034) passes on 01aca70, and the full TV suite (1,434) on ea74cc4. The TV position report and the pending re-anchor fix were checked by reading the code, because neither fixture can reach them.After the move to revision 32 (b1a8258): the settings conformance tests and
AndroidPlayerSettingsStoreTestpass.Review pass on 2026-12-04: the vendored
manifest.jsonandconformance.jsonare byte-identical to feat(web): let Show Next Up be turned off silo-server#4503's head (1038dee2c), and the server'scmd/settingsgenregenerates the sameSettingKeys.kt. Main merged in (af19cc3). Fixes in b2340c3, 4b72528, a8fae39, 5982241 and be56968, all for Off meeting a pending seek or a version switch at the end: a TV overlay the viewer opened during a refused seek now closes the player when dismissed. A failed TV version switch that kept an ended item now closes, unless a newer seek is still pending. An end no longer survives a seek's adopted stream or a published TV replacement. The full phone (1,034) and TV (1,433) unit suites pass on be56968's code, along with thesharedsuite (2,556) and the settings tests. No unit fixture drives a refused TV re-anchor, a TV version switch, or an end during a pending re-anchor, so these fixes were checked by reading.Evidence
Evidence: https://evidence.siloserver.org/r/silo-android/pr-995/
Phone and TV Settings → Playback → Show Next Up, and recordings of playback reaching the end with Off on each. Before, the picker had no Off and the card always opened. Phone, tablet and foldable share the phone settings layout and player.
Risks
The re-vendor above waits on Silo-Server/silo-server#4503 merging; this merges after it. Off is detected from the server's manifest keys, not the revision number, so the app works against either server in the meantime.
Checklist
Council review
Rounds: 8, last reviewed a8fae39
Visual review: not run; the review fixes change edge paths that the evidence page doesn't show.
Fixed: the end check's position comparison, a countdown closing after a seek back, a second close request queued during picture-in-picture, the countdown dismissing the finished card without arming the rollback close (round 3), a refused seek from a card the seek itself dismissed (round 5), the TV close's stale final position (round 5), a TV reload reading the old end (round 5), an end from the old stream during a pending re-anchor (round 6, 01aca70), a failed TV version switch losing the end (from Kody, ea74cc4), a TV overlay opened during a refused seek (round 7, b2340c3), a failed TV version switch after a cancelled seek (round 7, 4b72528), stale end flags after a seek's stream is adopted (round 7, a8fae39), a failed switch closing over a newer seek (round 8, 5982241), and stale end flags after a TV replacement is published (round 8, be56968). The council hasn't reviewed 5982241 or be56968. Open: an end from the old item that arrives after a seek's stream is adopted but before it mounts can still close the player (round 8, narrow, needs end callbacks tied to their mount). The settings revision now matches Silo-Server/silo-server#4503 (32). Answered: replaying an unconfirmed time write, Off arriving during a TV version switch made from the end (the switch resumes at the end), a remembered Off shown before the server's manifest is read (intended, as for the buffering mode), a reset racing a time's two writes, TV picture-in-picture (the TV app doesn't support it), and Off arriving during an end countdown on a TV overlay the viewer had opened (the end already made it an automatic countdown overlay). A TV version-switch failure that keeps position reports blocked predates this PR.
AI Disclosure
Note
Add "Off" option for Next Up setting on Android and TV
playback.next_up_enabledsettings key (contract revision 32, default true) and exposes it throughPlayerSettingsStore.nextUpEnabledFlow,nextUpEnabledSupportedFlow, andsetNextUpEnabled. Off is only shown when the server manifest stores the key or Next Up is already disabled; unsupported servers see the setting as enabled.NextUpChoiceoptions (0/10/30/60/120 seconds plus Off) via NextUpChoice.kt. Choosing Off writes only the enabled flag; choosing a time writes enabled=true and the prompt seconds.PlayerScreenandTvPlayerScreendefer the exit during picture-in-picture and cancel it if playback restarts into READY or BUFFERING.playback.next_up_enabledto the diagnostics settings allowlist in DiagnosticsBundleBuilder.kt.Changes since #995 opened
TvPlayerViewModel.settleEndAfterAbandonedMoveand called it from the replacement-load failure handler and the seek-recovery rollback branch inTvPlayerViewModel, and cleared end state when a replacement stream is adopted [a8fae39]PlayerViewModelserver-seek recovery method [a8fae39]Macroscope summarized af19cc3.