Skip to content

feat(watch-party): bring Watch Party to phone and TV behind an Experimental toggle - #377

Merged
Quick104 merged 44 commits into
mainfrom
t3code/review-watch-party-plan
Oct 6, 2026
Merged

Quick104 merged 44 commits into
mainfrom
t3code/review-watch-party-plan

Conversation

@Quick104

@Quick104 Quick104 commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

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/)

  • The full v2 room API goes through the owner-scoped call path: create, join, stage, start, stop, select, mode, guest policy, suggestions and votes, promote, source fallback, member state, and picker. Start, select, and promote use a client that never replays a request, because OkHttp was shown to resend a POST on a pooled connection.
  • WatchTogetherRepository owns 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 on room_closed and connection_replaced, and runs mutations one at a time, reconciling any outcome it can't confirm.
  • RoomSession is keyed by membership generation, so rejoining the same room replaces the old socket.
  • New room model: capabilities and availability, recent party and Rejoin, server clock estimate, vote ranking, invitation parsing (silo://watch-party?server=…&token=…, matching server #1415), and eligibility rules.
  • RoomPlaybackBinding is 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 after self_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)

  • A party always plays the room's exact file (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.
  • WatchPartyPlayback coordinates 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

  • A hub reached from the profile menu or a detail page, a lobby with the staged title, members and lobby Ready, a picker, suggestions, and votes. Only the room's phase opens the player.
  • Back during a party opens a party panel over the running player. Everyone can Leave; the host can also Return everyone to lobby or End for everyone.
  • Status notices: waiting for named members, catching up, continuing without someone, host away, and reconnecting (shown only after two seconds).
  • Invitations: the phone shares or copies the link and handles 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.
  • The old Watch Together screens, entry policy, and surface constant are removed. AGENTS.md, README.md, FEATURES.md, and docs/README.md describe the experimental exposure.

Fixes found during live qualification

  • A dead room socket could silently stop a viewer's sync loop, leaving them far behind until they left.
  • A phone guest seeked back and forth thousands of times after a host seek.
  • Ending a party left a Rejoin for a room that no longer existed.
  • Smaller fixes: TV confirm dialogs now focus Cancel first; a TV guest's Pause shows the "only the host" notice; the TV code keypad no longer shows through; phone member statuses line up.

