Skip to content

fix(web): refresh the page after a retired session's stop lands - #4508

Merged
Quick104 merged 1 commit into
Silo-Server:mainfrom
Rhainland:fix/4428-retired-stop-refresh
Nov 18, 2026
Merged

Quick104 merged 1 commit into
Silo-Server:mainfrom
Rhainland:fix/4428-retired-stop-refresh

Conversation

@Rhainland

@Rhainland Rhainland commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Closes #4428
Related issue: N/A
Validation tasks: changes #1252 C4 (Not run)

Other clients: Apple N/A (web player only); Android N/A (web player only); Roku N/A (web player only)

If the web player stops a session because the server refused a quality or output change, and you go back before that stop reaches the server, the page you return to keeps showing old watch state until you reload it.

#4423 made the player tell the page to read its watch state again once the exit stop lands. That only covers the session the player still holds when it closes. When a replan for a changed output is refused, the player stops the session right away and forgets it. If you then choose Go Back on the error screen, the player has no session left to stop, so nobody is told when the earlier stop lands. That stop carries the last playback position, so in my test it was the only write of the episode's progress: the episode page came back with no progress bar and a plain Play button, while the server already had the position saved.

Approach

The player now keeps each stop it sends for a session it has let go of until that stop settles. When the player closes, every stop still pending tells the page once it settles, in the same way #4423 does for the exit stop. Each one tells the page on its own, so a slow stop never delays the refresh for another one. The exit stop path from #4423 is unchanged.

Validation

  • Web unit test: the existing refused-output test now holds the stop open, closes the player, and checks that the page is told only after the stop answers. It fails on main and passes with the fix.
  • make test-web, pnpm run lint (no new warnings), pnpm run format:check, tsc -b, pnpm run build, pnpm run budget:check, make verify-local-paths, make verify-size-ratchet, make verify-bidi, make verify-case-collisions: all pass. Go checks were not run because no Go code changed.
  • Manual: local server with a synthetic four-episode series, the production web bundle driven in headless Chromium at 1440 px and 390 px. I played episode 1 to about 82 s, made the display report it lost HDR, answered the output-change replan with the server's terminal refusal, held the stop for 4 s, and chose Go Back. On main the episode page made no catalog reads after the stop landed. With the fix it re-read the item, season and episode list within a few milliseconds of the stop and showed the progress bar. A normal exit with no refusal still re-reads once after its stop, as before.

Evidence

Evidence: https://evidence.siloserver.org/r/silo-server/pr-4508/

Surface and build: web app episode page, desktop (1440 px) and phone (390 px), captured 4 s after the delayed stop landed. Before is main at e8de1117e; after is this branch. Same local server, database and synthetic media for both.

Risks

A player that closes while a retired session's stop is still pending re-reads the open page's playback queries once more when that stop lands. That is a few small catalog reads, and only after a refused output change or a session replacement whose stop has not landed yet.

Checklist

  • I read and can explain the complete diff.
  • This pull request addresses one concern.
  • Each test this pull request adds meets "Decide what to test" in CONTRIBUTING.md.
  • The Evidence section shows every change a user can see, or how I checked a change nobody sees.

AI Disclosure

  • Harness: Claude Code (via T3 Code); Codex CLI for code review
  • Tool(s): Claude Code, Codex CLI
  • Model(s): claude-opus-5-5; gpt-6.2-sol, gpt-6.2-astra, claude-fable-5-2 (code review)
  • Involvement: Fully AI-generated, human verified
  • Adversarial review: four-reviewer pass (two Codex models and two Claude models) on correctness, standards and spec, over three rounds. Round 1 found that waiting on all stops together let a slow earlier stop delay the exit refresh, and that the new test duplicated an existing fixture. Both were fixed: the exit stop path is back to its main form, the fixture is shared, and the case was folded into the existing refused-output test. Round 2 found that two pending retired stops still shared one wait, so each now notifies on its own. Round 3 found no correctness issues. Dismissed: a start whose reply arrives after the player closes is not tracked, because that session never played and its stop writes no watch state.

