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
fix(player): keep the resume point when playback stops early - #765
Related issue: N/A (split from #611)
Validation tasks: none
Other clients: Android N/A (an early end of a response is a retryable error, closing reports the player position with no Next Up rounding, and Keep Watching only hides the card); Roku Silo-Server/silo-roku#73 (fix in Silo-Server/silo-roku#75); Web N/A (reports the element position, has no prompt-window completion rule, and the post-roll after an end has no way back into the ended player)
When the source stops before the end of an item, the player parks on the "Connection lost" postroll. Two paths from there still lose the resume point:
Closing inside the Next Up window marks the item watched. The postroll shows Next Up, and the completion check falls through to the prompt-window rule. Stopping at 175 of 200 seconds with the default 30-second prompt reports 200 and marks the item watched. This affects items short enough that the last 1.5% is shorter than the prompt (under about 33 minutes at the default prompt).
Back jumps to the last 10 seconds. Back (Keep Watching) seeks to duration - 10 even after a stop at 20:00 of 60:00. Aether ignores seeks on an ended session, but the player still moves its playhead to the target, so closing afterwards reports about 99.7% and the server marks the item watched. After a natural end the same seek leaves the player stopped behind a dismissed postroll.
Approach
An end short of the end of the item (reachedEndPrematurely) no longer counts as reaching the Next Up prompt. Skipping credits that run to the end still finishes the item.
Keep Watching from the end-of-playback screen now remounts the item: where the source stopped after an early end, or a 10-second tail after a natural end. The remount is the reload Watch Party already used, generalised to remountCurrentPlayback(at:origin:). It asks for the version, audio and subtitles playing now, and a download stays local.
The remount keeps the viewer's choices about the item: skipped credits, a dismissed Next Up prompt, and cancelled autoplay. The credits auto-skip latch is now keyed on the content, file and marker rather than the session (matching the intro key), so the replayed tail does not skip the credits again. A credits skip the playhead has since left is resolved before the remount, so it can't finish an item that stopped early.
After an early end, the cancelled autoplay that the dropped stream set does not carry into a mid-item resume, so the real end still offers Next Up, even with the prompt turned off. A cancel the viewer made earlier still holds.
Back on the "Connection lost" postroll resumes even when the transport is already gone, rather than closing the player.
Back never remounts a session an administrator ended, or one a stop from an administrator or a remote is closing. It closes the player as before.
A failed remount shows the same error and Retry as a failed manual start. Until the remount shows a frame, Retry remounts at the same position and keeps the viewer's choices, however the load failed: a failed start, a route recovery, a failure after the load committed, or a failed session renewal. A reconnect or renewal of that remount keeps the choices too, and a seek during the reconnect moves the Retry position. A successful retry does not reopen Next Up, start autoplay, or skip the credits again.
Closing while the remount of a finished episode loads moves its Series page on to the next episode, as closing from the end screen does.
This does not reopen a source automatically after an early end. That is a separate design decision.
Rebased onto main at 55da563 (squashed). #764's recap latch is keyed on the content and survives a same-item reload, so the remount keeps it without a ViewerChoices field. Main's credits latch is now a set (#915); ViewerChoices carries that set.
Validation
Focused XCTest classes at e85fad1, each run on this task's own simulators with Xcode 27.2: PlayerPrematureEndReopenTests, PlayerNextUpCompletionPolicyTests, CreditsAutoSkipPolicyTests, PlaybackReconnectTests, WatchPartyEndOfFileTests, SeriesPlaybackReturnTests, PlayerStillWatchingGuardTests, RecapAutoSkipPolicyTests.
With main's completion rule and main's Keep Watching seek restored and the new tests kept, 9 of the 13 new tests fail on iOS. The 4 that pass either way cover guards: an administrator-ended session, a stop already closing the player, the viewer's own autoplay cancel, and skipped credits.
Checked live at 7d85d57 on an iOS 27.0 simulator against a sandbox running main's server, before (main 55da563) and after. The test episode's file was cut by bytes: its header says 3:20, but the data ends at about 2:52, so a direct-play stream ends cleanly before the end of the item. On current main this is the case that still reaches the end-of-playback screen, because main's end-of-stream reconnect (#802) applies only to a stalled source or a remux or transcode.
Closing from that screen: before, the server marked the episode watched; after, it kept the resume point at 2:52.
Back on that screen, with the full file put back: before, the picture froze with the Play button showing while the elapsed time ran past the end; after, playback resumed at the stop point and played on.
Back after a natural end (after only): it replayed from 3:10 and returned to the end screen without an autoplay countdown.
e85fad1 changes two paths the captures don't reach: a seek made while the remount prepares now moves the Retry position, and Back on a download saves the stop point locally first. Both were checked by reading the code. The unit-test player can't reach them, because it has no first frame and no download context.
Not verified live: a stream dropped by the network mid-session, an administrator or remote stop during Back, Retry after a failed remount, and a reconnect or renewal during the remount.
After the stream stops early, closing the player keeps the resume point where it stopped instead of marking the item watched, and Back on the "Connection lost" screen resumes from there instead of the last 10 seconds. After a natural end, Back replays the last 10 seconds instead of leaving the player stuck on the last frame.
Risks
Keep Watching after a natural end now starts a new session for the 10-second tail instead of seeking the ended one. This costs one start-session round trip.
The Watch Party remount now asks for the audio and subtitles playing now, not the tracks of the request that opened playback.
The credits auto-skip latch now survives a session change within the same item, including a protocol-v3 replan.
On a short item whose pre-end Next Up prompt was already showing when the source dropped, closing now reports the position reached rather than the duration. This only changes the watched state for items of about 5 minutes or less at the default prompt.
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 says there is none.
AI Disclosure
Harness: Claude Code (in T3 Code), with Claude Code subagents
Tool(s): Claude Code, Codex (cross-provider review)
Model(s): claude-opus-5-5, gpt-6.1-sol
Involvement: Fully AI-generated, not yet human verified
Adversarial review: gpt-6.1-sol (Codex harness in T3 Code) reviewed 5184ac4 and found one problem: Retry after a failed Keep Watching dropped the viewer's choices and resumed at the very end. Fixed in 1f16c37. An independent Claude Opus review found no blocking issues; Keep Watching now waits for the server like a manual start, as it suggested. A /silo review of 1f16c37 (claude-opus-5-5) found five more, fixed in d9a6362. Two further gpt-6.1-sol rounds on d9a6362 and c074bf8 found four gaps in those fixes, fixed in c074bf8 and fbf212e. After the rebase onto main, a /silo review of 7d85d57 (claude-opus-5-5 subagents) and a gpt-6.1-sol round found that Retry dropped a seek made while the remount prepares (CodeRabbit flagged it as well) and that a download's stop point could be lost during the remount. Both are fixed in e85fad1.
Keep the resume point in PlayerViewModel when playback stops early
Fixes premature stream ends inside the Next Up prompt window reporting the item duration as progress. PlayerNextUpCompletionPolicy.shouldFinalizeAsCompleted and progressPosition now take an endedPrematurely input and return the stopped position instead of finalizing, though EOF and skipped credits still complete the item.
keepWatchingCurrentEpisode now remounts a prematurely ended item through a fresh load at the stopped position instead of seeking the dead session. It refuses to remount when a remote stop is closing the player or the session was administrator-ended.
Adds a resumeAfterEnd load origin. beginFreshLoad preserves viewer choices (credits skip, Next Up choices) and the pending remount resume position across the remount, recovery, and reconnect loads; retries of a failed remount reuse the pending position, and a seek during the remount updates it.
remountCurrentPlayback generalizes the Watch Party remount path and can retain the offline download ID and selected audio track. The credits-skip key now uses content ID and file ID so it survives a remount into a new session.
Series return completion during teardown now follows the same premature-end rules, and seriesPlaybackReturn only marks a loading episode completed when it matches the last recorded episode.
Risk: PlayerViewModel.endedPrematurely drives progress reporting in cleanup and the completion policy — check that offline progress writes and series return marks match the stopped position, not the duration. Also makeRecoveryLoadRequest defaults to clearing the download ID; only Keep Watching passes keepingDownload.
The player now distinguishes premature stream endings from completed playback. Keep Watching can remount the current item and retain viewer choices and resume position. Recovery supports offline downloads and Watch Party seeks from EOF.
The completion policy now accepts endedPrematurely. PlayerViewModel passes that state to completion calculations. Tests cover prompt-window behavior and completion after credits are skipped.
Keep Watching remount and carried state iosApp/iosApp/Screens/Player/PlayerViewModel.swift, iosApp/Tests/PlayerPrematureEndReopenTests.swift
Keep Watching can start a fresh load after an end when session and load-request checks allow it. The remount carries viewer choices and resume position. Retry handling and tests cover stop conditions, remount failures, and retained state.
Shared remount, downloads, and Watch Party iosApp/iosApp/Screens/Player/PlayerViewModel.swift, iosApp/Tests/PlayerPrematureEndReopenTests.swift
A shared remount path supports playback recovery and Watch Party seeks from EOF. Recovery requests can retain offline-download context. Tests cover the selected audio track during a download remount.
After Back from an ended item, a viewer's secondary subtitle track is dropped and must be re-selected. If a remount fails after the viewer has seeked during preparation, Retry returns to the earlier stop point rather than the new seek. Both are small, recoverable glitches, so this is mergeable once the owner is aware of them.
Security architecture risk: Minimal · up to 7d85d
The inspected recovery flow preserves the current item's identity, respects administrator and remote stops, and uses cancellation and cleanup controls when replacing playback. No introduced risk materially affecting security, failure containment or ownership was established.
Retained concerns
No architecture-level concerns identified.
Security review details
Security Blast Radius
observed — The added Keep Watching remount accepts no new content identifier. It reconstructs the request from the current playback's content and library identity, selected file and tracks, and existing download identifier. Its directly changed state is the current item's playback and resume/completion state.
Trust Boundaries and Controls
observed — Keep Watching is rejected during Watch Party playback. End remounts also reject a known administrator-ended session, a pending remote stop, or a missing load request before dismissing the postroll. The shared remount and fresh-load entry both reject a disposed owner.
Resilience and Maintainability Implications
observed — Remount inherits fresh-load cancellation, epoch retirement and generation checks. Abandoned provisional loads are rolled back, while cleanup cancels replacement work and advances the stream generation. These controls constrain stale loads from taking ownership after replacement or player exit.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title "fix(player): keep the resume point when playback stops early" matches the main change. The PR stops a premature end from counting as reaching the Next Up prompt, and it makes Keep Watching …
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 the problem (premature stream ends losing the resume point through Next Up completion and Back/Keep Watching seeks), the approach (remount via remountCurrentPlayback, ViewerChoi…
Full details: Title check
Explanation
The title "fix(player): keep the resume point when playback stops early" matches the main change. The PR stops a premature end from counting as reaching the Next Up prompt, and it makes Keep Watching remount playback at the stop point. The title is specific and describes the primary fix from the developer's perspective.
Full details: Description check
Explanation
The description states the problem (premature stream ends losing the resume point through Next Up completion and Back/Keep Watching seeks), the approach (remount via remountCurrentPlayback, ViewerChoices, endedPrematurely completion rule), validation, and risks. It is specific and directly related to the changeset.
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
silo-triageBot
added
bug
Something isn't working
evidence-required
Needs before-and-after evidence before the Evidence check passes
impact: playback
Can't play, stalls, or wrong media
needs-review
Needs maintainer review to resolve uncertain classification, scope, or changed evidence.
priority: P1
Core-path bug; painful workaround — next after P0
triaged
High-confidence review completed; does not mean fixed, validated, or accepted for release.
labels
Oct 13, 2026
Evidence is incomplete for the described user-visible change. Please attach or publish before-and-after captures of the same playback/postroll flow with the same content and build/commit, showing that an early stop keeps the resume point and that Keep Watching resumes from that point rather than the last 10 seconds. Include a short recording if the postroll interaction or remount timing is material.
The reason will be displayed to describe this comment to others. Learn more.
When the stop was premature, preserve the observed resume position and reserve the ten-second rewind for a natural end; otherwise a premature stop near the end is moved backward and the saved resume point is wrong.
File iosApp/iosApp/Screens/Player/PlayerViewModel.swift:
Line 3148:
When the stop was premature, preserve the observed resume position and reserve the ten-second rewind for a natural end; otherwise a premature stop near the end is moved backward and the saved resume point is wrong.
Suggested Code:
let target = endedPrematurely
? max(0, min(currentTime, duration))
: max(0, duration - 10)
The reason will be displayed to describe this comment to others. Learn more.
This one doesn't hold up. isBeforeNaturalEnd only counts a stop as premature when more than 8 s and more than 1.5% of the item remain. So min(currentTime, duration - 10) can only move a premature target back by less than 2 s, and only on items shorter than about 11 minutes. The saved resume point is unaffected: completionProgressPositionForCurrentItem reads currentTime, not this target. Replaying under 2 s before the stop point is harmless, so I'm leaving the code as it is.
The reason will be displayed to describe this comment to others. Learn more.
You're right—this is a false positive.
With more than 8 seconds and more than 1.5% remaining, this expression can rewind a premature stop by less than 2 seconds, and only for items shorter than roughly 11 minutes.
The completion report reads currentTime, not the local remount target. My claim that this expression corrupts the saved resume point was unsupported.
That bounded replay does not justify a high-severity finding or establish a violation of the playback-intent rule. I withdraw the recommendation; leaving the code unchanged is reasonable.
The reason will be displayed to describe this comment to others. Learn more.
Unbounded timeout on the nil branch allows a replacement/recovery load triggered by resumeAfterEnd to wait indefinitely if the session stalls. Keep resumeAfterEnd on the finite Self.autoplayStartSessionTimeout branch.
File iosApp/iosApp/Screens/Player/PlayerViewModel.swift:
Line 5065:
Unbounded timeout on the `nil` branch allows a replacement/recovery load triggered by `resumeAfterEnd` to wait indefinitely if the session stalls. Keep `resumeAfterEnd` on the finite `Self.autoplayStartSessionTimeout` branch.
Suggested Code:
timeout: origin == .userInitiated
The reason will be displayed to describe this comment to others. Learn more.
This is intentional. 5184ac4 made Keep Watching wait for the server the way a manual start does: the viewer asked to keep watching, and a 15 s cutoff would turn a slow server into an error that a manual start wouldn't show. The start isn't unbounded in practice either. The API client's request timeout (HTTPClient.makeSession, timeoutIntervalForRequest) fails a dead server quickly, and that failure shows the error and Retry. The viewer can also close the player at any time while it loads. Leaving it as is.
The reason will be displayed to describe this comment to others. Learn more.
Agreed—Keep Watching is an explicit viewer action, not autoplay, so matching manual-start timeout behavior is intentional. Given the HTTP request timeout and error/Retry handling you described, my “unbounded wait” claim was too strong. I don’t recommend adding the 15-second autoplay cutoff here.
No code, rules, or memories have been changed. If useful, I can save this distinction as repository guidance for future reviews: viewer-requested Keep Watching uses manual-start timeout behavior rather than the autoplay deadline.
The reason will be displayed to describe this comment to others. Learn more.
[P2] Preserve Keep Watching choices when its failed remount is retried
After a natural end, choose Keep Watching, let the new start-session request fail transiently, then press Retry. The first remount carries viewerChoices, but retry() calls beginFreshLoad with the default .userInitiated origin, so this condition drops them. resetPublishedLoadState clears nextUpPromptDismissed, nextUpAutoplayCancelled, and autoSkippedCreditsKey; the successful-load restoration also has no snapshot to restore. With the default 30-second prompt, the resumed ten-second tail immediately qualifies for updateNextUpPresentation, reopening Next Up and enabling autoplay despite Keep Watching. With automatic credits skipping enabled, the cleared marker latch also permits the tail to be skipped again. Carry the same-item resume intent and its choices through Retry until playback succeeds, and cover failure followed by a successful retry. The new tests stop at the first remount failure, so they do not exercise this transition.
The reason will be displayed to describe this comment to others. Learn more.
Confirmed and fixed in 1f16c37. When a Keep Watching remount fails, the player now records the position it was resuming to, and Retry repeats that remount with the .resumeAfterEnd origin, so the viewer's choices carry over. It also fixes a second problem: Retry used to resume from currentTime, which is still at the very end after a natural finish, so playback ended again at once. testRetryAfterAFailedRemountKeepsTheViewersChoices failed before the fix and passes now; iOS and tvOS 49/49, macOS build.
The reason will be displayed to describe this comment to others. Learn more.
Resume-state loss occurs when Keep Watching failures enter protocol-V3 route recovery and return from beginFreshLoad before recording failedResumeAfterEndPosition; if recovery exhausts its retryable route ladder, retry() falls back to the ordinary load origin and resets the viewer's credits and Next Up choices. Retain the remount position and origin before handing off to recovery, and clear them only after successful playback or an unrelated load.
Prompt for LLM
File iosApp/iosApp/Screens/Player/PlayerViewModel.swift:
Line 5251 to 5253:
Resume-state loss occurs when Keep Watching failures enter protocol-V3 route recovery and return from `beginFreshLoad` before recording `failedResumeAfterEndPosition`; if recovery exhausts its retryable route ladder, `retry()` falls back to the ordinary load origin and resets the viewer's credits and Next Up choices. Retain the remount position and origin before handing off to recovery, and clear them only after successful playback or an unrelated load.
The reason will be displayed to describe this comment to others. Learn more.
Confirmed. When the Keep Watching remount's start succeeds but its first route fails to open, the catch hands off to attemptProtocolV3Replan and returns before this line records the position. A replan that then fails terminally, or a failure after the load commits (through handleAetherFailure), reaches the error with no position recorded, so Retry runs an ordinary reload: the viewer's choices reset, and in a replayed tail the Next Up prompt and autoplay come back and credits auto-skip can fire again.
A reconnect or session renewal started from that failure has the same problem: it reloads with its own origin and resets the choices.
I'm fixing it in a commit on this branch: the position is recorded when the Keep Watching load starts, kept through a reconnect or renewal of that load, and cleared at its first frame or by any other load. Retry, reconnect, and renewal all carry the viewer's choices until the remount plays.
The reason will be displayed to describe this comment to others. Learn more.
That plan addresses the gap. Start-session success or load commit is not enough to consider the remount successful—the pending resume position and viewer choices need to survive until its first frame, including across replan, reconnect, and session renewal.
The regression cases worth covering are:
First-route open failure → exhausted replan → Retry preserves the remount position and viewer choices.
Post-commit handleAetherFailure before the first frame → Retry preserves the same context.
Reconnect or renewal while the remount is pending → choices remain intact.
The remount’s first frame clears the pending context; an unrelated load clears it without inheriting those choices.
For the recovery cases, assert that dismissed Next Up stays dismissed, canceled autoplay stays canceled, and credits do not auto-skip again. That would directly cover the paths missing from the original failure tests.
The reason will be displayed to describe this comment to others. Learn more.
Fixed in d9a6362, c074bf8 and fbf212e. pendingResumeAfterEndPosition (renamed from failedResumeAfterEndPosition) is set when the Keep Watching load starts and cleared at its first frame or by any other load. A reconnect or session renewal of that remount keeps it and the viewer's choices, a seek during the reconnect moves it, and a failed renewal shows the error and Retry. testKeepWatchingAfterTheEndRemountsTheItem checks the position is held from the start; the reconnect and renewal paths were checked by reading the code, since the tests can't stage a reconnect. iOS and tvOS 70/70 on the focused classes, macOS builds; the new tests fail against 1f16c37's production code.
The reason will be displayed to describe this comment to others. Learn more.
I checked the relevant code at the current PR head, fbf212e5. This addresses the original resume-state-loss suggestion.
beginFreshLoad sets pendingResumeAfterEndPosition synchronously, before any asynchronous work or protocol-V3 recovery handoff.
Failure teardown leaves that position intact, so retry() selects .resumeAfterEnd instead of an ordinary reload.
Same-content reconnect and renewal loads preserve the pending context and restore ViewerChoices after both the published-state reset and the session/Next Up setup. Reconnect seeks also update the pending position.
A failed renewal continuing the remount uses the remount’s error handling. The current load’s startup milestone clears the position; an unrelated fresh load clears it without carrying the choices.
The immediate assertion in testKeepWatchingAfterTheEndRemountsTheItem directly guards the original late-recording bug.
The validation distinction remains important: the reported 70/70 runs and failures against the older production code support the tested regressions, but reconnect/renewal and successful first-frame cleanup remain code-reviewed rather than exercised. I haven’t run those tests myself.
No further blocking feedback from me on this finding. Injected session/engine tests for those recovery paths would strengthen future coverage.
The reason will be displayed to describe this comment to others. Learn more.
Review of 1f16c37 (/silo review, Claude Code with claude-opus-5-5, plus a gpt-6.1-sol round on the follow-up commits).
Four findings below, all in the Keep Watching remount. A fifth, Retry losing the Keep Watching state when the failure goes through route recovery, is Kody's comment on line 5253, so I answered it there. I'm fixing all five in a commit on this branch, so there's no need to change them yourself.
Kody's comments on lines 3152 and 5070 don't hold up; the reasons are in their threads.
Reviewed 7d85d57, this branch rebased onto main at 55da563. Fixes are pushed through e85fad1. The branch was rewritten: the six earlier commits were squashed and rebased to resolve 8 conflicts in PlayerViewModel.swift.
Fit: 8/10 · Readiness: 8/10 — conditional (assuming CI is green)
Rebase
Main now has an end-of-stream reconnect (fix(player): reconnect when a server restart ends a transcode early #802), so a remux or transcode that ends early reconnects instead of stopping. The bugs this PR fixes still occur on main whenever playback stops on the end-of-playback screen: a direct-play stream that ends cleanly before the end, or a reconnect that ends at the same spot again.
Medium (CodeRabbit, line 7462; also found by gpt-6.1-sol): a seek made while the Keep Watching remount prepared went into main's newer held-seek path, which didn't move the Retry position. A failed remount then retried at the old position.
Low (gpt-6.1-sol): after Back on a download, closing before the remount prepared wrote no local progress, so the download kept an older resume point.
Remaining
CodeRabbit's secondary-subtitle comment (line 4226) holds, but every same-item fresh load on main clears the secondary subtitle, not only this remount. It's left open as a follow-up for same-item reloads in general.
No human has checked "I read and can explain the complete diff" yet.
Roku and Web parity haven't been checked. Android doesn't need the change.
Unchanged older behavior: other same-item reloads, such as a renewal or reconnect during ordinary playback, still reset the viewer's Next Up and credits choices.
With main's completion rule and main's Keep Watching seek restored, 9 of the 13 new tests fail. The other 4 cover guards that hold either way.
Live at 7d85d57 on an iOS 27.0 simulator against a sandbox running main's server. The test episode's file was cut by bytes, so its direct-play stream ends at about 2:52 of 3:20.
Closing from the end screen marked the episode watched on main and kept the resume point on this PR.
Back froze the picture on main while the clock ran past the end. On this PR it resumed from the stop point.
Back after a natural end replayed the last seconds on this PR.
e85fad1's two fixes were checked by reading the code. The unit-test player can't reach those paths.
None affected. No passed v1.0 case covers end of playback, watched state, the resume point, Keep Watching, credits skip, reconnect, downloads or the Series page return. Validation tasks: none.
User manual
No change needed. The watch-history page already says playback saves your resume point, and no page covers the end-of-playback screen or Keep Watching.
Scores
Fit 8/10: this keeps resume points and doesn't mark unfinished items watched, which is core playback correctness. What holds it down: the remount carries the viewer's choices with dedicated state, rather than making every same-item reload keep them the way intro and recap decisions already are.
Readiness 8/10: both fixes are shown live on the rebased head, the new tests fail on main's code, and the review findings are fixed. What remains is human review of the diff and the Roku and Web parity check.
AI disclosure: reviewed by Claude Code (claude-opus-5-5) with Claude Code subagents, plus a gpt-6.1-sol round through Codex in T3 Code.
When the source stops before the end of an item, closing inside the Next
Up window no longer marks it watched, and Keep Watching remounts the item
where the source stopped (or a 10-second tail after a natural end) instead
of seeking the ended session to its last 10 seconds. The remount keeps the
viewer's choices about the item, and Retry, reconnects and renewals of it
keep them too.
Squashes e492f48..fbf212e for the rebase onto main.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The described evidence covers preserving progress on close and Keep Watching after early and natural ends, but not the changed failed-remount Retry flow (retrying from the held resume position while keeping the viewer's Next Up and credits choices). Please add a recording of that failure-and-retry flow. The linked evidence page should show the affected playback behavior on iPhone, iPhone Duo folded and open, iPad, Mac, and Apple TV; the shared player code reaches all of these targets.
Automated check: Macroscope check run agent (gpt-6-luna). Evidence was not reviewed for correctness.
Included review availability: This review used your included allowance. 0 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 1 review per hour.
The reason will be displayed to describe this comment to others. Learn more.
Minor · Functional Correctness · Quick win
Preserve the secondary subtitle selection during the remount.
When the viewer has a secondary subtitle selected, this remount calls resetPublishedLoadState, which clears selectedSecondarySubtitleId at Line 6056. Neither the recovery request nor ViewerChoices restores that selection. Back therefore removes the secondary subtitles after either kind of end.
Carry the secondary selection identity through the remount and restore it after the replacement inventory is available.
The reason will be displayed to describe this comment to others. Learn more.
This holds, but it isn't specific to Keep Watching. Every fresh load clears the secondary subtitle in resetPublishedLoadState, including main's other same-item reloads: route recovery, session renewal and a reconnect's new session. Before this PR, Back seeked the ended session in place, which kept the secondary track but left the player frozen. I'm leaving this open as a follow-up for same-item reloads in general rather than adding a Keep Watching-only carry here.
The reason will be displayed to describe this comment to others. Learn more.
Review of 7d85d57, the rebase of this branch onto main (/silo review with Claude Code subagents, plus a gpt-6.1-sol round through Codex in T3 Code).
One new finding is below. The other real one, Retry dropping a seek made while the remount prepares, is CodeRabbit's comment on line 7462; I answer it in that thread. Both get fix commits on this branch, so there's no need to change them yourself.
AI disclosure: reviewed by Claude Code (claude-opus-5-5) and gpt-6.1-sol (Codex in T3 Code).
…rough the remount
A seek made while the Keep Watching remount prepares now moves the Retry
position, as a seek during its reconnect already did. Back on a download
saves the stop point locally before the remount clears the download's
progress context, so closing before it prepares keeps that resume point.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The reason will be displayed to describe this comment to others. Learn more.
Closing during an offline remount loses a held seek
Closing before preparation restores offlinePlaybackContext loses the held seek, so playback resumes at the old position. Retain the offline context and persist the held seek during teardown.
Prompt for LLM
File iosApp/iosApp/Screens/Player/PlayerViewModel.swift, lines 8074-8076:
Closing during an offline remount loses a held seek
A seek during an offline Keep Watching remount updates the pending retry position but leaves the saved offline position at the pre-remount value. If the viewer closes before preparation restores `offlinePlaybackContext`, teardown cannot persist the seek and the next playback resumes at the old position; retain the offline context and persist the held seek on teardown.
With Back now closing the player, nothing on the Up Next screen resumed
an episode whose stream stopped early: the screen opens in its ended
state, which hid Keep Watching, and Back had been the resume control
there since Silo-Server#765. iPhone and iPad have no Menu button to fall back on.
Keep Watching now shows after an early end that can be remounted, and
takes default focus there. After a natural end, or once an administrator
ended the session, the screen still offers Back alone. The Silo-Server#765 tests
now describe Keep Watching rather than Back.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
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
bugSomething isn't workingevidence-requiredNeeds before-and-after evidence before the Evidence check passesimpact: playbackCan't play, stalls, or wrong medianeeds-reviewNeeds maintainer review to resolve uncertain classification, scope, or changed evidence.priority: P1Core-path bug; painful workaround — next after P0size/XL500–999 added + deleted lines (all files); change volume, not priority.triagedHigh-confidence review completed; does not mean fixed, validated, or accepted for release.
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 (split from #611)
Validation tasks: none
Other clients: Android N/A (an early end of a response is a retryable error, closing reports the player position with no Next Up rounding, and Keep Watching only hides the card); Roku Silo-Server/silo-roku#73 (fix in Silo-Server/silo-roku#75); Web N/A (reports the element position, has no prompt-window completion rule, and the post-roll after an end has no way back into the ended player)
When the source stops before the end of an item, the player parks on the "Connection lost" postroll. Two paths from there still lose the resume point:
duration - 10even after a stop at 20:00 of 60:00. Aether ignores seeks on an ended session, but the player still moves its playhead to the target, so closing afterwards reports about 99.7% and the server marks the item watched. After a natural end the same seek leaves the player stopped behind a dismissed postroll.Approach
reachedEndPrematurely) no longer counts as reaching the Next Up prompt. Skipping credits that run to the end still finishes the item.remountCurrentPlayback(at:origin:). It asks for the version, audio and subtitles playing now, and a download stays local.This does not reopen a source automatically after an early end. That is a separate design decision.
Rebased onto main at 55da563 (squashed). #764's recap latch is keyed on the content and survives a same-item reload, so the remount keeps it without a
ViewerChoicesfield. Main's credits latch is now a set (#915);ViewerChoicescarries that set.Validation
Focused XCTest classes at e85fad1, each run on this task's own simulators with Xcode 27.2:
PlayerPrematureEndReopenTests,PlayerNextUpCompletionPolicyTests,CreditsAutoSkipPolicyTests,PlaybackReconnectTests,WatchPartyEndOfFileTests,SeriesPlaybackReturnTests,PlayerStillWatchingGuardTests,RecapAutoSkipPolicyTests.Siloscheme, iPhone 17 Pro, iOS 27.0): 83 tests, 0 failures.SiloTVscheme, Apple TV, tvOS 27.0): 83 tests, 0 failures. The run excludedBrowseCollectionGridTests.swiftlocally, because that file breaks the tvOS test target on main itself ([bug] SiloTV tests don't compile: BrowseCollectionGridTests uses iOS-only types #1168, fixed by test(tvos): build the tvOS test bundle again #1169).SiloMacbuilds (compile only,CODE_SIGNING_ALLOWED=NO).With main's completion rule and main's Keep Watching seek restored and the new tests kept, 9 of the 13 new tests fail on iOS. The 4 that pass either way cover guards: an administrator-ended session, a stop already closing the player, the viewer's own autoplay cancel, and skipped credits.
Checked live at 7d85d57 on an iOS 27.0 simulator against a sandbox running main's server, before (main 55da563) and after. The test episode's file was cut by bytes: its header says 3:20, but the data ends at about 2:52, so a direct-play stream ends cleanly before the end of the item. On current main this is the case that still reaches the end-of-playback screen, because main's end-of-stream reconnect (#802) applies only to a stalled source or a remux or transcode.
e85fad1 changes two paths the captures don't reach: a seek made while the remount prepares now moves the Retry position, and Back on a download saves the stop point locally first. Both were checked by reading the code. The unit-test player can't reach them, because it has no first frame and no download context.
Not verified live: a stream dropped by the network mid-session, an administrator or remote stop during Back, Retry after a failed remount, and a reconnect or renewal during the remount.
Evidence
Evidence: https://evidence.siloserver.org/r/silo-apple/pr-765/
After the stream stops early, closing the player keeps the resume point where it stopped instead of marking the item watched, and Back on the "Connection lost" screen resumes from there instead of the last 10 seconds. After a natural end, Back replays the last 10 seconds instead of leaving the player stuck on the last frame.
Risks
Checklist
AI Disclosure
/siloreview of 1f16c37 (claude-opus-5-5) found five more, fixed in d9a6362. Two further gpt-6.1-sol rounds on d9a6362 and c074bf8 found four gaps in those fixes, fixed in c074bf8 and fbf212e. After the rebase onto main, a/siloreview of 7d85d57 (claude-opus-5-5 subagents) and a gpt-6.1-sol round found that Retry dropped a seek made while the remount prepares (CodeRabbit flagged it as well) and that a download's stop point could be lost during the remount. Both are fixed in e85fad1.🤖 Generated with Claude Code
Note
Keep the resume point in PlayerViewModel when playback stops early
PlayerNextUpCompletionPolicy.shouldFinalizeAsCompletedandprogressPositionnow take anendedPrematurelyinput and return the stopped position instead of finalizing, though EOF and skipped credits still complete the item.keepWatchingCurrentEpisodenow remounts a prematurely ended item through a fresh load at the stopped position instead of seeking the dead session. It refuses to remount when a remote stop is closing the player or the session was administrator-ended.resumeAfterEndload origin.beginFreshLoadpreserves viewer choices (credits skip, Next Up choices) and the pending remount resume position across the remount, recovery, and reconnect loads; retries of a failed remount reuse the pending position, and a seek during the remount updates it.remountCurrentPlaybackgeneralizes the Watch Party remount path and can retain the offline download ID and selected audio track. The credits-skip key now uses content ID and file ID so it survives a remount into a new session.seriesPlaybackReturnonly marks a loading episode completed when it matches the last recorded episode.PlayerViewModel.endedPrematurelydrives progress reporting incleanupand the completion policy — check that offline progress writes and series return marks match the stopped position, not the duration. AlsomakeRecoveryLoadRequestdefaults to clearing the download ID; only Keep Watching passeskeepingDownload.Macroscope summarized e85fad1.