Design parity with iOS and tvOS

  • Phone and TV party screens follow Apple's current layouts. The lobby puts the staged title's backdrop behind the room, with a code pill, connection dot, options, a hero with facts and quality chips, member seats whose rings show readiness, a voting ballot or suggestion list, and the one relevant action pinned at the bottom. Back during party playback reopens that room over the player with "Return to playback".
  • New invitation page with a QR code of the invite link (phone adds 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.
  • The lobby's wording and foregrounded action come from one shared policy ported from Apple's 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 advertises vote_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

  • A party invitation that arrived before sign-in was dropped, because it was pinned to the identity at arrival. It now survives sign-in; the hub still joins only on the link's server.
  • A new membership now starts with a fresh server clock instead of the previous room's samples.
  • The TV offers "Add to party" only when the server advertises staging, as the phone already did.
  • External host seeks restore the local position before requesting a room seek, and both players suppress reports until that restore settles.
  • Command IDs are scoped to the socket epoch, so a waiting command replayed after reconnect is applied. Playback waits for a valid server clock and shows a recovery message if synchronization is delayed.
  • Only stable sockets reset the reconnect budget; repeated short connections now reach the connection-lost state.
  • Picker search cancels superseded requests and discards late results as soon as the query changes. Server suggestion rows use the same video filter as search, excluding ebooks and other unsupported items.
  • Every denied external guest seek is restored, including rapid controller input. Duplicate controller and session callbacks remain suppressed by the issued-target trackers.
  • TV Stop survives closing the party panel. Phone Downloads and TV Continue Watching ask the user to leave the party before solo playback.
  • A room command with an unreadable 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.
  • Invitation handoffs wait for capability discovery. The phone hub asks to stop an active Google Cast session before creating, joining, or opening party playback.

Fixes from the second review

  • A catch-up rate (up to 1.25×) kept running while the room socket reconnected. It now returns to 1× whenever the binding is detached.
  • A Play correction that needed new media while the reload budget was backing off was dropped, so the viewer played on at the wrong position. It is now held and runs once the budget allows, aimed at where the room is by then.
  • Expiring ws-tickets retried every 1.5 s forever. They now count against the reconnect budget, and the proof is renewed when its expiry is unknown.
  • Proof renewal used the device clock and had no pause after a success, so a fast clock could re-read the room in a tight loop. It now uses the server clock estimate and waits at least the retry interval after a renewal.
  • A pong folded more than a second after it was decoded looked like a wall-clock jump and wiped the clock estimate. Receipt times are now paired with the monotonic time of the same moment.
  • A ws-ticket 401 left after the token refresh ended the party as unauthorized. It is now retried like any transport failure; a real sign-out still leaves through the identity transition.
  • A suggestion refresh that joined a read already in flight reported success even when that read failed. It now shares the read's real outcome.
  • A phone retry restarted at the room position from when the epoch began. Within the same epoch it now resumes where the player was, as the TV already did.
  • The issued-seek tracker, the invitation server match, and the notice copy were duplicated between phone and TV, and the two server matches parsed URLs differently. They now live once in android-shared.
  • main is 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

  • Second review repairs at the merge with 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 latest main), 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.
  • Design parity check at b1f1f1f6 on 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 at e9712504: 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.
  • Unit tests before the design pass: shared 1,521, android-shared 1,584, androidApp 681, androidTvApp 1,170, all passing (4,956 total). All CI lint tasks passed, including shared Android lint and both release vital checks. Both debug APKs assembled. Focused regressions reproduced stale picker responses, indefinite reconnects, replayed-command suppression, scheduling without a clock sample, repeated denied guest seeks, and non-video picker rows before their repairs.
  • Review emulator check: Home → Continue Watching → Resume on TV started solo playback while a party was active on the original reviewed build. After the repair, it asks to leave the party; Cancel returns to Home and preserves membership. The test party was ended afterward.
  • Author qualification before the review repairs, on shared development, with phone and TV emulators, the web client, and an iOS simulator built from silo-apple main (1fc38d5a):
    • Phone host with TV guest: lobby readiness, start (0.1–0.3 s apart), pause, host seek (the guest lands on the same frame within 0.8 s), Stop and restart, and the party panel. An 11-minute soak covered several five-minute socket rotations with immediate reconnects, a median spread of 0.2 s, and no stalls.
    • Host leaves: guests see the host-away notice, and the party ends two minutes later. A host who rejoins within the grace period stays host.
    • Throttled TV: the room waits about 11 s, then plays on. Once the network returns, the TV catches up to within 0.3 s.
    • Web host with phone guest (joined through the silo://watch-party link): start, pause, and seek within 0.02 s. Guest pause is refused under host-only and allowed after the host changes the policy.
    • TV host with web guest: in step within 0.05 s.
    • The same profile on TV and web displaces the other in both directions, with a Rejoin.
    • iOS host with TV guest, and TV host with iOS guest: join, readiness, start, pause, seek, Stop, and End all propagate.
    • Test parties were closed afterwards.

Risks

  • Size: this is a large change to the phone and TV player screens. The party code paths only run when a room is bound, and release builds hide every entry point until the toggle is turned on.
  • TV method size: TvPlayerScreen's compiled method sits about 300 dex units under ART's JIT limit, which was already tight before this change.
  • Invitations: the server's join page offers the app link to iOS only, so Android invitation links currently work when shared as the silo:// link or as a code.

Follow-up

  • Qualify native Google Cast admission, notification/headset seeks, and phone Downloads with a downloaded fixture after the review repairs. Recheck phone/TV room playback following the command-timing changes.
  • Cross-server replacement and worker-dependent deliveries need a two-API stack; HDR, Dolby Vision, passthrough, and physical-remote behavior need real hardware.
  • Server: offer the app link to Android on the invitation page.
  • Web: after a seek or resume, a web guest settles about 0.8 s behind the room and never corrects, because it stays under the server's 1 s correction threshold.

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 with main, 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

  • Adds the full Watch Party feature for Android phone and TV: hub, lobby, invitations, room sessions, synchronized playback, party panel, and reconnect handling. Exposure is gated by a device-local Settings → Experimental toggle, default on in debug and off in release builds, and requires server room capabilities.
  • Room playback becomes the authority: play, pause, and seek go through the room; local file-version, quality, and speed changes are disabled for members; playback starts paused until a room command arrives; and room starts pin the room's exact file and position, refusing alternate versions.
  • Reworks WatchTogetherRepository and WatchTogetherApi around room proofs, serialized actions, paginated suggestions, NTP-style clock estimation, membership generations, and non-replayable mutations sent through a no-retry HTTP client.
  • Adds catch-up logic (bounded rate correction and seek decisions) in RoomCatchup.kt and a shared playback binding in WatchPartyPlayback.kt.
  • Behavioral Change: the old Watch Together entry flows, suggestion callbacks, close-room dialogs, and compile-time surface flag are removed; in a party, Cast and picture-in-picture are disabled, Back opens the party panel, and TV cast launches are refused with watch_party_active. Room responses with wrong or missing proof/room IDs are now rejected as invalid_response.

Macroscope summarized 433bf8b.

Quick104 and others added 25 commits September 25, 2026 08:56
…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]>
@coderabbitai

