Skip to content

fix(tv): name the TV by its device name when it asks to sign in - #746

Merged
Quick104 merged 3 commits into
mainfrom
fix/issue-740-tv-device-name
Oct 31, 2026
Merged

Quick104 merged 3 commits into
mainfrom
fix/issue-740-tv-device-name

Conversation

@Quick104

@Quick104 Quick104 commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Closes #740
Related issue: Silo-Server/silo-server#1192
Validation tasks: changes #337 C1 and C2 (what the browser page and phone cards call the TV); both are not run yet.

An Android TV shows the name its owner gave it ("Living Room TV") on its own screens, but it uses the hardware model when it talks to anyone else. The browser approval page asked "Sign in sdk_google_atv64_arm64?", and phone cards said "Set Up sdk_google_atv64_arm64". On real hardware that would be the product model. Apple TV and Roku use the name the person chose, so a household with more than one TV can tell which one it's approving.

Approach

A small helper, TvDeviceName, reads Android TV's device name (Settings.Global.DEVICE_NAME) and falls back to "Android TV". That's the same rule the setup screen's chip already used. It cuts a name longer than 63 UTF-8 bytes on a character boundary. A DNS-SD service name can't be longer: Android 14 cuts it, and older releases refuse to register it, which would hide the TV from phones. Cutting once keeps every place showing the same name. Every place the TV names itself now uses it:

  • the sign-in code request (device_name), so the server, the /activate page, and phone approvals show it;
  • the setup and sign-in adverts (the service name and the TXT name) and the pairing hello's identity;
  • the SiloCast advert, remote-playback sign-in, and the SiloCast receiver's hello;
  • the setup screen's chip.

The X-Silo-Device-Name header on every request still sends the manufacturer and model. Apple sends the device name there too. But OkHttp rejects header values with non-ASCII characters, so a TV named "Café TV" or "Nathan’s TV" would fail every request. That needs header encoding first, so it's left out of this change.

Validation

Reproduced live on an Android TV emulator (Android 14), with its device name set to "Living Room TV", against a dev server. Before (main at 238134a): the request stored device_name = sdk_google_atv64_arm64, /activate asked "Sign in sdk_google_atv64_arm64?", and both adverts were named sdk_google_atv64_arm64. After: the request stores Living Room TV, /activate asks "Sign in Living Room TV?", and both adverts (st=setup and st=login) are named Living Room TV. The adverts were read from dumpsys servicediscovery on the TV. With a 78-byte name (accents, a typographic apostrophe, and an emoji), the stored request and both adverts used the same 63-byte cut, and both adverts registered. No phone was paired in this run, so the phone card wasn't captured. It shows the advert's name, which the check covered.

:androidTvApp:testDebugUnitTest, :android-shared:testDebugUnitTest, lintDebug for both modules, and :androidTvApp:lintVitalRelease passed with no new findings. No new tests, per AGENTS.md for small changes.

Evidence

Evidence: https://evidence.siloserver.org/r/silo-android/issue-740/

Android TV emulator only. The phone app doesn't run any of the changed code.

Risks

  • A TV whose owner never named it keeps the platform's default name, which on many TVs is the model anyway.
  • This touches one line in TvPairingAdvertiser.kt and the TvLoginViewModel wiring in AndroidTvModule.kt, which other open TV pairing work also edits. Whichever lands second needs a small rebase.

Follow-ups

  • Send the device name as X-Silo-Device-Name once non-ASCII header values are encoded, so session lists match too.

AI Disclosure

  • Harness: Claude Code (in T3 Code)
  • Tool(s): Claude Code; agent-device and adb on a temporary Android TV emulator; headless Chromium for the browser capture
  • Model(s): claude-opus-5-5
  • Involvement: AI-assisted: the agent reproduced the issue, wrote the change, and ran the emulator checks
  • Adversarial review: the plan round was skipped because the fix is mechanical: one source for a name that was read in five places. A background adversarial review by gpt-6.1-sol is running.

🤖 Generated with Claude Code

Note

Use configured Android TV device name in pairing, cast, and login identity

  • Adds a shared TvDeviceName utility that reads the configured Android TV name from global settings (API 25+), with a generic fallback when unavailable
  • Names are trimmed and truncated to 63 UTF-8 bytes at Unicode code-point boundaries, with no code point split; covered by new unit tests in TvDeviceNameTest.kt
  • Replaces the device-model-based name sources in SiloCastNsdAdvertiser, TvPairingAdvertiser, TvLoginViewModel.kt, and the Koin module, so the TV identifies itself by its user-configured name
  • Behavioral Change: advertised service names and pairing identities switch from device model to configured TV name; check currentIdentity in TvPairingAdvertiser.kt and the advertiser default in SiloCastNsdAdvertiser.kt

Macroscope summarized 36a5313.

