Skip to content

fix(watch-party): stop showing refused socket messages as a party error - #542

Merged
Quick104 merged 4 commits into
Silo-Server:mainfrom
neurekadev:fix/watch-party-stale-room-error
Sep 29, 2026
Merged

Quick104 merged 4 commits into
Silo-Server:mainfrom
neurekadev:fix/watch-party-stale-room-error

Conversation

@neurekadev

@neurekadev neurekadev commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Closes #541
Related issue: #541

When a Watch Party item finishes, the Apple TV can show "watch together session is not attached" in the lobby, and the message stays until the room socket next reconnects. It is the server refusing a report the Apple TV sent for the session that just ended, which raced the room's return to its lobby. The viewer cannot act on it. Affects iOS, tvOS, and macOS, which share WatchPartySession.

Approach

WatchPartySession.receive now traces bad_request errors instead of storing them in errorMessage. The server uses bad_request for every message from this client that it refuses, and the web client only logs these. connection_replaced still ends the party, and any other code still shows as before.

I considered hiding only this one message, but the same race also produces other refusals (an attach that arrives after the lobby transition, for example), and matching on a server error string would be brittle. Clearing the banner on the lobby snapshot would not work: the refusal can arrive after the snapshot. User actions do not depend on the banner: transport controls are already gated by the room's permissions, and send() drops messages once the phase or selection changes.

Server and Android coordination: Android shows these refusals as a short toast and likely flashes the same message. A server-side change that stops answering reports for a session that is no longer attached would cover every client; that is left as a follow-up.

Validation

Risks

A persistent server-side refusal (for example a failed attach_session) no longer shows its raw server text in a banner. It is still traced in debug builds, and the web client has never shown these either.

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 enumerated every error the server can send on the room socket and every refusal that arrives as bad_request, and checked whether any user action relied on the banner, parity with the web and Android clients, and the Swift control flow. It found no blocking issue. Its suggestion to keep the comment inside the branch was applied; its suggestion to stop the server from answering stale-session reports is noted above as a follow-up.

🤖 Generated with Claude Code

Note

Fix Watch Party showing refused socket messages as a party error

Adds a dedicated branch for server bad_request errors in WatchPartySession.swift. A bad_request received while an adapter exists and attachment is unconfirmed still sets the user-visible errorMessage; otherwise it is written only to the debug trace. Other error codes keep their existing handling.

Risk: bad_request responses after attachment confirmation, or with no adapter, no longer populate errorMessage.

Macroscope summarized 3308139.

neurekadev and others added 2 commits September 28, 2026 16:41
When the room returned to its lobby at the end of an item, a state report
already in flight for the finished session came back as a bad_request
error ("watch together session is not attached"). The session showed it as
the party's error banner, which stayed until the socket next reconnected.

Trace bad_request errors instead of showing them. They answer a message
this client sent and the viewer cannot act on them; the web client only
logs them too. Other error codes still surface.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@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

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: c744fb62-eccf-4f31-be5c-9f17548d53d1

📥 Commits

Reviewing files that changed from the base of the PR and between 316a6f8 and 3308139.

📒 Files selected for processing (1)
  • iosApp/iosApp/WatchParty/WatchPartySession.swift

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


📝 Walkthrough

Walkthrough

WatchPartySession.receive now handles bad_request errors separately. It displays the server message only when a playback adapter exists and its attachment is unconfirmed. Otherwise, it traces the rejection.

Changes

Watch Party socket errors

Layer / File(s) Summary
Handle bad_request responses
iosApp/iosApp/WatchParty/WatchPartySession.swift
When an adapter exists and attachment is unconfirmed, receive displays the server message. Otherwise, it traces the rejection. Other error handling remains unchanged.

Priority: ⬇️ Low

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

Change: Bug fix · Severity of issue fixed: Low

Suggested reviewers: quick104

Merge Risk: ⚪ Minimal · up to 33081

A refusal during pending attachment remains visible, while a refusal after termination cannot replace the lobby error. No material user-facing regression is established; normal Apple build and test validation remains appropriate.

🚥 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 1 functions across 1 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 and concisely describes the main change: preventing refused Watch Party socket messages from appearing as party errors.
Description check ✅ Passed The description explains the stale Watch Party error, the implementation, affected platforms, validation status, risks, and intended behavior. It is directly related to the changeset.
Linked Issues check ✅ Passed Issue #541 requires the lobby to appear without the stale session-not-attached error. The change handles server bad_request separately. It keeps the message only when a playback adapter exists and a…
Out of Scope Changes check ✅ Passed The whole-PR diff changes only iosApp/iosApp/WatchParty/WatchPartySession.swift. The 13 added lines implement the refusal handling required by issue #541. The diff contains no unrelated feature, ref…
  • 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.

A player waiting for its attachment only sends attach_session, so a
bad_request then means the server keeps refusing the attach, and the
party will not sync until it stops. Show that refusal as before; trace
the others.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@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.

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.

Watch Party: a stale "session is not attached" error stays up after the room returns to the lobby

2 participants