coderabbitai Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Too 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.

Check out review usage here.

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d7aa9509-947f-4e21-96f3-9e459e81fb44
📥 Commits

Reviewing files that changed from the base of the PR and between bb8d9cd and 433bf8b.

📒 Files selected for processing (194)
  • AGENTS.md
  • FEATURES.md
  • README.md
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/di/WatchPartyModule.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/PlaybackSessionLifecycle.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/PlaybackSessionManager.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/debug/PlaybackDebugReceiver.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/video/VideoPlaybackSessionCoordinator.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/video/VideoPlaybackStartRequest.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/video/VideoPlaybackStartResult.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/video/VideoPlayerUiState.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/watchparty/WatchPartyDebugRegistry.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/watchparty/WatchPartyPlayback.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/player/watchparty/WatchPartyPlayerSupport.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/watchparty/WatchPartyExperiment.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/watchparty/WatchPartyServerMatch.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/network/WatchPartyRequestReplayTest.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/player/watchparty/WatchPartyPlayerSupportTest.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/watchparty/WatchPartyExperimentTest.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/watchparty/WatchPartyServerMatchTest.kt
  • androidApp/build.gradle.kts
  • androidApp/gradle.lockfile
  • androidApp/src/androidMain/AndroidManifest.xml
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/MainActivity.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/SiloApplication.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/di/AndroidModule.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/components/MainAppTopBar.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/components/ProfileMenu.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/components/TopBarActions.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/navigation/AppNavigation.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/navigation/ExternalRouteNavigation.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/navigation/Routes.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/MainScreen.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/detail/ItemDetailScreen.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/detail/MovieDetailContent.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/detail/SeriesDetailContent.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/home/HomeScreen.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/libraries/LibrariesScreen.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/MobileSubtitleTransactionAdapter.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/MobileVideoPlaybackStarter.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/PlaybackRealtimeController.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/PlayerControls.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/PlayerGestureHandler.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/PlayerOverlay.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/PlayerScreen.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/PlayerSettingsSheet.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/PlayerViewModel.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/RoomSyncController.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/RoomSyncStateReportGate.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/player/WatchPartyPlayerSupport.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/settings/SettingsScreen.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/watchparty/WatchPartyComponents.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/watchparty/WatchPartyDetailActions.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/watchparty/WatchPartyHandoff.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/watchparty/WatchPartyHubScreen.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/watchparty/WatchPartyInviteSheet.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/watchparty/WatchPartyLobbyScreen.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/watchparty/WatchPartyPanelSheet.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/watchparty/WatchPartyPickerSheet.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/watchparty/WatchPartyRoomContent.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/watchparty/WatchPartyStyle.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/watchparty/WatchPartySupport.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/watchtogether/SuggestToRoomViewModel.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/watchtogether/WatchTogetherEntrySheet.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/watchtogether/WatchTogetherEntryViewModel.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/watchtogether/WatchTogetherLobbyScreen.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/watchtogether/WatchTogetherLobbyViewModel.kt
  • androidApp/src/androidMain/kotlin/org/siloserver/silo/android/ui/screens/watchtogether/WatchTogetherMenuEntrySheet.kt
  • androidApp/src/androidUnitTest/kotlin/org/siloserver/silo/android/ui/screens/player/PlayerViewModelLoadOwnershipIntegrationTest.kt
  • androidApp/src/androidUnitTest/kotlin/org/siloserver/silo/android/ui/screens/player/RoomDeliveryKeySourceTest.kt
  • androidApp/src/androidUnitTest/kotlin/org/siloserver/silo/android/ui/screens/player/RoomSyncStateReportGateTest.kt
  • androidApp/src/androidUnitTest/kotlin/org/siloserver/silo/android/ui/screens/player/WatchPartyExternalSeekTest.kt
  • androidApp/src/androidUnitTest/kotlin/org/siloserver/silo/android/ui/screens/player/WatchPartyPlayerSupportTest.kt
  • androidApp/src/androidUnitTest/kotlin/org/siloserver/silo/android/ui/screens/watchparty/WatchPartyInviteRouteTest.kt
  • androidApp/src/androidUnitTest/kotlin/org/siloserver/silo/android/ui/screens/watchparty/WatchPartySupportTest.kt
  • androidApp/src/androidUnitTest/kotlin/org/siloserver/silo/android/ui/screens/watchtogether/LobbyAutoNavigateTest.kt
  • androidApp/src/androidUnitTest/kotlin/org/siloserver/silo/android/ui/screens/watchtogether/WatchTogetherEntryDestinationTest.kt
  • androidApp/src/androidUnitTest/kotlin/org/siloserver/silo/android/ui/screens/watchtogether/WatchTogetherEntryViewModelTest.kt
  • androidApp/src/androidUnitTest/kotlin/org/siloserver/silo/android/ui/screens/watchtogether/WatchTogetherLobbyErrorTest.kt
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/SiloTvApplication.kt
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/cast/TvSiloCastPlayerAdapter.kt
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/cast/TvSiloCastReceiver.kt
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/di/AndroidTvModule.kt
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/navigation/TvAppNavigation.kt
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/navigation/TvRoute.kt
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/detail/TvItemDetailScreen.kt
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/player/TvPlaybackRealtimeController.kt
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/player/TvPlayerHud.kt
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/player/TvPlayerScreen.kt
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/player/TvPlayerViewModel.kt
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/player/TvRoomSyncController.kt
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/player/TvVideoPlaybackStarter.kt
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/player/TvWatchPartyPlayer.kt
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/player/TvWatchPartyPlayerOverlays.kt
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/settings/TvSettingsScreen.kt
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/watchparty/TvJoinCodeDialog.kt
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/watchparty/TvWatchPartyComponents.kt
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/watchparty/TvWatchPartyDetailEntry.kt
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/watchparty/TvWatchPartyHubScreen.kt
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/watchparty/TvWatchPartyLobbyScreen.kt
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/watchparty/TvWatchPartyPicker.kt
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/watchparty/TvWatchPartyRoom.kt
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/watchparty/TvWatchPartyStagedItem.kt
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/watchparty/TvWatchPartyStyle.kt
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/watchparty/TvWatchPartyText.kt
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/watchtogether/TvJoinCodeDialog.kt
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/watchtogether/TvSuggestToRoomViewModel.kt
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/watchtogether/TvWatchTogetherDestination.kt
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/watchtogether/TvWatchTogetherEntryDialog.kt
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/watchtogether/TvWatchTogetherLobbyScreen.kt
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/watchtogether/TvWatchTogetherLobbyViewModel.kt
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/watchtogether/TvWatchTogetherMenuEntryDialog.kt
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/watchtogether/TvWatchTogetherViewModel.kt
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/shell/TvMainShell.kt
  • androidTvApp/src/androidUnitTest/kotlin/org/siloserver/silo/tv/ui/components/TvControlWiringCallSiteTest.kt
  • androidTvApp/src/androidUnitTest/kotlin/org/siloserver/silo/tv/ui/screens/player/TvRoomDeliveryKeySourceTest.kt
  • androidTvApp/src/androidUnitTest/kotlin/org/siloserver/silo/tv/ui/screens/player/TvRoomTransportGateTest.kt
  • androidTvApp/src/androidUnitTest/kotlin/org/siloserver/silo/tv/ui/screens/player/TvWatchPartyPlayerTest.kt
  • androidTvApp/src/androidUnitTest/kotlin/org/siloserver/silo/tv/ui/screens/watchparty/TvJoinCodeStateTest.kt
  • androidTvApp/src/androidUnitTest/kotlin/org/siloserver/silo/tv/ui/screens/watchparty/TvWatchPartyTextTest.kt
  • androidTvApp/src/androidUnitTest/kotlin/org/siloserver/silo/tv/ui/screens/watchtogether/LobbyNavigationDecisionTest.kt
  • androidTvApp/src/androidUnitTest/kotlin/org/siloserver/silo/tv/ui/screens/watchtogether/TvWatchTogetherDestinationTest.kt
  • androidTvApp/src/androidUnitTest/kotlin/org/siloserver/silo/tv/ui/screens/watchtogether/TvWatchTogetherLobbyErrorTest.kt
  • androidTvApp/src/androidUnitTest/kotlin/org/siloserver/silo/tv/ui/screens/watchtogether/TvWatchTogetherMenuInitialActionTest.kt
  • androidTvApp/src/androidUnitTest/kotlin/org/siloserver/silo/tv/ui/screens/watchtogether/TvWatchTogetherViewModelTest.kt
  • docs/README.md
  • docs/playback/README.md
  • docs/watch-party-implementation-plan.md
  • scripts/android-playback-test.sh
  • shared/src/androidMain/kotlin/org/siloserver/silo/network/SiloHttpClient.android.kt
  • shared/src/androidMain/kotlin/org/siloserver/silo/util/WallClock.android.kt
  • shared/src/androidMain/kotlin/org/siloserver/silo/watchtogether/SharedPreferencesRecentWatchPartyStorage.kt
  • shared/src/androidUnitTest/kotlin/org/siloserver/silo/model/watchtogether/WatchPartyFixtures.android.kt
  • shared/src/commonMain/kotlin/org/siloserver/silo/RoomSyncEngine.kt
  • shared/src/commonMain/kotlin/org/siloserver/silo/di/NetworkModule.kt
  • shared/src/commonMain/kotlin/org/siloserver/silo/di/RepositoryModule.kt
  • shared/src/commonMain/kotlin/org/siloserver/silo/model/feature/ClientSurfacePolicy.kt
  • shared/src/commonMain/kotlin/org/siloserver/silo/model/playback/PlaybackProtocolV3.kt
  • shared/src/commonMain/kotlin/org/siloserver/silo/model/watchtogether/WatchPartyV2Models.kt
  • shared/src/commonMain/kotlin/org/siloserver/silo/model/watchtogether/WatchTogetherModels.kt
  • shared/src/commonMain/kotlin/org/siloserver/silo/network/SiloHttpClient.kt
  • shared/src/commonMain/kotlin/org/siloserver/silo/network/SiloHttpClientImpl.kt
  • shared/src/commonMain/kotlin/org/siloserver/silo/network/WatchTogetherRealtimeClient.kt
  • shared/src/commonMain/kotlin/org/siloserver/silo/network/WatchTogetherRealtimeEvent.kt
  • shared/src/commonMain/kotlin/org/siloserver/silo/network/api/WatchTogetherApi.kt
  • shared/src/commonMain/kotlin/org/siloserver/silo/repository/WatchTogetherRepository.kt
  • shared/src/commonMain/kotlin/org/siloserver/silo/util/Rfc3339.kt
  • shared/src/commonMain/kotlin/org/siloserver/silo/util/WallClock.kt
  • shared/src/commonMain/kotlin/org/siloserver/silo/viewmodel/WatchPartyViewModels.kt
  • shared/src/commonMain/kotlin/org/siloserver/silo/watchtogether/RecentWatchParty.kt
  • shared/src/commonMain/kotlin/org/siloserver/silo/watchtogether/RoomCatchup.kt
  • shared/src/commonMain/kotlin/org/siloserver/silo/watchtogether/RoomClock.kt
  • shared/src/commonMain/kotlin/org/siloserver/silo/watchtogether/RoomPlaybackBinding.kt
  • shared/src/commonMain/kotlin/org/siloserver/silo/watchtogether/RoomProof.kt
  • shared/src/commonMain/kotlin/org/siloserver/silo/watchtogether/RoomSession.kt
  • shared/src/commonMain/kotlin/org/siloserver/silo/watchtogether/RoomVote.kt
  • shared/src/commonMain/kotlin/org/siloserver/silo/watchtogether/WatchPartyAvailabilityRepository.kt
  • shared/src/commonMain/kotlin/org/siloserver/silo/watchtogether/WatchPartyCapabilities.kt
  • shared/src/commonMain/kotlin/org/siloserver/silo/watchtogether/WatchPartyEligibility.kt
  • shared/src/commonMain/kotlin/org/siloserver/silo/watchtogether/WatchPartyIds.kt
  • shared/src/commonMain/kotlin/org/siloserver/silo/watchtogether/WatchPartyInvitation.kt
  • shared/src/commonMain/kotlin/org/siloserver/silo/watchtogether/WatchPartyLobbyPresentation.kt
  • shared/src/commonMain/kotlin/org/siloserver/silo/watchtogether/WatchPartyPlaybackContext.kt
  • shared/src/commonMain/kotlin/org/siloserver/silo/watchtogether/WatchTogetherEntryGateway.kt
  • shared/src/commonMain/kotlin/org/siloserver/silo/watchtogether/WatchTogetherEntryPolicy.kt
  • shared/src/commonTest/kotlin/org/siloserver/silo/model/feature/ClientSurfacePolicyTest.kt
  • shared/src/commonTest/kotlin/org/siloserver/silo/model/playback/PlaybackProtocolV3Test.kt
  • shared/src/commonTest/kotlin/org/siloserver/silo/model/watchtogether/WatchPartyFixtures.kt
  • shared/src/commonTest/kotlin/org/siloserver/silo/model/watchtogether/WatchTogetherModelsSerializationTest.kt
  • shared/src/commonTest/kotlin/org/siloserver/silo/network/RoomFrameDecoderTest.kt
  • shared/src/commonTest/kotlin/org/siloserver/silo/network/WatchTogetherRealtimeClientTest.kt
  • shared/src/commonTest/kotlin/org/siloserver/silo/network/api/WatchTogetherApiTest.kt
  • shared/src/commonTest/kotlin/org/siloserver/silo/repository/WatchTogetherRepositoryTest.kt
  • shared/src/commonTest/kotlin/org/siloserver/silo/viewmodel/WatchPartyViewModelsTest.kt
  • shared/src/commonTest/kotlin/org/siloserver/silo/watchtogether/RoomCatchupTest.kt
  • shared/src/commonTest/kotlin/org/siloserver/silo/watchtogether/RoomPlaybackBindingTest.kt
  • shared/src/commonTest/kotlin/org/siloserver/silo/watchtogether/RoomSessionTest.kt
  • shared/src/commonTest/kotlin/org/siloserver/silo/watchtogether/WatchPartyAvailabilityAndRecentsTest.kt
  • shared/src/commonTest/kotlin/org/siloserver/silo/watchtogether/WatchPartyEntryRulesTest.kt
  • shared/src/commonTest/kotlin/org/siloserver/silo/watchtogether/WatchPartyLobbyPresentationTest.kt
  • shared/src/commonTest/kotlin/org/siloserver/silo/watchtogether/WatchPartyWireTest.kt
  • shared/src/commonTest/kotlin/org/siloserver/silo/watchtogether/WatchTogetherEntryPolicyTest.kt
  • shared/src/commonTest/resources/watchtogether/v2/SOURCE
  • shared/src/commonTest/resources/watchtogether/v2/capabilities.json
  • shared/src/commonTest/resources/watchtogether/v2/member_state.json
  • shared/src/commonTest/resources/watchtogether/v2/picker.json
  • shared/src/commonTest/resources/watchtogether/v2/room_http.json
  • shared/src/commonTest/resources/watchtogether/v2/socket_connection_replaced.json
  • shared/src/commonTest/resources/watchtogether/v2/socket_pong.json
  • shared/src/commonTest/resources/watchtogether/v2/socket_room_closed.json
  • shared/src/commonTest/resources/watchtogether/v2/socket_snapshot.json
  • shared/src/commonTest/resources/watchtogether/v2/socket_suggestions_update.json
  • shared/src/commonTest/resources/watchtogether/v2/socket_transport_command.json
  • shared/src/commonTest/resources/watchtogether/v2/suggestions_page.json

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-09-25T19:07:12.006522Z e971250 New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quick104 has reached the 50-credit limit for trial accounts. To continue receiving code reviews, upgrade your plan.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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]>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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 Quick104 left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[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)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[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.

Quick104 and others added 2 commits October 5, 2026 20:00
- 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]>
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@silo-kody