The sign-in code request, the setup and sign-in adverts, the pairing
identity, and the SiloCast advert used the hardware model, so the browser
approval page and phone cards said "sdk_google_atv64_arm64" while the TV's
own chip said the name the person gave it. All of them now read the same
Android TV device name the chip shows, as Apple TV does.

Closes #740

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 30, 2026
@coderabbitai

coderabbitai Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

  • Ask an admin to enable usage-based reviews

Open in CodeRabbit

Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing.

Next included review available in 18 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 128 included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 2fbb3b0c-5e2f-4591-a466-293d11bae383
Commits

Reviewing files that changed from the base of the PR and between 238134a and 36a5313.

Files selected for processing: 7
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/cast/SiloCastNsdAdvertiser.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/pairing/TvDeviceName.kt
  • android-shared/src/androidMain/kotlin/org/siloserver/silo/common/pairing/TvPairingAdvertiser.kt
  • android-shared/src/androidUnitTest/kotlin/org/siloserver/silo/common/pairing/TvDeviceNameTest.kt
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/di/AndroidTvModule.kt
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/auth/TvLoginViewModel.kt
  • androidTvApp/src/androidMain/kotlin/org/siloserver/silo/tv/ui/screens/auth/TvServerSetupScreen.kt
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 30, 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 ✅ Completed 2026-10-30T23:11:25.452998Z 36a5313 New commits
🔒 Security Review ✅ Completed 2026-10-30T23:12:56.457618Z 36a5313 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.

@silo-kody

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

@silo-triage silo-triage Bot added bug Something isn't working evidence-required Needs before-and-after evidence before the Evidence check passes impact: polish Annoyance, cosmetic, or nice-to-have priority: P2 Limited scope, workaround exists, or polish labels Oct 30, 2026
@silo-triage

silo-triage Bot commented Oct 30, 2026

Copy link
Copy Markdown

The browser captures show the name change, but the PR also changes what nearby phones display in the TV setup and sign-in cards. The validation section says neither phone card was captured; checking the advertised name does not show those visible results. Please add before-and-after captures of the affected phone cards using the same TV name. The phone surface is affected even though its code is unchanged.

AI disclosure: Silo Triage via OpenClaw; model openai/gpt-6.1-sol. Triage only; no code execution.

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

Adversarial review (gpt-6.1-sol, reviewed b5ec9f3)

Two verified findings below. Verification used the pinned client source, Android platform source, the server contract, and UTF-8 boundary checks; no device reproduction was performed for these cases.

AI disclosure: model gpt-6.1-sol; harness Codex in T3 Code; AI-generated review.

The pairing and SiloCast adverts use the device name as their service
name, which holds 63 UTF-8 bytes. Android 14 cuts a longer one; older
releases refuse to register it, which would hide the TV from phones. Cut
the name once, on a character boundary, so every place shows the same
name.

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

silo-kody Bot commented Oct 30, 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 ❌
⚠️ 4 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:

  • Validate download ownership before publishing subtitle bytes
  • Bind playback markers to the actual playing file
  • Share route-aware audio decisions and preserve original-format decoder fallback
  • Apply playback route eligibility consistently at admission and media loading

@macroscopeapp

macroscopeapp Bot commented Oct 30, 2026

Copy link
Copy Markdown

The changed names reach phone UI even though the phone app does not execute the changed code: TvPairingAdvertiser.kt changes the name shown on nearby setup/sign-in cards, TvLoginViewModel.kt changes the name on device-login approval cards, and SiloCastNsdAdvertiser.kt changes the name in the SiloCast target picker. The PR describes TV/emulator and browser validation but says no phone card was captured.

  • Nearby setup/sign-in cards — missing Android phone, tablet, and foldable captures (folded and open); add before-and-after screenshots of the same card and TV name on each form factor.
  • Device-login approval card — missing Android phone, tablet, and foldable captures (folded and open); add before-and-after screenshots of the same approval screen and test data on each form factor.
  • SiloCast target picker — missing Android phone, tablet, and foldable captures (folded and open); add before-and-after screenshots of the same picker and TV target on each form factor.

Suggested fix: No diff; add these captures to the linked evidence collection.

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

Posted via Macroscope — Visible change evidence

@silo-kody

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

@Quick104

Copy link
Copy Markdown
Contributor Author

Evidence updated: phone, tablet and foldable (folded and open) before/after captures of the TV's name on the nearby-TV offer card, the in-app Sign in a TV approval card and the SiloCast target picker. Devices: Pixel 8 phone, Pixel Tablet and Pixel Fold emulators (API 34) with an Android TV emulator named Living Room TV. Before is TV main at 76dee90ad, after is 36a531309; the phone build is main in both. Discovery between the emulators was relayed.

@Quick104
Quick104 merged commit bd6ade4 into main Oct 31, 2026
10 checks passed
@Quick104
Quick104 deleted the fix/issue-740-tv-device-name branch October 31, 2026 19:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working evidence-required Needs before-and-after evidence before the Evidence check passes 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug] Android TV sign-in shows the hardware model instead of the TV's name

1 participant