Skip to content

feat(remote): name the title when an iPhone hands off to a TV - #858

Merged
Quick104 merged 12 commits into
mainfrom
feat/silocontrol-offer-title
Oct 21, 2026
Merged

Quick104 merged 12 commits into
mainfrom
feat/silocontrol-offer-title

Conversation

@Quick104

@Quick104 Quick104 commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Related issue: N/A
Validation tasks: none

When an iPhone or iPad sends a title to an Android TV, the TV shows "Starting playback" while the phone's profile handoff runs. Android phones send the title in the handoff offer, so the same TV shows "Starting Torch Song Trilogy" for them. Apple phones never filled the offer's optional title.

The iPhone and iPad now send it with the same wording as Android.

Approach

SiloControlHandoffOffer gains the optional, display-only title that silo-android already defines. SiloControlOfferTitle builds it the way Android's castDisplayTitle does: an episode is "Series · S1 · E2", and anything else uses its own title.

The phone takes the item detail from the response cache, or fetches it while it waits for the TV's version and the server's endpoints. As on Android, a lookup slower than 300 ms is dropped, so a slow lookup never delays the handoff. Omitting the field changes nothing for older TVs. The Apple TV ignores it because it has no "Starting" screen.

Stacked on #856.

Validation

  • iOS SiloTests, all four SiloControl suites on a fresh simulator: 71 tests pass, including the new title and wire tests. The phone policy suite passed again (11 tests) after a readability edit.
  • tvOS SiloTVTests, SiloControl multi-controller and wire suites on a fresh simulator: 44 tests pass.
  • macOS SiloMac build: succeeded.
  • iPhone simulator with an Android TV emulator running silo-android's multi-controller receiver: the feat(remote): let several devices control one Apple TV #856 build shows "Starting playback". This branch shows "Starting Torch Song Trilogy", and playback started.

Evidence

Evidence: https://evidence.siloserver.org/r/silo-apple/pr-858/

Surface and build: Android TV emulator during a handoff from an iPhone simulator. Before: #856 at 0a6c0414. After: this branch. The iPhone's own screens don't change, so there are no iPhone, iPad, iPhone Duo or Mac captures. The Mac app doesn't include the remote.

Risks

None identified. The field is optional and display-only, and every shipped decoder ignores unknown fields.

Checklist

  • I read and can explain the complete diff.
  • This pull request addresses one concern.
  • The Evidence section shows every change a user can see, or says there is none.

AI Disclosure

  • Harness: Claude Code in T3 Code
  • Tool(s): Claude Code, GitHub CLI, XcodeGen, xcodebuild, Android emulator and adb
  • Model(s): claude-opus-5-5
  • Involvement: Fully AI-generated; human verification of the diff is pending
  • Adversarial review: n/a, a small additive field checked against silo-android's existing definition

🤖 Generated with Claude Code

Note

Add display title to SiloControlHandoffOffer when a phone hands off to a TV

  • When an iPhone sends a handoff offer to a TV, the offer now carries an optional display title for the content (episode naming uses series, season, and episode labels; non-episodes fall back to their title)
  • SiloControlClient.prepareRemoteIdentity now receives the requested content identifier and awaits a title lookup before sending the offer, via a new offerTitle helper in SiloControlClient.swift
  • The lookup checks cached item details first, otherwise starts an item-detail API request raced against a 300 ms timeout (offerTitleWait); a nil title omits the field from the JSON payload
  • A new FirstResult continuation helper resumes the race exactly once; older peers can ignore the optional field since it defaults to nil
  • Risk: offers wait up to 300 ms longer during handoff preparation — check prepareRemoteIdentity and the offerTitle timeout path if handoffs feel delayed

Macroscope summarized 59cb560.

