Repository navigation
feat(watch-party): bring Watch Party to phone and TV behind an Experimental toggle - #377
Conversation
…ontract The September 21 draft predated the server's buffering and catch-up policy and Apple's merged client. This plan follows server main 2812ac39, the web reference client, and Apple main 5d9dc764, and lists every Android input and session-replacement path the room must own. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
… owner The shared Watch Party layer followed an older server contract. Room proof never renewed, the same-room rejoin reused an obsolete socket, connection replacement was treated as a transport drop and reclaimed the membership, suggestion hydration ran on the socket receive path, and events could be dropped without notice. The API now covers every v2 room operation with status and body validation, caller-selected ids kept by the logical action, and a single attempt for the non-retryable start, select, and promote. Host operations authorize by identity; member operations send the room proof, which is adopted from every successful room response. WatchTogetherRepository owns one engagement per membership: it renews the proof before expiry, orders HTTP snapshots against socket receipts so a delayed response cannot erase a newer attachment, treats ended snapshots, room_closed, and connection_replaced as terminal, serializes room and vote actions and reconciles uncertain outcomes by reading the room, drains suggestion pages off the socket path, and samples the server clock on the room socket from the moment it opens. A socket that stayed up reconnects at once after the server's five-minute rotation; quick failures keep retrying through the host's two-minute grace. RoomSession keys connections by membership generation, so an explicit rejoin replaces the old socket. The player controllers and entry ViewModels are patched to the new API only; the player binding and shared lobby are rebuilt in later commits. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Entry points need to know whether this server and profile can use Watch Party, and a user who is displaced or loses the connection needs a way back into the party. WatchPartyAvailabilityRepository reads the room and playback capability documents, caches the answer for the captured authority, and never lets a failed probe downgrade a known answer. RecentWatchParties keeps one room code per device in the encrypted preferences for 24 hours, shown only to the server, login, and profile that saved it; no room or join token is stored. The recorder keeps it after a replacement or lost connection, forgets it when the room ended, and clears it before sign-out, account replacement, or server removal. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The phone and TV room controllers each carried their own copy of the sync mechanics, reported the intended rather than the actual player state, never re-armed readiness for a second seek on the same session, and had no support for the server's buffering and catch-up policy. RoomPlaybackBinding runs one event loop per playback epoch against a small player port. It attaches the committed session on every socket epoch and waits for the server's echo, reports observed state every 1.5 s and stays quiet while stalled, seeking, or suspended, schedules commands on the server clock and advances a late Play, acknowledges the exact waiting command until a fresh snapshot confirms it, reports buffering after a 2 s stall, acknowledges recovery while catching up, and converges small drift by a bounded temporary rate. Media reloads for Play corrections are paced by RoomReloadBudget; explicit seeks are never delayed. The catch-up rules are ported from the web client. The repository implements the binding's room interface. The platform adapters follow in later commits. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…osition A room start could fall back to another version when the room's file was missing, resume from the viewer's own progress when no position was passed, and let a replan move the viewer onto a different file. Room starts now carry a WatchPartyPlaybackContext. Both starters play exactly the room's file or fail, start at the room position (an explicit zero included), never apply personal resume or the resume rewind, send allow_alternate_versions: false so every replan keeps the file, and refuse a plan for a different file. StartParams keeps the flag so a 404 renewal pins the same file. Solo starts omit the field. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Both players need the same wiring around the room binding: the room's playback context, status, transport requests, reconciliation of seeks made outside the app, leave and end, and coordinated source fallback for the four approved refusal reasons. WatchPartyPlayback provides it so each platform keeps only a thin adapter. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…nd TV The phone and TV each had their own entry, lobby, and suggestion ViewModels. They opened the player whenever a title was selected, held a lone host in the lobby, created vote rooms from the menu, minted new ids on every retry, and normalized codes differently. Shared ViewModels now back both platforms. The hub probes availability, hosts Host Picks rooms (staging a title without starting it), keeps a create's room id for an explicit retry after an uncertain outcome, joins by normalized code or invitation link (never sending a token to another server), and offers Return to Party and Rejoin. The lobby exposes eligibility computed from phase, role, capabilities, and pending work, advisory lobby Ready, suggestions with Queue (stage, never promote), and opens the player only when the room plays. The picker loads the server's shared rows and debounces search. Invitation parsing accepts codes, web links with a base path, and the silo://watch-party app link proposed in silo-apple#412. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Watch Party ships off in release builds and on in debug builds, like the Apple apps. WatchPartyExperiment keeps the choice on the device, never syncs it, and leaves any active party when it is turned off. Both apps inject it as WatchPartyExposure; the entry points switch to it with the new party screens. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Device runs need to correlate each client's room, socket, commands, and catch-up state and to measure the spread between two players. The debug receiver now reports sampling timestamps and a party object (room phase, revision, connection epoch, attached and applied commands, clock offset, correction rate) with no tokens or tickets, and the script gains party and spread commands. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…promote A new test shows OkHttp silently resending a Watch Party start when a reused connection drops after the request was sent. These operations are non-retryable on the server: a replay after another selection could start the wrong item. createPlatformHttpClient and createSiloClient take a retryOnConnectionFailure switch, and the Watch Party API sends start, select, and promote on a client with it off. The repository already reconciles such uncertain outcomes by reading the room. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
RoomSyncController reported intended state, never re-armed readiness, played downloaded copies, and let local controls and system media controls fork the viewer from the room. The phone player now uses WatchPartyPlayback. Room loads play exactly the room's file at the room position, start paused, skip downloads, and reuse the room context on every restart; version switching and On Deck are refused. The ViewModel reports the true engine position mapped to the source timeline and applies room seeks, play state, and a temporary correction rate through paths that are never user intent. Every user and system transport input goes through the room; seeks the screen did not issue are sent to the room or undone. Audio focus loss, a noisy route, the sleep timer, and backgrounding are local suspensions. Cast and automatic PiP are off in a room, intro skip is pinned to Ask with no pill for members who cannot seek, and approved refusals ask the room for a coordinated fallback. Start refusal reasons now reach the ViewModel. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
A room Play reached a locally suspended player, and a command that landed while media was still mounting acted on media being replaced. The binding now leaves a suspended player paused (resuming re-attaches, and the server resends the room position) and holds a command for up to five seconds while a mount or seek is in flight; a late Play still advances by the full elapsed server time. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
TvRoomSyncController duplicated the phone controller's defects, left the room when the TV app paused or stopped, and suppressed all SiloCast transport in rooms, hosts included. The TV player now uses WatchPartyPlayback. It loads exactly the room's file at the room position, starts paused, and reuses the room context on every restart; version switching, the Dolby Vision restart, speed writes, and next-up are refused. The ViewModel reports what the player is really doing and applies room seeks, play state, and a temporary correction rate through paths that are never user intent. Remote keys, the scrubber, skips, chapters, the intro pill, MediaSession, admin commands, and SiloCast transport go through the room's permission decision; SiloCast launches are refused while a party plays. ON_PAUSE/ON_STOP, audio focus, and the sleep timer are local holds instead of leaving the room. Approved refusals ask the room for a coordinated fallback. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
A handoff swaps in the phone's profile, and any identity change leaves the Watch Party the TV is in. The receiver now cancels the offer with watch_party_active and asks the viewer to leave the party first. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…ions Replace the phone's Watch Together screens with the Watch Party experience on the shared ViewModels: - Hub (profile menu, detail action, invitation): availability, Return to Party, Rejoin, host, and join by code or link. - Lobby: staged title, members and lobby Ready, Start, mode and guest policy, invitation, suggestions and votes; only the room phase opens the player. - Picker sheet for staging and suggesting. - Party panel over the retained player (Back): members, invite, Leave, Return everyone to lobby, End for everyone (D2). - In-playback status: waiting for, catching up, continuing without, host away, and a reconnect notice after two seconds. - Detail pages: one party action (Watch Party, Add to party, Play for everyone, Suggest to Party) and the D5 leave-first guard in front of solo playback, home quick play, and external player links. - silo://watch-party invitations, accepted only while the Experimental toggle is on; the join token stays in memory and routes carry an opaque id. - Settings → Experimental → Watch Party. - A restored party route without a live membership opens the hub. Entry points follow WatchPartyExposure. The old watchtogether package and its tests are removed. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…oggle Replace the TV's Watch Together dialogs and lobby with the Watch Party experience on the shared ViewModels: - Hub from the profile menu: availability states with a focusable control, Return to Party, Rejoin, Host (Host Picks), Join with code, and why the last party ended. - Lobby: staged title and edition, members and lobby Ready, Start, options, Leave with the host note, the code for everyone and a QR for the host, and suggestions. Controls are disabled rather than removed so live updates keep focus. - Picker with server rows and search. - Detail page: Watch Party, Add to party, Play for everyone (confirmed), or Suggest to Party, and a leave-first prompt in front of solo Play and extras (D5). A launcher play link during a party opens the title page instead. - Back in party playback opens a party panel over the running player (members, code, Back to playback, Return everyone to lobby, End, Leave) and a status overlay that never takes focus. - Settings → General → Experimental → Watch Party. - Party screens already on the back stack are reused, and a restored party route without a live membership opens the hub. The old watchtogether package and its tests are removed. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
… status Live qualification showed room sockets ending after 17-40 s on one emulator with nothing in the server log to explain it. The repository now records each socket attempt's end (terminal frame, replacement, or the transport exception class and message) with how long it was open, and the debug receiver's party status includes it as lastSocketEnd. It carries no tickets or tokens. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
- Ending a party for everyone left a Rejoin for a room that no longer exists. The repository now announces rooms this device closed, and the recent-party recorder forgets them. Leave still keeps Rejoin, which the host Leave dialog promises. - Joining an ended room showed the generic conflict text. A join 409 now says the party has ended. - TV: the confirm dialog meant to focus Cancel, but the popup handed focus to its first row (End party). Focus now moves to the intended row through the observed-focus helper. - TV: a guest's on-screen Pause did nothing and said nothing. It now goes to the room like the remote's play/pause key, so a refusal shows its notice. - TV: the join-code keypad was translucent over the hub's text. It now has a scrim and a near-opaque panel, like the party's other dialogs. - Phone: member statuses no longer shift with name length. - Phone: finding an existing party player uses the public back-stack API instead of the restricted currentBackStack. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The phone told the room why playback was refused from diagnosticsCode, a telemetry allow-list, while the TV used the terminal reason exactly as the server sent it. The mobile starter now records terminalReason too, and the phone reports it, so both platforms send the same value. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Both platforms now use the shared Watch Party ViewModels and the Experimental toggle, so these have no callers: - CLIENT_WATCH_TOGETHER_SURFACE_ENABLED and its test (WatchPartyExposure replaces it; WatchPartyExperimentTest covers the per-build default). - WatchTogetherEntryPolicy and its test (content-present entry rules). - The WatchTogetherEntryGateway interface and its DI binding. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
D1 exposes Watch Party on phone and TV behind Settings → Experimental → Watch Party (on in debug builds, off in release builds) and the server's capabilities. Update the product-exposure rules, README, FEATURES (with an experimental legend), and docs/README to match. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
`spread` used screenPositionSec, which the TV updates only every 500 ms, so readings swung by up to half a second. It now uses the player position when that is on the same timeline as the screen position, and falls back to the screen position when a remux or transcode starts mid-title. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The TV hub offered Rejoin for a party it had just ended for everyone. The repository publishes an end while the last snapshot is still live, then clears both. The recorder checked the live membership first, so it remembered the room again, and the cleared pair never reached the forget branch. A room-gone end now wins, and a membership whose own room just ended is never remembered. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…binding On a throttled TV, the socket died while the binding was sending to it. Its outgoing channel was cancelled, the pending send threw CancellationException, and the realtime client rethrew it as if the binding had been cancelled. The binding's event loop ended silently. The TV kept playing 30 minutes behind the room, marked as left behind, and never caught up, even after it reconnected and new commands arrived. A send now propagates only the caller's own cancellation; any other failure, including a cancelled channel, is a failed send the binding retries on the next socket. Each send is also bounded to 5 s, so the loop never waits on a socket that has stopped draining. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
With a web host seeking, the phone guest seeked back and forth between the old and new positions every ~35 ms, thousands of times, and never became ready. A MediaController reports its own seek at once and the session reports it again; the phone's issued-seek tracker consumed the first match, so the second report looked like an outside seek, which a guest undoes, which the room redoes. The TV's tracker never consumed matches and did not loop. Issued seeks now stay recognized until they expire, as on TV, and the coordinator undoes at most one outside seek per two seconds, so a future mismatch cannot turn into a loop. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
|
Important Review skippedToo many files! This PR contains 194 files, which is 94 over the limit of 100. To get a review, reduce the PR to 100 files or fewer by splitting it into smaller PRs or changing its base branch. Upgrade to a paid plan to raise the limit. This review couldn't start because sufficient usage credits or metered capacity aren't available. Add credits or update usage-based reviews in the billing tab, then retry. ⚙️ Run configuration
📒 Files selected for processing (194)
You can disable this status message by setting the
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. Comment |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
Quick104 has reached the 50-credit limit for trial accounts. To continue receiving code reviews, upgrade your plan.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9c5bef8ac3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
A silo://watch-party link that arrived before sign-in or profile selection was pinned to the identity generation at arrival. Signing in moves that generation, so the pending hub route failed its scope check and was consumed without opening. Invitations now travel unscoped, like account invitations: delivery still waits until the user is past setup, login, and profile selection, and the hub joins only when the link's server is the active one. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…stions - The phone hub now waits for its forced capability re-check before it consumes an invitation or detail-page host handoff, since the previous answer stays published while the probe runs. - "Suggest to Party" records its request before sending, so a second tap while the first is in flight resends the same suggestion id instead of adding a duplicate, and a later result can't clear another's retry. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 770f5c3c7f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…est reuse - A new selection revision resets the reload budget and stall history, so the previous title's backoff and lower-quality offer don't carry over to the new stream. - TV detail-page hosting forces a capability re-check and waits for it before creating a party, like the hub. - The lobby's "Suggest" reuses the id of an uncertain or in-flight suggestion of the same title, and only a request's own outcome can clear the retry draft. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Quick104
left a comment
There was a problem hiding this comment.
Two independently reproduced findings in the shared phone/TV paths.
Reviewed with gpt-6.1-sol in T3 Code using the Codex provider.
| if (scheduled.connection.generation != connection.generation || scheduled.connection.epoch != connection.epoch) return | ||
| val commandConnection = connection.generation to connection.epoch | ||
| if (command.commandId.isBlank() || | ||
| (command.commandId == lastSeenCommandId && commandConnection == lastCommandConnection) |
There was a problem hiding this comment.
[P2] Include the playback session in command deduplication
If a Waiting command targets a session being replaced by a subtitle/quality replan or renewal, execute() rejects it after the new session commits. Reattaching the new session on the same socket makes the server resend the waiting command with the same ID, retargeted to the new session. This check drops that valid replay because the generation and socket epoch did not change. A focused reproduction using the production helper attached ps-1, replaced it with ps-2, then delivered the retargeted replay after attachment: no seek and no ready acknowledgement occurred. The replacement viewer stays in Waiting until another command or reconnect; when nobody is ready, the server's waiting deadline cannot resume the room. Include the target session in the deduplication key.
| return (repository.memberState(listOf(contentId)) as? ApiResult.Success)?.data?.items?.firstOrNull() | ||
| } | ||
|
|
||
| fun endForEveryone() = roomSession.depart(closeRoom = true) |
There was a problem hiding this comment.
[P2] Preserve lobby membership when End fails
The rebuilt phone and TV lobbies call this method and immediately navigate away. RoomSession.depart(closeRoom = true) discards closeRoom()'s result and always cancels the socket and resets membership. For a definite DELETE failure such as HTTP 503, WatchTogetherRepository.closeRoom() returns the error without emitting a notice, so “End this party for everyone” silently becomes Leave: the room remains open and the host cannot retry from the lobby. A focused reproduction returning 503 confirmed that the room became null and the connection stopped. The previous lobby ViewModels reported close failures and retained membership; Apple endParty() also retains the room on failure. Await the close result, show the error, and leave the lobby only after a successful or confirmed terminal close.
- Return the correction rate to 1x while the room socket is detached or reconnecting, instead of leaving up to 1.25x running. - Hold a Play correction that the reload budget defers and run it once the budget allows, rather than playing on at the wrong position. - Count expiring ws-tickets against the reconnect budget and renew the proof when its expiry is unknown, so the loop cannot retry forever. - Renew the room proof on the server clock estimate, and never re-read the room back to back after a successful renewal. - Pair each pong's receipt time with the monotonic time of the same moment, so a queued pong no longer reads as a wall-clock jump and wipes the clock estimate. - Retry a ws-ticket 401 as a transport failure instead of ending the party. - A coalesced suggestion read now shares the read's real outcome. - Phone retries resume where the player was within the same epoch. - Share the issued-seek tracker, invite server match, and notice copy between phone and TV in android-shared. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Keeps main's season Watched/Unwatched menu items, the TV Requests tab, SiloCast changes (no HDR toggle), searchable Settings and the marquee module, with the Watch Party entries added alongside. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
Keeps main's playback-teardown wait for the SiloCast identity swap alongside the Watch Party check. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
| fun onExternalSeek(fromSeconds: Double, toSeconds: Double, restore: (Double) -> Unit): RoomTransportResult { | ||
| if (abs(toSeconds - fromSeconds) < EXTERNAL_SEEK_NOISE_SECONDS) return RoomTransportResult.Ignored | ||
| // Phone and TV retain issued seek targets across both the controller | ||
| // and session callbacks to prevent correction loops. Restore each | ||
| // outside seek, including repeated denied guest input. | ||
| restore(fromSeconds) | ||
| return binding.requestSeek(toSeconds) |
There was a problem hiding this comment.
Seek authorization bypass occurs for external seeks smaller than one second: the magnitude filter returns before restoring playback or requesting room authorization, leaving a guest's seek applied locally and suppressing a host's broadcast. Remove the filter and rely on callers' issued-seek tracking, since the phone caller already identifies an unissued DISCONTINUITY_REASON_SEEK and the TV caller excludes issued targets.
restore(fromSeconds)
return binding.requestSeek(toSeconds)Prompt for LLM
File android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/watchparty/WatchPartyPlayback.kt:
Line 98 to 104:
Seek authorization bypass occurs for external seeks smaller than one second: the magnitude filter returns before restoring playback or requesting room authorization, leaving a guest's seek applied locally and suppressing a host's broadcast. Remove the filter and rely on callers' issued-seek tracking, since the phone caller already identifies an unissued DISCONTINUITY_REASON_SEEK and the TV caller excludes issued targets.
Suggested Code:
restore(fromSeconds)
return binding.requestSeek(toSeconds)
Talk to Kody by mentioning @kody
Was this suggestion helpful? React with 👍 or 👎 to help Kody learn from this interaction.
| } else { | ||
| detail.year.takeIf { year -> year > 0 }?.toString() | ||
| }, | ||
| posterUrl = portraitArtwork.url ?: detail.posterUrl, |
There was a problem hiding this comment.
Spoiler protection bypass occurs when this episode-staging action falls back to raw detail.posterUrl without verifying safe series artwork or applying current spoiler preferences and watched/progress state, potentially restoring protected episode artwork when the resolved portrait URL is absent and discarding provenance by staging only the URL. Stage a spoiler-aware artwork projection with provenance, use an explicitly safe series fallback or omit protected artwork, and revalidate protection when displaying the staged item (also found in: androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/watchparty/TvWatchPartyPicker.kt:417-417; androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/watchparty/WatchPartyPickerSheet.kt:636-636; androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/watchparty/TvWatchPartyRoom.kt:186-186; androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/watchparty/TvWatchPartyPicker.kt:432-432; androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/watchparty/WatchPartyRoomContent.kt:174-174; androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/watchparty/WatchPartyPickerSheet.kt:665-665; androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/watchparty/TvWatchPartyRoom.kt:713-713; androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/watchparty/TvWatchPartyPicker.kt:418-418; androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/watchparty/WatchPartyPickerSheet.kt:637-637; androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/watchparty/WatchPartyRoomContent.kt:190-190; androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/detail/TvItemDetailScreen.kt:1607-1607; androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/watchparty/WatchPartyRoomContent.kt:245-245; androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/watchparty/TvWatchPartyStagedItem.kt:95-95; androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/detail/TvItemDetailScreen.kt:1616-1616; androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/watchparty/WatchPartyRoomContent.kt:784-784; androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/watchparty/WatchPartyRoomContent.kt:249-249; androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/watchparty/WatchPartyRoomContent.kt:944-944; androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/watchparty/TvWatchPartyStagedItem.kt:89-89; androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/watchparty/WatchPartyRoomContent.kt:192-192; androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/watchparty/TvWatchPartyStagedItem.kt:75-75; androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/watchparty/TvWatchPartyStagedItem.kt:73-73; androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/watchparty/TvWatchPartyStagedItem.kt:74-74; androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/watchparty/TvWatchPartyStagedItem.kt:76-76).
Kody rule violation: Apply spoiler protection to current artwork provenance and all retained projections
Prompt for LLM
File androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/detail/ItemDetailScreen.kt:
Line 974:
Spoiler protection bypass occurs when this episode-staging action falls back to raw detail.posterUrl without verifying safe series artwork or applying current spoiler preferences and watched/progress state, potentially restoring protected episode artwork when the resolved portrait URL is absent and discarding provenance by staging only the URL. Stage a spoiler-aware artwork projection with provenance, use an explicitly safe series fallback or omit protected artwork, and revalidate protection when displaying the staged item (also found in: androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/watchparty/TvWatchPartyPicker.kt:417-417; androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/watchparty/WatchPartyPickerSheet.kt:636-636; androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/watchparty/TvWatchPartyRoom.kt:186-186; androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/watchparty/TvWatchPartyPicker.kt:432-432; androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/watchparty/WatchPartyRoomContent.kt:174-174; androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/watchparty/WatchPartyPickerSheet.kt:665-665; androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/watchparty/TvWatchPartyRoom.kt:713-713; androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/watchparty/TvWatchPartyPicker.kt:418-418; androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/watchparty/WatchPartyPickerSheet.kt:637-637; androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/watchparty/WatchPartyRoomContent.kt:190-190; androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/detail/TvItemDetailScreen.kt:1607-1607; androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/watchparty/WatchPartyRoomContent.kt:245-245; androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/watchparty/TvWatchPartyStagedItem.kt:95-95; androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/detail/TvItemDetailScreen.kt:1616-1616; androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/watchparty/WatchPartyRoomContent.kt:784-784; androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/watchparty/WatchPartyRoomContent.kt:249-249; androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/watchparty/WatchPartyRoomContent.kt:944-944; androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/watchparty/TvWatchPartyStagedItem.kt:89-89; androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/watchparty/WatchPartyRoomContent.kt:192-192; androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/watchparty/TvWatchPartyStagedItem.kt:75-75; androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/watchparty/TvWatchPartyStagedItem.kt:73-73; androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/watchparty/TvWatchPartyStagedItem.kt:74-74; androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/watchparty/TvWatchPartyStagedItem.kt:76-76).
Talk to Kody by mentioning @kody
Was this suggestion helpful? React with 👍 or 👎 to help Kody learn from this interaction.
| sessionQualityOverride = committed | ||
| _roomQualityChanges.tryEmit(Unit) |
There was a problem hiding this comment.
Session quality override loss occurs because loadContent's effectivePreferredQuality ignores sessionQualityOverride, so an in-place restart restores the route or saved profile quality despite the viewer accepting the lower-quality offer. Apply sessionQualityOverride to the start request for the same room epoch while preserving its reset on a new selection revision.
Prompt for LLM
File androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/PlayerViewModel.kt:
Line 3490 to 3491:
Session quality override loss occurs because loadContent's effectivePreferredQuality ignores sessionQualityOverride, so an in-place restart restores the route or saved profile quality despite the viewer accepting the lower-quality offer. Apply sessionQualityOverride to the start request for the same room epoch while preserving its reset on a new selection revision.
Talk to Kody by mentioning @kody
Was this suggestion helpful? React with 👍 or 👎 to help Kody learn from this interaction.
| LaunchedEffect(destination) { | ||
| if (destination !is WatchPartyDestination.Player || leaving) return@LaunchedEffect | ||
| val playing = repository.roomSnapshot.value?.takeIf { it.roomId == roomId } ?: return@LaunchedEffect | ||
| onOpenPlayer(playing) |
There was a problem hiding this comment.
Race condition identified in LaunchedEffect: it uses a destination captured during composition but validates the live snapshot only by roomId, allowing a queued Player destination to invoke onOpenPlayer(playing) against a replacement ownership generation for the same room rather than the identity generation that authorized launch. Carry the captured ownership generation and authority with the destination and verify both against current repository state immediately before opening the player; this requires an ownership contract beyond this line, so a standalone replacement cannot safely express the fix (also found in: androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/watchparty/WatchPartyPickerSheet.kt:340-340; android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/watchparty/WatchPartyPlayback.kt:134-134; shared/src/commonMain/kotlin/org/siloserver/silo/watchtogether/RecentWatchParty.kt:101-101; androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/watchparty/WatchPartyComponents.kt:94-94; shared/src/commonMain/kotlin/org/siloserver/silo/watchtogether/RecentWatchParty.kt:164-164; androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/player/TvPlayerScreen.kt:2558-2558; androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/watchparty/TvWatchPartyDetailEntry.kt:335-335; androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/watchparty/WatchPartyDetailActions.kt:76-76; androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/player/TvPlayerViewModel.kt:4216-4216; androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/watchparty/WatchPartyRoomContent.kt:162-162; androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/watchparty/WatchPartyPickerSheet.kt:631-631; androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/watchparty/TvWatchPartyDetailEntry.kt:290-290; androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/watchparty/TvWatchPartyLobbyScreen.kt:231-231; shared/src/commonMain/kotlin/org/siloserver/silo/viewmodel/WatchPartyViewModels.kt:189-189; shared/src/commonMain/kotlin/org/siloserver/silo/viewmodel/WatchPartyViewModels.kt:440-440; shared/src/commonMain/kotlin/org/siloserver/silo/watchtogether/RoomPlaybackBinding.kt:466-466; androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/watchparty/WatchPartyPickerSheet.kt:632-632; shared/src/commonMain/kotlin/org/siloserver/silo/repository/WatchTogetherRepository.kt:604-604; shared/src/commonMain/kotlin/org/siloserver/silo/watchtogether/RoomPlaybackBinding.kt:515-515; shared/src/commonMain/kotlin/org/siloserver/silo/viewmodel/WatchPartyViewModels.kt:139-139; androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/watchparty/TvWatchPartyDetailEntry.kt:300-300; shared/src/commonMain/kotlin/org/siloserver/silo/viewmodel/WatchPartyViewModels.kt:556-556; shared/src/commonMain/kotlin/org/siloserver/silo/viewmodel/WatchPartyViewModels.kt:190-190; androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/watchparty/TvWatchPartyDetailEntry.kt:242-242; shared/src/commonMain/kotlin/org/siloserver/silo/watchtogether/RoomSession.kt:102-102; androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/watchparty/WatchPartyRoomContent.kt:163-163; shared/src/commonMain/kotlin/org/siloserver/silo/viewmodel/WatchPartyViewModels.kt:547-547; shared/src/commonMain/kotlin/org/siloserver/silo/watchtogether/RoomPlaybackBinding.kt:401-401; androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/player/TvPlayerViewModel.kt:2771-2771; shared/src/commonMain/kotlin/org/siloserver/silo/viewmodel/WatchPartyViewModels.kt:277-277; shared/src/commonMain/kotlin/org/siloserver/silo/watchtogether/RoomPlaybackBinding.kt:467-467; shared/src/commonMain/kotlin/org/siloserver/silo/viewmodel/WatchPartyViewModels.kt:559-559; androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/player/TvPlayerViewModel.kt:4059-4059; androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/watchparty/TvWatchPartyStagedItem.kt:60-60; androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/watchparty/TvWatchPartyStagedItem.kt:63-63; androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/player/TvPlayerViewModel.kt:4046-4046; shared/src/commonMain/kotlin/org/siloserver/silo/watchtogether/RoomPlaybackBinding.kt:444-444; shared/src/commonMain/kotlin/org/siloserver/silo/watchtogether/RoomPlaybackBinding.kt:476-476; shared/src/commonMain/kotlin/org/siloserver/silo/watchtogether/RoomPlaybackBinding.kt:385-385; shared/src/commonMain/kotlin/org/siloserver/silo/watchtogether/RoomPlaybackBinding.kt:310-310; shared/src/commonMain/kotlin/org/siloserver/silo/watchtogether/RoomPlaybackBinding.kt:457-457; shared/src/commonMain/kotlin/org/siloserver/silo/watchtogether/RoomPlaybackBinding.kt:436-436; shared/src/commonMain/kotlin/org/siloserver/silo/watchtogether/RoomPlaybackBinding.kt:458-458; shared/src/commonMain/kotlin/org/siloserver/silo/watchtogether/RoomPlaybackBinding.kt:449-449; shared/src/commonMain/kotlin/org/siloserver/silo/watchtogether/RoomPlaybackBinding.kt:437-437).
Kody rule violation: Revalidate asynchronous ownership before publication, launch, and cleanup
Prompt for LLM
File androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/watchparty/WatchPartyLobbyScreen.kt:
Line 87:
Race condition identified in LaunchedEffect: it uses a destination captured during composition but validates the live snapshot only by roomId, allowing a queued Player destination to invoke onOpenPlayer(playing) against a replacement ownership generation for the same room rather than the identity generation that authorized launch. Carry the captured ownership generation and authority with the destination and verify both against current repository state immediately before opening the player; this requires an ownership contract beyond this line, so a standalone replacement cannot safely express the fix (also found in: androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/watchparty/WatchPartyPickerSheet.kt:340-340; android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/watchparty/WatchPartyPlayback.kt:134-134; shared/src/commonMain/kotlin/org/siloserver/silo/watchtogether/RecentWatchParty.kt:101-101; androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/watchparty/WatchPartyComponents.kt:94-94; shared/src/commonMain/kotlin/org/siloserver/silo/watchtogether/RecentWatchParty.kt:164-164; androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/player/TvPlayerScreen.kt:2558-2558; androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/watchparty/TvWatchPartyDetailEntry.kt:335-335; androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/watchparty/WatchPartyDetailActions.kt:76-76; androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/player/TvPlayerViewModel.kt:4216-4216; androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/watchparty/WatchPartyRoomContent.kt:162-162; androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/watchparty/WatchPartyPickerSheet.kt:631-631; androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/watchparty/TvWatchPartyDetailEntry.kt:290-290; androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/watchparty/TvWatchPartyLobbyScreen.kt:231-231; shared/src/commonMain/kotlin/org/siloserver/silo/viewmodel/WatchPartyViewModels.kt:189-189; shared/src/commonMain/kotlin/org/siloserver/silo/viewmodel/WatchPartyViewModels.kt:440-440; shared/src/commonMain/kotlin/org/siloserver/silo/watchtogether/RoomPlaybackBinding.kt:466-466; androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/watchparty/WatchPartyPickerSheet.kt:632-632; shared/src/commonMain/kotlin/org/siloserver/silo/repository/WatchTogetherRepository.kt:604-604; shared/src/commonMain/kotlin/org/siloserver/silo/watchtogether/RoomPlaybackBinding.kt:515-515; shared/src/commonMain/kotlin/org/siloserver/silo/viewmodel/WatchPartyViewModels.kt:139-139; androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/watchparty/TvWatchPartyDetailEntry.kt:300-300; shared/src/commonMain/kotlin/org/siloserver/silo/viewmodel/WatchPartyViewModels.kt:556-556; shared/src/commonMain/kotlin/org/siloserver/silo/viewmodel/WatchPartyViewModels.kt:190-190; androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/watchparty/TvWatchPartyDetailEntry.kt:242-242; shared/src/commonMain/kotlin/org/siloserver/silo/watchtogether/RoomSession.kt:102-102; androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/watchparty/WatchPartyRoomContent.kt:163-163; shared/src/commonMain/kotlin/org/siloserver/silo/viewmodel/WatchPartyViewModels.kt:547-547; shared/src/commonMain/kotlin/org/siloserver/silo/watchtogether/RoomPlaybackBinding.kt:401-401; androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/player/TvPlayerViewModel.kt:2771-2771; shared/src/commonMain/kotlin/org/siloserver/silo/viewmodel/WatchPartyViewModels.kt:277-277; shared/src/commonMain/kotlin/org/siloserver/silo/watchtogether/RoomPlaybackBinding.kt:467-467; shared/src/commonMain/kotlin/org/siloserver/silo/viewmodel/WatchPartyViewModels.kt:559-559; androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/player/TvPlayerViewModel.kt:4059-4059; androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/watchparty/TvWatchPartyStagedItem.kt:60-60; androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/watchparty/TvWatchPartyStagedItem.kt:63-63; androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/player/TvPlayerViewModel.kt:4046-4046; shared/src/commonMain/kotlin/org/siloserver/silo/watchtogether/RoomPlaybackBinding.kt:444-444; shared/src/commonMain/kotlin/org/siloserver/silo/watchtogether/RoomPlaybackBinding.kt:476-476; shared/src/commonMain/kotlin/org/siloserver/silo/watchtogether/RoomPlaybackBinding.kt:385-385; shared/src/commonMain/kotlin/org/siloserver/silo/watchtogether/RoomPlaybackBinding.kt:310-310; shared/src/commonMain/kotlin/org/siloserver/silo/watchtogether/RoomPlaybackBinding.kt:457-457; shared/src/commonMain/kotlin/org/siloserver/silo/watchtogether/RoomPlaybackBinding.kt:436-436; shared/src/commonMain/kotlin/org/siloserver/silo/watchtogether/RoomPlaybackBinding.kt:458-458; shared/src/commonMain/kotlin/org/siloserver/silo/watchtogether/RoomPlaybackBinding.kt:449-449; shared/src/commonMain/kotlin/org/siloserver/silo/watchtogether/RoomPlaybackBinding.kt:437-437).
Talk to Kody by mentioning @kody
Was this suggestion helpful? React with 👍 or 👎 to help Kody learn from this interaction.
| val entries = remember(state.rows) { | ||
| state.rows?.let { it.continueTogether + it.watchlistUnion }.orEmpty().associateBy { it.item.contentId } | ||
| } |
There was a problem hiding this comment.
Incorrect episode navigation occurs because associateBy keeps the last duplicate, allowing a Watchlist Union entry without nextUp to overwrite the same series' Continue Together entry and its non-null group next-up episode. Prefer an entry with a non-null nextUp when merging duplicates so tapping Continue Together confirms the group's episode instead of opening the series detail page.
val entries = remember(state.rows) {
state.rows?.let { it.continueTogether + it.watchlistUnion }.orEmpty()
.groupBy { it.item.contentId }
.mapValues { (_, candidates) ->
candidates.firstOrNull { it.nextUp != null } ?: candidates.first()
}
}Prompt for LLM
File androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/watchparty/WatchPartyPickerSheet.kt:
Line 125 to 127:
Incorrect episode navigation occurs because associateBy keeps the last duplicate, allowing a Watchlist Union entry without nextUp to overwrite the same series' Continue Together entry and its non-null group next-up episode. Prefer an entry with a non-null nextUp when merging duplicates so tapping Continue Together confirms the group's episode instead of opening the series detail page.
Suggested Code:
val entries = remember(state.rows) {
state.rows?.let { it.continueTogether + it.watchlistUnion }.orEmpty()
.groupBy { it.item.contentId }
.mapValues { (_, candidates) ->
candidates.firstOrNull { it.nextUp != null } ?: candidates.first()
}
}
Talk to Kody by mentioning @kody
Was this suggestion helpful? React with 👍 or 👎 to help Kody learn from this interaction.
| val id = stagedId ?: return@LaunchedEffect | ||
| when (val result = catalog.getItemDetail(id, libraryId)) { | ||
| is ApiResult.Success -> detail = result.data | ||
| is ApiResult.Error -> unavailable = result.code == 403 || result.code == 404 |
There was a problem hiding this comment.
Refused content remains actionable because setting an availability flag neither clears loaded detail nor invalidates its durable cached copy, and the projection returns unavailable = false when detail exists. For 404, 410, and access-denying 403 responses other than profile_verification_required, clear detail, invalidate the cached copy, and publish an unavailable projection without refused content or actions; preserve detail for transient failures and retain the dedicated profile-verification recovery flow (also found in: androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/watchparty/TvWatchPartyStagedItem.kt:64-64).
Kody rule violation: Clear cached detail on authoritative access refusal
Prompt for LLM
File androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/watchparty/WatchPartyRoomContent.kt:
Line 163:
Refused content remains actionable because setting an availability flag neither clears loaded detail nor invalidates its durable cached copy, and the projection returns `unavailable = false` when detail exists. For 404, 410, and access-denying 403 responses other than profile_verification_required, clear detail, invalidate the cached copy, and publish an unavailable projection without refused content or actions; preserve detail for transient failures and retain the dedicated profile-verification recovery flow (also found in: androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/watchparty/TvWatchPartyStagedItem.kt:64-64).
Talk to Kody by mentioning @kody
Was this suggestion helpful? React with 👍 or 👎 to help Kody learn from this interaction.
| if (roomContext?.selectionRevision == refusal.context.selectionRevision && | ||
| _uiState.value.streamUrl == null && _uiState.value.error == null | ||
| ) { | ||
| fail(refusal.message) |
There was a problem hiding this comment.
Indefinite loading occurs because the fallback timeout requires streamUrl == null, but loadContent retains the previous stream URL and sets isLoading = true when a room replacement start is refused, suppressing the promised refusal if the accepted fallback never supplies a new context. Check that the refusal's context remains current and the replacement remains loading rather than treating the retained stream URL as evidence of success.
if (roomContext?.selectionRevision == refusal.context.selectionRevision &&
_uiState.value.isLoading && _uiState.value.error == null
) {
fail(refusal.message)
}Prompt for LLM
File androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/player/TvPlayerViewModel.kt:
Line 4216 to 4219:
Indefinite loading occurs because the fallback timeout requires `streamUrl == null`, but loadContent retains the previous stream URL and sets `isLoading = true` when a room replacement start is refused, suppressing the promised refusal if the accepted fallback never supplies a new context. Check that the refusal's context remains current and the replacement remains loading rather than treating the retained stream URL as evidence of success.
Suggested Code:
if (roomContext?.selectionRevision == refusal.context.selectionRevision &&
_uiState.value.isLoading && _uiState.value.error == null
) {
fail(refusal.message)
}
Talk to Kody by mentioning @kody
Was this suggestion helpful? React with 👍 or 👎 to help Kody learn from this interaction.
| val position = startPositionOverride?.takeIf { it.isFinite() && it >= 0.0 } | ||
| ?: currentSourcePositionSeconds.takeIf { it.isFinite() && it > 0.0 } | ||
| ?: room.positionSeconds |
There was a problem hiding this comment.
Incorrect restart positioning occurs because a prepared room restart rejects a valid zero position with it > 0.0, causing retryServerReachability() or another no-override retry after seeking to the beginning to restore the original nonzero room anchor. Accept zero with it >= 0.0, matching explicit override validation.
?: currentSourcePositionSeconds.takeIf { it.isFinite() && it >= 0.0 }Prompt for LLM
File androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/player/TvWatchPartyPlayer.kt:
Line 429 to 431:
Incorrect restart positioning occurs because a prepared room restart rejects a valid zero position with `it > 0.0`, causing retryServerReachability() or another no-override retry after seeking to the beginning to restore the original nonzero room anchor. Accept zero with `it >= 0.0`, matching explicit override validation.
Suggested Code:
?: currentSourcePositionSeconds.takeIf { it.isFinite() && it >= 0.0 }
Talk to Kody by mentioning @kody
Was this suggestion helpful? React with 👍 or 👎 to help Kody learn from this interaction.
| lobby.stage(request.item) | ||
| val staged = withTimeoutOrNull(REQUEST_TIMEOUT_MS) { | ||
| repository.roomSnapshot.first { room -> | ||
| room == null || room.roomId != request.roomId || room.selectedContentId == request.item.contentId | ||
| } |
There was a problem hiding this comment.
Premature staging success occurs because DetailStageRunner accepts the initial StateFlow selection when the requested content is already staged, even if the viewer requested a different file or lobby.stage later refuses the request. Await the Job returned by lobby.stage and verify the resulting selection, including the requested file, before announcing success or navigating.
Prompt for LLM
File androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/watchparty/TvWatchPartyDetailEntry.kt:
Line 233 to 237:
Premature staging success occurs because DetailStageRunner accepts the initial StateFlow selection when the requested content is already staged, even if the viewer requested a different file or lobby.stage later refuses the request. Await the Job returned by lobby.stage and verify the resulting selection, including the requested file, before announcing success or navigating.
Talk to Kody by mentioning @kody
Was this suggestion helpful? React with 👍 or 👎 to help Kody learn from this interaction.
| LaunchedEffect(request) { | ||
| val result = repository.setSelection( | ||
| SetSelectionRequest( | ||
| contentId = request.item.contentId, | ||
| fileId = request.item.fileId, | ||
| libraryId = request.item.libraryId, | ||
| ), | ||
| ) |
There was a problem hiding this comment.
Race condition identified in DetailSelectRunner: it submits a confirmed selection without verifying membership against request.roomId, while WatchTogetherRepository.setSelection targets the current active binding, so a membership change during confirmation switches the new party's title and navigates to the old party. Bind the mutation to the captured room membership and reject stale confirmations.
Prompt for LLM
File androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/watchparty/TvWatchPartyDetailEntry.kt:
Line 289 to 296:
Race condition identified in DetailSelectRunner: it submits a confirmed selection without verifying membership against request.roomId, while WatchTogetherRepository.setSelection targets the current active binding, so a membership change during confirmation switches the new party's title and navigates to the old party. Bind the mutation to the captured room membership and reject stale confirmations.
Talk to Kody by mentioning @kody
Was this suggestion helpful? React with 👍 or 👎 to help Kody learn from this interaction.
| Row(horizontalArrangement = Arrangement.spacedBy(TvPartyMetrics.seatGap), verticalAlignment = Alignment.Top) { | ||
| watchPartySeatOrder(members).forEach { member -> | ||
| TvPartySeat(member = member, state = watchPartySeatState(member, phase), size = seatSize) | ||
| } | ||
| TvPartyInviteSeat(onClick = onInvite, modifier = inviteModifier, size = seatSize) | ||
| } |
There was a problem hiding this comment.
Action button occlusion occurs because the non-scrolling seats row renders every member at a fixed minimum width beside the room's primary actions: at the documented 960dp canvas width, six 64dp seats plus the invite seat consume 780dp of the 792dp page width before action measurement, effectively hiding Start/Ready. Constrain and horizontally scroll the seats region while reserving width for the actions.
Prompt for LLM
File androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/watchparty/TvWatchPartyStyle.kt:
Line 660 to 665:
Action button occlusion occurs because the non-scrolling seats row renders every member at a fixed minimum width beside the room's primary actions: at the documented 960dp canvas width, six 64dp seats plus the invite seat consume 780dp of the 792dp page width before action measurement, effectively hiding Start/Ready. Constrain and horizontally scroll the seats region while reserving width for the actions.
Talk to Kody by mentioning @kody
Was this suggestion helpful? React with 👍 or 👎 to help Kody learn from this interaction.
| "b": {"pos": b[0], "playing": b[2], "party": (db.get("party") or {}).get("playbackState")}, | ||
| })) | ||
| PY | ||
| (( i < samples )) && sleep "$interval" |
There was a problem hiding this comment.
Incorrect exit status occurs because the final spread iteration's (( i < samples )) && sleep "$interval" returns status 1 after all requested samples complete, and the loop and case are the script's final commands. Replace the AND-list with an if statement so successful spread runs report success to callers.
if (( i < samples )); then
sleep "$interval"
fiPrompt for LLM
File scripts/android-playback-test.sh:
Line 204:
Incorrect exit status occurs because the final spread iteration's `(( i < samples )) && sleep "$interval"` returns status 1 after all requested samples complete, and the loop and case are the script's final commands. Replace the AND-list with an `if` statement so successful spread runs report success to callers.
Suggested Code:
if (( i < samples )); then
sleep "$interval"
fi
Talk to Kody by mentioning @kody
Was this suggestion helpful? React with 👍 or 👎 to help Kody learn from this interaction.
| if (cause.status == 403 && !proofRenewedForRefusal) { | ||
| // The proof may have lapsed; one renewal decides. | ||
| proofRenewedForRefusal = true | ||
| if (reconcileRoom(lease) is ApiResult.Success) continue | ||
| } | ||
| if (cause.terminal) { | ||
| endIfOwner(lease, owner, ticketEndReason(cause.status)) | ||
| break |
There was a problem hiding this comment.
Premature membership termination occurs when a transient room-proof renewal read failure after a ticket 403 reaches the terminal-refusal branch, even though reconcileRoom preserves active membership on NetworkError. Distinguish transient renewal failures from confirmed terminal refusals and retry them within the reconnect budget instead of immediately ejecting the viewer.
Prompt for LLM
File shared/src/commonMain/kotlin/org/siloserver/silo/repository/WatchTogetherRepository.kt:
Line 948 to 955:
Premature membership termination occurs when a transient room-proof renewal read failure after a ticket 403 reaches the terminal-refusal branch, even though reconcileRoom preserves active membership on NetworkError. Distinguish transient renewal failures from confirmed terminal refusals and retry them within the reconnect budget instead of immediately ejecting the viewer.
Talk to Kody by mentioning @kody
Was this suggestion helpful? React with 👍 or 👎 to help Kody learn from this interaction.
| } | ||
| } | ||
| is ApiResult.Error -> { | ||
| if (created.error == "invalid_response") { |
There was a problem hiding this comment.
Duplicate room creation can occur because the create error branch discards pendingCreate for invalid_room_response, which WatchTogetherRepository.installRoomResponse returns when a successful response lacks a usable room ID or access token even though the server may already have created the room. Preserve the draft for both invalid_response and invalid_room_response so an explicit retry reuses its identity.
Prompt for LLM
File shared/src/commonMain/kotlin/org/siloserver/silo/viewmodel/WatchPartyViewModels.kt:
Line 202:
Duplicate room creation can occur because the create error branch discards pendingCreate for `invalid_room_response`, which WatchTogetherRepository.installRoomResponse returns when a successful response lacks a usable room ID or access token even though the server may already have created the room. Preserve the draft for both `invalid_response` and `invalid_room_response` so an explicit retry reuses its identity.
Talk to Kody by mentioning @kody
Was this suggestion helpful? React with 👍 or 👎 to help Kody learn from this interaction.
| if (scheduled.connection.generation != connection.generation || scheduled.connection.epoch != connection.epoch) return | ||
| val commandConnection = connection.generation to connection.epoch | ||
| if (command.commandId.isBlank() || | ||
| (command.commandId == lastSeenCommandId && commandConnection == lastCommandConnection) |
There was a problem hiding this comment.
Retargeted replay suppression occurs because the comparison uses command.commandId == lastSeenCommandId and commandConnection == lastCommandConnection, rejecting replays when the connection pair remains unchanged, including commands remembered by accept but later rejected by execute for an obsolete session. Compare a remembered key containing command ID, identity generation, socket epoch, and target session ID (also found in: shared/src/commonMain/kotlin/org/siloserver/silo/watchtogether/RoomPlaybackBinding.kt:499-499; shared/src/commonMain/kotlin/org/siloserver/silo/watchtogether/RoomPlaybackBinding.kt:202-202).
Kody rule violation: Scope remote command deduplication to the target playback session
Prompt for LLM
File shared/src/commonMain/kotlin/org/siloserver/silo/watchtogether/RoomPlaybackBinding.kt:
Line 501:
Retargeted replay suppression occurs because the comparison uses command.commandId == lastSeenCommandId and commandConnection == lastCommandConnection, rejecting replays when the connection pair remains unchanged, including commands remembered by accept but later rejected by execute for an obsolete session. Compare a remembered key containing command ID, identity generation, socket epoch, and target session ID (also found in: shared/src/commonMain/kotlin/org/siloserver/silo/watchtogether/RoomPlaybackBinding.kt:499-499; shared/src/commonMain/kotlin/org/siloserver/silo/watchtogether/RoomPlaybackBinding.kt:202-202).
Talk to Kody by mentioning @kody
Was this suggestion helpful? React with 👍 or 👎 to help Kody learn from this interaction.
| val serverNow = serverNowMs() | ||
| if (serverNow == null) { | ||
| scheduleExecution(scheduled) | ||
| return | ||
| } | ||
| pending = null |
There was a problem hiding this comment.
Premature command execution occurs because execution does not recheck execute_at after the server-clock estimate changes during the scheduled delay, allowing a lower offset to apply a seek or play before the room's scheduled time. Recompute the remaining server-time delay in execute() and reschedule while it is positive instead of treating every timer wakeup as due.
val serverNow = serverNowMs()
if (serverNow == null || (scheduled.executeAtServerMs?.let { it > serverNow } == true)) {
scheduleExecution(scheduled)
return
}
pending = nullPrompt for LLM
File shared/src/commonMain/kotlin/org/siloserver/silo/watchtogether/RoomPlaybackBinding.kt:
Line 566 to 571:
Premature command execution occurs because execution does not recheck execute_at after the server-clock estimate changes during the scheduled delay, allowing a lower offset to apply a seek or play before the room's scheduled time. Recompute the remaining server-time delay in execute() and reschedule while it is positive instead of treating every timer wakeup as due.
Suggested Code:
val serverNow = serverNowMs()
if (serverNow == null || (scheduled.executeAtServerMs?.let { it > serverNow } == true)) {
scheduleExecution(scheduled)
return
}
pending = null
Talk to Kody by mentioning @kody
Was this suggestion helpful? React with 👍 or 👎 to help Kody learn from this interaction.
| private fun alignPausedToAnchor(snapshot: RoomSnapshot, obs: RoomPlayerObservation) { | ||
| val anchor = snapshot.anchorPositionSeconds | ||
| if (abs(anchor - obs.sourcePositionSeconds) > RoomCatchup.DEADBAND_SECONDS && player.isBuffered(anchor)) { | ||
| player.seekTo(anchor) | ||
| } | ||
| player.setPlaying(false) |
There was a problem hiding this comment.
Playback misalignment occurs because paused suspension recovery skips alignment when the room anchor falls outside the local buffer, leaving a resumed viewer at the old position after the host seeks during suspension. Seek to the anchor through the player port even when media re-anchoring is required, since this path documents that a paused reattach sends no command.
if (abs(anchor - obs.sourcePositionSeconds) > RoomCatchup.DEADBAND_SECONDS) {
player.seekTo(anchor)
}Prompt for LLM
File shared/src/commonMain/kotlin/org/siloserver/silo/watchtogether/RoomPlaybackBinding.kt:
Line 695 to 700:
Playback misalignment occurs because paused suspension recovery skips alignment when the room anchor falls outside the local buffer, leaving a resumed viewer at the old position after the host seeks during suspension. Seek to the anchor through the player port even when media re-anchoring is required, since this path documents that a paused reattach sends no command.
Suggested Code:
if (abs(anchor - obs.sourcePositionSeconds) > RoomCatchup.DEADBAND_SECONDS) {
player.seekTo(anchor)
}
Talk to Kody by mentioning @kody
Was this suggestion helpful? React with 👍 or 👎 to help Kody learn from this interaction.
Problem
Android's Watch Together predated the server's v2 room contract and stayed hidden. It had no staged lobby: the entry policy opened the player whenever a room had a selection, without checking that the room was playing (#355). It also lacked room proofs, readiness barriers, catch-up, socket rotation, same-profile replacement, suggestions, invitations, and the shared room clock that Apple and the web client now use. Apple ships Watch Party behind Settings → Experimental; Android had no equivalent.
Solution
Watch Party is rebuilt on the v2 contract and exposed on phone and TV only behind Settings → Experimental → Watch Party. The toggle is device-local and defaults on in debug builds and off in release builds, and the feature still requires the server to advertise it. The design and product decisions are in
docs/watch-party-implementation-plan.md.Shared contract and room state (
shared/)WatchTogetherRepositoryowns one membership. It renews the room proof, orders snapshots by generation, and reconnects immediately after the server's five-minute socket rotation. It ends cleanly onroom_closedandconnection_replaced, and runs mutations one at a time, reconciling any outcome it can't confirm.RoomSessionis keyed by membership generation, so rejoining the same room replaces the old socket.silo://watch-party?server=…&token=…, matching server #1415), and eligibility rules.RoomPlaybackBindingis one event loop per player. It attaches the playback session, applies commands at their execution time, and holds commands while media mounts. It handles readiness, lobby Ready, and catch-up afterself_ignore_wait, and converges drift by rate (0.9–1.25×, 0.35 s deadband) the way the web client does. Reloads are budgeted, and stalls under the 2 s grace are not reported.Playback start (
android-shared/, both starters)allow_alternate_versions: false) from the room position, never a personal resume point. Only the four approved refusal reasons ask the room to switch sources.WatchPartyPlaybackcoordinates each player screen. Outside seeks (notification, headset, Assistant) restore the local position before requesting a room seek; only the host can authorize the request. Issued-target tracking prevents restoration callbacks from becoming new requests.Phone and TV UI
silo://watch-party; the TV shows the code and a QR code. While a device is in a party, solo playback first asks the user to leave it. The TV refuses SiloCast handoffs during a party.AGENTS.md,README.md,FEATURES.md, anddocs/README.mddescribe the experimental exposure.Fixes found during live qualification
Design parity with iOS and tvOS
zxing-core, which the TV already uses). The hub, options, join keypad, and title picker (Home-style shelves and a confirmation page with "Who's seen it") also follow Apple.WatchPartyLobbyPolicy, so phone and TV read the same. Guests can mark ready in any lobby, as on Apple; a voting room offers Start only when the server advertisesvote_host_override, since starting promotes the leader. Avatar colours use Apple's hash, so a member has one colour on every client.Fixes from review
execute_at, an unknown action, or no playback state is treated as malformed and reconciles the room instead of running at once. A SiloCast launch is refused while the TV is in any party state, including the lobby. The TV suggestion menu offers Queue only when the server supports staged selection. In a playing voting room, a host on a detail page gets "Suggest to Party" instead of a direct selection, which the server refuses there. The TV's "Leave and play" waits for the party to finish leaving before starting solo playback, as the phone does. Both hubs re-check server support each time they are shown, so a server-side disable takes effect without a restart; the phone hub waits for that check before acting on an invitation or host handoff. A repeated suggestion of the same title reuses the in-flight or uncertain suggestion instead of adding a duplicate. TV detail-page hosting re-checks support first. A new title starts with a fresh reload budget and stall history. Servers without staged selection no longer show Start buttons or a detail-page host entry that the app then refuses. After an outside play/pause, both players report the room state only once the room's play/pause is restored.Fixes from the second review
android-shared.mainis merged in. Conflicts were resolved by keeping main's season Watched/Unwatched menu items, TV Requests tab, SiloCast changes (no HDR toggle), and searchable Settings, with the Watch Party entries added alongside.Closes #355.
Validation tasks: none
Validation
main: shared, android-shared, androidApp, and androidTvApp unit tests all pass (shared 1,777, android-shared 1,700, androidApp 793, androidTvApp 1,213 after the latestmain), and both apps compile. New regression tests cover the reconnect rate reset, the held Play correction, the expiring-ticket budget, the 401 retry, the late pong, and the coalesced suggestion failure. Not yet re-qualified on devices.b1f1f1f6on shared development with a phone and a TV emulator: phone host with TV guest (lobby, Ready in both directions, invitation and QR, options, picker and confirmation, Start, the party panel over playback on both devices, Return to playback, Return everyone to lobby, End), then TV host of a voting room with the phone as guest (suggest, vote, "Start ", host options, invitation QR, End). Unit tests ate9712504: shared 1,531, android-shared 1,584, androidApp 681, androidTvApp 1,170, all passing; the build supply-chain check, both debug APKs, and the CI lint set pass. Playback of the 4K Dolby Vision test title was slow to start on the emulators, which is unrelated to this change.main(1fc38d5a):silo://watch-partylink): start, pause, and seek within 0.02 s. Guest pause is refused under host-only and allowed after the host changes the policy.Risks
TvPlayerScreen's compiled method sits about 300 dex units under ART's JIT limit, which was already tight before this change.silo://link or as a code.Follow-up
AI disclosure
Planned, implemented, reviewed, and qualified with Claude Opus 5.5 (
claude-opus-5-5) in Claude Code, running in T3 Code. Claude Opus 5.5 subagents wrote the phone and TV player adapters and the phone and TV Watch Party UI; the lead session reviewed their diffs before merging them. Other tooling:gh, the agent-device automation CLI for emulators and simulators, and a local Playwright script driving the web client. The follow-up review and repairs used Codex (gpt-6-astra) with three independent Codex review agents using the same model. Review tooling: Git,gh, Gradle, and agent-device; the Codex harness ran in T3 Code. The design-parity pass was planned, reviewed, and device-verified with Claude Opus 5.5 (claude-opus-5-5) in Claude Code, running in T3 Code; two Claude Opus 5.5 subagents wrote the phone and TV screens against Apple's shipped SwiftUI as the spec, and a third Claude Opus 5.5 agent reviewed the diff. Native Cast and notification/headset seek behavior still need device qualification after these repairs. The second review and its repairs, including the merge withmain, used Claude Opus 5.5 (claude-opus-5-5) in Claude Code (desktop app), with Git,gh, and Gradle.Note
Bring Watch Party synchronized playback to phone and TV behind an experimental toggle
WatchTogetherRepositoryandWatchTogetherApiaround room proofs, serialized actions, paginated suggestions, NTP-style clock estimation, membership generations, and non-replayable mutations sent through a no-retry HTTP client.watch_party_active. Room responses with wrong or missing proof/room IDs are now rejected asinvalid_response.Macroscope summarized 433bf8b.