When the server refuses a replan for a changed output, the player retires
the session and sends its stop, then forgets the session. Going back from
the error before that stop landed meant the unmount had no session to
stop, so the host was never told when the retired stop settled and the
page the viewer returned to kept the watch state it read before the stop.

The player now keeps every stop it sends for a session it let go of until
that stop settles. On unmount, each one still pending tells the host when
it settles, separately from the unmount's own stop, so a slow stop does
not hold up the others.

Closes Silo-Server#4428
@coderabbitai

coderabbitai Bot commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

This organization requires a seat for paid usage-based reviews, including automatic and on-demand reviews. Ask an admin to assign a seat or enable paid usage-based reviews for users without a seat in Billing.

Next included review available in 9 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 4 included reviews currently available.

Learn how review limits work.

Review configuration:

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: 91bd1e19-e4a4-495b-9406-337340dd5498
Commits

Reviewing files that changed from the base of the PR and between e8de111 and dce275b.

Files selected for processing: 2

  • web/src/player/hooks/usePlaybackSession.test.ts
  • web/src/player/hooks/usePlaybackSession.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@silo-triage silo-triage Bot added the size/M 50–199 added + deleted lines (all files); change volume, not priority. label Nov 18, 2026
@silo-kody

silo-kody Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

@silo-triage silo-triage Bot added bug Something isn't working impact: polish Annoyance, cosmetic, or nice-to-have priority: P2 Limited scope, workaround exists, or polish labels Nov 18, 2026
@Quick104

Copy link
Copy Markdown
Contributor

Review summary

Reviewed head: dce275b18. No changes pushed.

This fixes the gap #4428 describes. When a refused output change retires the session and the viewer goes back before that stop lands, the page they return to now re-reads its watch state once the stop settles. The exit-stop path from #4423 is unchanged.

How it was checked

  • The changed test, "retires an active plan when the refreshed output has no playable route", fails on the merge base (e8de1117e) with onSessionStopped never called, and passes on this head. The whole usePlaybackSession.test.ts file passes on the head.
  • CI is green.
  • I traced every stopSession caller. Each one handles a rejected stop. A stop that settles while the player unmounts causes at most one extra refresh.
  • One adversarial round on a second model (Codex, gpt-6.2-sol) reviewed this head independently. Its two findings are below. Neither blocks the merge.

Remaining items (no change needed)

  • A narrow timing gap is left over, and the base has it too. When going back, the return page starts its first reads one render before the player unmounts. A retired stop that lands in that gap of a few milliseconds leaves the pending set before unmount, so nothing re-reads after it. Closing the gap would mean cancelling and restarting the return page's first reads on every exit, which costs more than the gap does. In the usual case the stop lands while the error screen is still up, and the exit invalidation then reads after the write.
  • Stops for starts the player discarded during startup are tracked too. If one is still pending at exit, the open page refreshes once more even though that session never played. That is the extra-read cost the Risks section already accepts.

Validated features: only #1252 C4 (Series, Web) could be reached, and it is recorded as Not run, so no passed case changes. The Validation tasks: line is correct. I could not run the wider board query from here.

User manual: unaffected. This makes the web player refresh the page the way it already should; no setting, label, or documented behavior changes.

Other clients: Apple, Android and Roku are not affected. The code path is the web player's session hook.

Fit: 9/10 · Readiness: 9/10 — ready

  • Fit: a small, contained correctness fix for stale watch state in the web player. It reuses the host callback fix(web): re-read the series page after the player's stop lands #4423 added and adds no new surface.
  • Readiness: the regression test fails on the base for the reported reason, the author shows the change live on desktop and phone widths, and the only leftover is the pre-existing timing gap above.

🤖 Claude Code (claude-opus-5-5)

@Quick104
Quick104 merged commit a79cb3b into Silo-Server:main Nov 18, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working impact: polish Annoyance, cosmetic, or nice-to-have priority: P2 Limited scope, workaround exists, or polish size/M 50–199 added + deleted lines (all files); change volume, not priority.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Web: a session stopped after a refused replan doesn't refresh the page the viewer returns to

2 participants