Quick104 and others added 10 commits October 20, 2026 12:51
The Apple TV kept one SiloControl session and evicted it whenever another
device connected. Two people with the app open kept kicking each other off
(a phone's silent auto-resume was enough), and an integration such as Home
Assistant couldn't stay connected without taking over the remote.

The receiver now keeps up to 8 controllers, each with its own connection,
heartbeat and authorization. The player, the temporary phone identity, the
one in-flight handoff and the standby screen are shared:

- State goes to every authorized controller; errors only to the sender.
- A new connection from the same device replaces its older socket. At the
  cap, a connection that never said hello goes first, then the oldest
  passive one; otherwise the newcomer is refused.
- Launch readiness belongs to one controller and one identity generation,
  so an earlier phone can never launch under a later phone's profile. A
  newer handoff supersedes a pending one.
- Reusing an identity without approval needs the connection that set it up
  or a resume token, not a matching self-reported device ID.
- A handoff that would replace a title another profile started is refused
  with `replace_confirmation_required` and what is playing, so the phone can
  ask and resend with `replaceConfirmed`.
- Passive controllers never show the standby screen, and the TV's
  Disconnect leaves them connected.
- Per-controller command rate limit, per-controller reauthorization after
  the identity changes, and an unused identity is handed back even if its
  phone already left.

Every wire addition is optional and gated on hello `features`. Phones that
don't list them keep today's behavior, including newest-launch-wins, and
never receive a close reason or other new payload.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The Apple TV can now keep several controllers connected, but the phone
still behaved as the only one: it toggled play/pause, treated every close
as a takeover, could not answer the TV's request to confirm a replace, and
its silent auto-resume looked like an active remote to the TV.

The phone now:

- Lists `close_reason`, `resume_token` and `replace_confirmation` in its
  hello, and marks a silent auto-resume `passive` so it never puts up the
  TV's standby screen. Once the user engages, it sends `presence` (new,
  only to TVs that list it) so the TV treats it as an active remote again.
- Follows the TV's close reason when the TV keeps several controllers: a
  timeout reconnects, Disconnect forgets the TV, the rest end the session
  but keep the TV for a later foreground. Older TVs keep today's handling.
- Keeps the resume token from `handoff_ready` in memory and offers it on a
  later connection to the same TV, server and profile.
- Asks "Replace What's Playing?" when the TV reports another profile's
  title, naming who is watching what, and resends with `replaceConfirmed`.
- Sends `play` or `pause` for what the remote shows instead of
  `play_pause`, so two people pressing at once don't cancel out.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The phone already asks "Replace what's playing?" before sending a different
title to an engaged TV. Confirming it didn't tell the TV, so the TV's new
replace check refused the launch and the phone asked a second time.

The router's remote playback interceptor now carries whether the user
confirmed, and confirming the existing dialog launches with
replaceConfirmed set. The TV still asks when the phone didn't: resuming the
same title another profile is watching, or a controller that isn't a Silo
phone.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…sent to a title

Fixes from an independent review of the multi-controller receiver.

- A phone whose handoff another device's play superseded keeps its session
  and shows the TV's message, instead of disconnecting.
- A replace confirmation now names the title the user agreed to replace
  (`replacingContentId`). If a different title started while they decided,
  the TV asks again.
- Sending a title from a silently resumed session marks it active through
  `presence`.
- The capacity refusal's `close` carries `too_many_controllers`, so the
  refused phone doesn't forget the TV. Shipped decoders ignore the payload.
- At the cap, an idle cross-server controller goes before passive ones;
  nothing else timed it out.
- A same-device hello replaces older sockets only once the TV keeps it, so a
  refused hello can't close a working connection.
- A cross-server phone whose own profile ended no longer gets a misleading
  server-mismatch error.
- The 500 ms state timer runs only while an authorized controller is
  connected, as before this branch.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…pping the connection

SiloControlMessage decoded `type` through a closed enum, so a frame with a
type this build doesn't know threw, and FramedJSONSession tore the whole
connection down on that decode error. Any message a newer peer adds would
end the session on older Apple builds. Android already drops unknown types.

Unknown types now decode to `.unsupported(type:)`, which TVControlReceiver
and SiloControlClient log and ignore. A known type with a malformed payload,
or a frame with no `type`, is still a decode error. The v2-only checks in
TVControlReceiver and SiloControlClient.prepareRemoteIdentity now accept any
negotiated version from 2 up.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…aces it

On Apple TV, Play on a detail page (also how Continue Watching starts)
pushes the player as a navigation route. The remote receiver stopped
playback by clearing `router.presentedPlayer`, which only closes the cover,
so a pushed player kept playing. Its cleanup never ran: a phone's Stop left
it on screen while the receiver reported Ready, and a handoff waited about a
second for that cleanup, swapped the profile under the live player, and then
showed the phone's title on top of it. The hidden player kept failing its
progress reports with `authority_changed`, and Menu brought it back.

The receiver now calls `PlayerViewModel.stopAndClose()`, which runs
`cleanup()` at once and asks the view to close itself, as the server's
realtime stop already does. That works for a cover and a pushed route, and
the handoff's wait now covers the real server-session teardown.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…fs at the cap