silo-kody Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

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

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

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

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]>
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@Quick104
Quick104 merged commit 6e61709 into main Oct 6, 2026
5 checks passed
@Quick104
Quick104 deleted the t3code/review-watch-party-plan branch October 6, 2026 00:33
Comment on lines +98 to +104
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)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kody code-review Bug medium

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,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kody code-review Kody Rules high

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.

​

​

Comment on lines +3490 to +3491
sessionQualityOverride = committed
_roomQualityChanges.tryEmit(Unit)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kody code-review Bug medium

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)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kody code-review Kody Rules critical

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.

​

​

Comment on lines +125 to +127
val entries = remember(state.rows) {
state.rows?.let { it.continueTogether + it.watchlistUnion }.orEmpty().associateBy { it.item.contentId }
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kody code-review Bug medium

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kody code-review Kody Rules high

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.

​

​

Comment on lines +4216 to +4219
if (roomContext?.selectionRevision == refusal.context.selectionRevision &&
_uiState.value.streamUrl == null && _uiState.value.error == null
) {
fail(refusal.message)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kody code-review Bug high

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.

​

​

Comment on lines +429 to +431
val position = startPositionOverride?.takeIf { it.isFinite() && it >= 0.0 }
?: currentSourcePositionSeconds.takeIf { it.isFinite() && it > 0.0 }
?: room.positionSeconds

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kody code-review Bug medium

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.

​

​

Comment on lines +233 to +237
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
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kody code-review Bug high

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.

​

​

Comment on lines +289 to +296
LaunchedEffect(request) {
val result = repository.setSelection(
SetSelectionRequest(
contentId = request.item.contentId,
fileId = request.item.fileId,
libraryId = request.item.libraryId,
),
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kody code-review Bug high

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.

​

​

Comment on lines +660 to +665
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)
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kody code-review Bug high

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"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kody code-review Bug medium

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"
fi
Prompt 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.

​

​

Comment on lines +948 to +955
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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kody code-review Bug high

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") {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kody code-review Bug medium

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)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kody code-review Kody Rules high

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.

​

​

Comment on lines +566 to +571
val serverNow = serverNowMs()
if (serverNow == null) {
scheduleExecution(scheduled)
return
}
pending = null

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kody code-review Bug high

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 = null
Prompt 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.

​

​

Comment on lines +695 to +700
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)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kody code-review Bug medium

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.

​

​

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.

Handle staged Watch Together lobbies before enabling native entry points

1 participant