Skip to content

fix(watch-party): return web members to the room when an episode ends - #1655

Merged
Quick104 merged 2 commits into
Silo-Server:mainfrom
neurekadev:fix/watch-party-room-exit-post-roll
Sep 29, 2026
Merged

Quick104 merged 2 commits into
Silo-Server:mainfrom
neurekadev:fix/watch-party-room-exit-post-roll

Conversation

@neurekadev

@neurekadev neurekadev commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Closes #1654
Related issue: N/A
Validation tasks: none

A Silo Web member of a Watch Party ends up on a black player page at the end of every episode, and drops out of the room until they reload. This change keeps room members out of post-roll, so the room's return to its lobby takes them back to the room page like the rest of the party.

The web player enters post-roll 30 seconds before the end of a series episode, without checking for a room. When the room then returns to its lobby (#1489), the player's room exit runs handleExit, which only navigates to the room page from foreground. In post-roll it calls exitPlayback() and returns, so the player unmounts with its room socket and the watch route renders nothing.

Approach

Skip the early post-roll trigger when the request belongs to a room, using the same room id and token check as the other room branches in WatchPlaybackChrome. A room already decides what follows the item for everyone, and post-roll has nothing to offer there: its next-episode action only returns to the room page. The member stays in the full player until either its own ended event or the room's lobby snapshot sends it to the room page; both paths already navigate there from foreground.

handleExit still does not navigate from post-roll. With this change no room member reaches that mode, so I left it alone rather than change exits for non-room playback.

Validation

  • Web lint, format check, typecheck, production build, and bundle budget: pass.
  • vitest run src/playback: pass. The new host test renders the real provider and host with the player stubbed; its room case fails without the guard and passes with it.
  • make test-web was not run locally: the workstation runs Node 26, whose built-in localStorage shadows jsdom's unless web storage is disabled. CI runs the suite on Node 22.
  • Not exercised in a live room with the fix deployed. The bug itself was reproduced on a real deployment on two consecutive episodes, as described in [bug] Watch Party web guest is left on a black player page when an episode ends #1654.

Risks

None identified. Non-room playback is unchanged. A room member now sees the full player for the last 30 seconds of an episode instead of the post-roll screen.

Checklist

  • I read and can explain the complete diff.
  • This pull request addresses one concern.

AI Disclosure

  • Harness: Claude Code (T3 Code)
  • Tool(s): Claude Code
  • Model(s): claude-opus-5-5
  • Involvement: Fully AI-generated, human verified
  • Adversarial review: A separate Claude Code agent reviewed the diff against every route into post-roll, the room exit and end-of-media paths, non-room playback, and the new test. It found no blocking issue. Two low findings were applied: read the room from the active request instead of a ref, and check the room token as the other room branches do. Its suggestion to also route post-roll exits in handleExit was left out as unnecessary for this bug.

🤖 Generated with Claude Code

Note

Skip post-roll and return web watch-party members to the room when an episode ends

  • In WatchPlaybackHostContent's playback-state handler, playback now stays in foreground when a series episode nears its end, if the active request has both a room identifier and a room token. Non-room playback still enters post-roll as before. See WatchPlaybackChrome.tsx.
  • The player's room-exit callback navigates back to the room lobby using the room token with replacement navigation.
  • Adds jsdom tests in WatchPlaybackChrome.roomExit.test.tsx covering both room and non-room playback near the episode end.

Macroscope summarized 5dcd673.

neurekadev and others added 2 commits September 28, 2026 16:40
… item

A web member of a Watch Party entered post-roll in the last 30 seconds of
an episode. When the room then returned to its lobby, the player's room
exit saw a non-foreground mode, tore playback down without navigating, and
left the member on a black player page with no room socket.

Skip the early post-roll trigger inside a room. The room decides what
follows the item, and the member stays in the player until the room's
lobby snapshot sends it back to the room page.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The room is part of the request key the callback already depends on, so a
ref adds a render of lag and nothing else. Match the other room branches
in checking both the room id and its token.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@kody-ai

kody-ai Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

Code Review Completed! 🔥

The code review was successfully completed based on your current configurations.

Kody Guide: Usage and Configuration
Interacting with Kody
  • Request a Review: Ask Kody to review your PR manually by adding a comment with the `@kody start-review` command at the root of your PR.

  • Provide Feedback: Help Kody learn and improve by reacting to its comments with a 👍 for helpful suggestions or a 👎 if improvements are needed.

Providing Context (Files & MCPs)

Add these hints in your PR description (or a comment) to unlock deeper checks:

  • Ticket / Acceptance Criteria: `Refs: ABC-123` (Linear/Jira/Asana/ClickUp/Trello) or a direct ticket link.
  • Bugfix Validation: a Sentry/Datadog/Bugsnag event link (or paste the stack trace/error message).
  • Endpoint Risk: mention the route (e.g., `POST /api/payments`) or controller/action name.
  • Attach a repo file as context: use an explicit marker like `@file:docs/guide.mdx#L10-L50` (replace with your real path).
  • API Contract Docs: include `@file:openapi.yaml` or `@file:swagger.json` when changing routes/schemas.
  • Definition of Done / Standards: include `@file:DOD.md` or `@file:CONTRIBUTING.md` if your repo has them.
  • Design System Source of Truth: include `@file:ui/index.ts` (replace with your DS entrypoint path).
  • Feature Flags: include the flag key/name and `@file:flags.ts` / `@file:config.json` (and optionally the PostHog flag name).
  • Edge/CDN Rules: link the Cloudflare rule/zone or describe the intended redirect/header behavior.
  • Attach an MCP tool output: use `@mcp<provider|tool>` (replace with an installed MCP provider + tool, e.g., `@mcp<sentry|events.search>`).
Current Kody Configuration
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

Access your configuration settings here.

@coderabbitai

coderabbitai Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 22bcfc06-6e75-43c7-af34-67280e01537c

📥 Commits

Reviewing files that changed from the base of the PR and between 8cc97dc and 5dcd673.

📒 Files selected for processing (2)
  • web/src/playback/WatchPlaybackChrome.roomExit.test.tsx
  • web/src/playback/WatchPlaybackChrome.tsx

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.


📝 Walkthrough

Walkthrough

The playback state handler now excludes Watch Together playback from its early post-roll condition. Tests cover post-roll behavior inside and outside a room, and verify that exiting the room player navigates to the room URL with its token.

Changes

Watch Together playback

Layer / File(s) Summary
Room-aware post-roll guard
web/src/playback/WatchPlaybackChrome.tsx, web/src/playback/WatchPlaybackChrome.roomExit.test.tsx
The handler identifies room playback when the active request has both a room ID and token, then excludes it from the early post-roll condition. Tests verify that non-room playback enters post-roll, room playback remains in foreground, and exiting the room player navigates to the room URL with its token and replace: true.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Suggested reviewers: quick104

Merge Risk: ⚪ Minimal · up to 5dcd6

Watch Party members stay in the player near the episode end, so the room lobby snapshot or the member's own end event can navigate them back to the room. Playback outside a room is unchanged. The author did not test in a live room, but no concrete merge risk was found.

Security Architecture Review

Security architecture risk: 🔵 Low · up to 5dcd6

The change keeps room playback in the player until the existing room-return flow runs. No new privileged room action or weakened access control was identified, though the full room lifecycle was not verified.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — An attacker-controlled URL can influence whether this client enters early post-roll by supplying both room fields. The changed check does not itself grant room state or add a room operation.

Security Findings and Attack Paths

  • inferred — No PR-introduced privileged path was identified: room-return navigation already existed, and the changed condition only prevents a playback-mode transition. Server-side membership enforcement was not independently verified.

Trust Boundaries and Controls

  • observed — The existing connection hook sends room credentials to room-read and socket-ticket requests and handles terminal authorization-related failures. Client-side field presence is not proof of valid membership.

Resilience and Maintainability Implications

  • observed — The room connection rejects callbacks after disposal and closes the socket on cleanup, containing late events within the inspected hook. The complete lobby-snapshot-to-navigation sequence remains unverified.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: returning Watch Party members to the room when an episode ends. It is concise and specific.
Description check ✅ Passed The description directly explains the Watch Party playback issue, the post-roll guard, the expected room navigation behavior, validation results, and scope.
Linked Issues check ✅ Passed The PR addresses issue #1654. WatchPlaybackHostContent now skips the early post-roll transition when the active request has both roomId and roomToken. This keeps a Watch Together member in foreg…
Out of Scope Changes check ✅ Passed The source change prevents the reported Watch Together post-roll failure. The new tests verify room and non-room behavior for this change. No unrelated changes appear in the reviewed diff.
  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug] Watch Party web guest is left on a black player page when an episode ends

2 participants