From review on #856.

- A handoff checked for another profile's title only when the offer
  arrived. While the server approved it, another controller could start a
  title, and the swap then stopped that title without asking. The check now
  runs again just before playback stops; if consent is now needed, the
  controller gets `replace_confirmation_required` with the current title.
- At the controller cap, a passive controller in the middle of a handoff
  is no longer evicted, which cancelled its handoff.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… away

When a multi-controller TV closed a session without forgetting it, for
example because it was full, it sent the reason as an error and then a
close, and the phone hid the remote cover while clearing the session. The
user tapped Play and saw nothing. The phone now keeps an open cover up
with the TV's error, as it does when a reconnect gives up. A TV Disconnect
still forgets the TV and closes the cover.

From review on #856.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The replace prompt names who is watching. Under a borrowed identity with no
profile name, which is every handoff from today's Android phones, the TV fell
back to its own signed-in profile and named the wrong person. Under a
borrowed identity the TV now uses only that identity's name, and the prompt
says "Someone" when it has none.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
An Android TV shows "Starting <title>" while a phone's profile handoff
runs, from the offer's display-only `title`. Android phones send it;
iPhones and iPads didn't, so the TV said "Starting playback".

The phone now sends the same wording silo-android does: an episode as
"Series · S1 · E2", anything else by its title. It reads the cached item
detail, or fetches it alongside the endpoints lookup and drops it after
300 ms, as Android does, so the offer is never held up. The field is
optional; the Apple TV ignores it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@silo-triage silo-triage Bot added the size/M 50–199 added + deleted lines (all files); change volume, not priority. label Oct 20, 2026
@coderabbitai

coderabbitai Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 362b62e0-2711-4e55-a15f-98b3cd1213d4
📥 Commits

Reviewing files that changed from the base of the PR and between 4bcd49c and 59cb560.

📒 Files selected for processing: 4
  • iosApp/Tests/SiloControlTests.swift
  • iosApp/iosApp/Control/SiloControlProtocol.swift
  • iosApp/iosApp/Control/iOS/SiloControlClient.swift
  • iosApp/iosApp/Control/iOS/SiloControlPhonePolicy.swift

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

📝 Walkthrough

The iOS app now resolves an optional display title for remote handoff offers. It uses cached item details or a bounded lookup, formats the title, and includes it in the offer.

Changes: Handoff offer titles

Layer / File(s) Summary
Format content titles
iosApp/iosApp/Control/iOS/SiloControlPhonePolicy.swift, iosApp/Tests/SiloControlTests.swift
SiloControlOfferTitle formats episode titles from available metadata and uses nonblank titles for other media types. Tests cover formatting and fallback cases.
Resolve and encode handoff titles
iosApp/iosApp/Control/SiloControlProtocol.swift, iosApp/iosApp/Control/iOS/SiloControlClient.swift, iosApp/Tests/SiloControlTests.swift
SiloControlHandoffOffer adds an optional title. SiloControlClient resolves it alongside endpoint discovery, using cached details or a lookup with a 300 ms timeout. Tests verify encoding with and without a title.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant PlaybackRequest
  participant SiloControlClient
  participant ItemDetailLookup
  participant SiloControlOfferTitle
  participant SiloControlHandoffOffer
  PlaybackRequest->>SiloControlClient: Provide content ID
  SiloControlClient->>ItemDetailLookup: Start title lookup alongside endpoint discovery
  alt Cached item details available
    ItemDetailLookup-->>SiloControlClient: Return cached details
  else No cached item details
    ItemDetailLookup->>ItemDetailLookup: Request details with 300 ms timeout
    ItemDetailLookup-->>SiloControlClient: Return details or nil
  end
  SiloControlClient->>SiloControlOfferTitle: Build display title from details
  SiloControlOfferTitle-->>SiloControlClient: Return optional title
  SiloControlClient->>SiloControlHandoffOffer: Include optional title
Loading
Merge Risk: ⚪ Minimal · up to 59cb5

The optional handoff title does not change playback, and no actionable issue remains before merge.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 22.22% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 9 functions across 4 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly describes the main change: adding a display title when an iPhone hands off content to a TV.
Description check Passed The description directly explains the optional handoff title, title formatting, lookup behavior, compatibility, testing, and validation results.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · 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.

@silo-triage silo-triage Bot added enhancement New feature or request impact: polish Annoyance, cosmetic, or nice-to-have priority: P2 Limited scope, workaround exists, or polish stacked Stacked on another open PR or branch labels Oct 20, 2026
@Quick104
Quick104 deleted the branch feat/silocontrol-multi-controller-receiver October 21, 2026 00:22
@Quick104 Quick104 closed this Oct 21, 2026
@Quick104 Quick104 reopened this Oct 21, 2026
@Quick104
Quick104 changed the base branch from feat/silocontrol-multi-controller-receiver to main October 21, 2026 00:23
@silo-triage silo-triage Bot added size/XXL 1000–2999 added + deleted lines (all files); change volume, not priority. and removed size/M 50–199 added + deleted lines (all files); change volume, not priority. labels Oct 21, 2026
…r-title

# Conflicts:
#	iosApp/Tests/SiloControlTests.swift
#	iosApp/iosApp/Control/iOS/SiloControlClient.swift
#	iosApp/iosApp/Control/iOS/SiloControlPhonePolicy.swift
@silo-triage silo-triage Bot added size/M 50–199 added + deleted lines (all files); change volume, not priority. and removed size/XXL 1000–2999 added + deleted lines (all files); change volume, not priority. labels Oct 21, 2026
@silo-kody

silo-kody Bot commented Oct 21, 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 ❌

@macroscopeapp

macroscopeapp Bot commented Oct 21, 2026

Copy link
Copy Markdown

Evidence is incomplete for visible Apple-platform changes. The linked evidence is described as an Android TV emulator comparison, which covers the new handoff title but not these changed app surfaces:

  • The new “Replace What's Playing?” confirmation in SiloControlRemoteView reaches iPhone, iPhone Duo (folded and open), and iPad. Add a recording of the confirmation-and-retry flow on each form factor.
  • TVControlStandbyState changes the Apple TV standby label when multiple controllers are waiting. Add before-and-after captures of that screen on Apple TV, showing the controller count.
  • TVControlReceiver.stopRemotePlayback() now stops and dismisses an existing Apple TV player on remote Stop or handoff. Add a recording showing the playback/route change on Apple TV.

Automated check: Macroscope check run agent (gpt-6-luna). Evidence was not reviewed for correctness.

Posted via Macroscope — Visible change evidence

@macroscopeapp

macroscopeapp Bot commented Oct 21, 2026

Copy link
Copy Markdown

The iOS handoff now supplies a title that the receiving Android TV can display while the handoff runs. The evidence link describes Android TV emulator before/after captures triggered from an iPhone simulator, but does not identify a recording; because this is a multi-step handoff flow, please ensure the evidence page includes a recording of it. The iOS path also runs on iPhone Duo folded and open, and iPad, though their own screens do not change. Apple TV ignores the title, and the Mac app does not include this remote.

Suggested fix: Add a recording showing the Android TV emulator during a handoff initiated from an iPhone simulator.

Automated check: Macroscope check run agent (gpt-6-luna). Evidence was not reviewed for correctness.

Posted via Macroscope — Visible change evidence

The 300 ms wait for the offer's display title used a task group, which
waits for every child before returning, even a cancelled one. A lookup
that didn't stop promptly on cancellation (an image-capability probe
behind itemDetail) could still delay the offer. The first of the lookup
and the deadline now resumes the offer; the lookup is cancelled and not
awaited.

Episode detection uses the shared SiloMediaType.isEpisode, so the
"episodes" alias and case variants get the series wording too.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@silo-kody

silo-kody Bot commented Oct 21, 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 ❌
⚠️ 3 Kody Rule(s) were not evaluated

These rules declare that they need repository context beyond this diff, and the review could not retrieve it, so they were not judged on this pull request:

  • Centralize server-relative authentication path validation
  • Enforce latest-link-wins centrally across deferred deep links
  • Rank subtitles using container capabilities and one stable cross-client policy

@Quick104

Copy link
Copy Markdown
Contributor Author

Evidence updated (same link):

@Quick104
Quick104 merged commit fffcc1e into main Oct 21, 2026
10 checks passed
@Quick104
Quick104 deleted the feat/silocontrol-offer-title branch October 21, 2026 01:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request impact: polish Annoyance, cosmetic, or nice-to-have priority: P2 Limited scope, workaround exists, or polish size/M 50–199 added + deleted lines (all files); change volume, not priority. stacked Stacked on another open PR or branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant