Skip to content

fix(player): keep the plan's subtitle after a credential reload - #627

Merged
Quick104 merged 1 commit into
Silo-Server:mainfrom
Rhainland:fix/subtitle-delivery-stops
Oct 6, 2026
Merged

Quick104 merged 1 commit into
Silo-Server:mainfrom
Rhainland:fix/subtitle-delivery-stops

Conversation

@Rhainland

@Rhainland Rhainland commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Related issue: #283, #589
Validation tasks: changes #337 C10

A selected embedded subtitle sometimes stopped mid-playback on direct play, with no error, until another track was picked. A resume that hit an access-token rotation a few seconds in never showed subtitles at all. The cause is the credential reload that runs on every token rotation for a header-authenticated original file: it dropped the plan's subtitle. The reload now keeps it.

Approach

Every token rotation reloads the same Protocol V3 plan in place so Aether picks up the new Authorization header. AetherEngine.load clears the engine's subtitle selection, and the plan's pending subtitle pick was already spent on the first load, so the reload came back with the picker still showing the track checked and nothing selected in the engine.

The credential reload now re-arms the plan's subtitle just before the engine load, after the audio probe. Only a selection the plan owns is re-armed; a local pick, a sidecar this session created and a live AI track keep their own restore paths.

Overlap: #611 (open) stops most direct-play reloads on rotation by refreshing credentials per range request. Audio-only media keeps the reload path there, so this fix still applies after #611; if #611 merges first, the conflict is limited to the reload function.

Validation

  • Unit tests for the re-arm (the plan's subtitle is selected again; a subtitle the plan does not own is left alone): pass.
  • Manual, iPhone simulator: a token refresh during direct play with an embedded subtitle selected kept delivering cues in sync.
  • scripts/ci/check-no-api-v1.sh: pass.
  • All 22 app fixes from this validation run, merged together on main (6242652): the full iOS unit suite ran 2,691 tests. The only failures are ArtworkURLTests.testDeliveryCapabilityOnIOSUsesV2RouteAndResets and ImageSizeCapabilityTests.testResetClearsCapability, which fail the same way on main. tvOS build-for-testing and the macOS build succeed.
  • Local builds used Swift 6.3.3, which needs the ThumbHash type annotations from fix(build): annotate ThumbHash cosine tables so Swift 6.3.3 can type-check them #608 to compile. That change was applied locally and is not part of this PR.

Simulator screenshots (iOS 26.5, tvOS 26.5):

a10-subs

Risks

None identified.

Checklist

  • I read and can explain the complete diff.
  • This pull request addresses one concern.

AI Disclosure

  • Harness: Claude Code, running in T3 Code
  • Tool(s): Claude Code subagents, xcodebuild, Xcode Simulator (simctl, Maestro), GitHub CLI
  • Model(s): claude-opus-5-5
  • Involvement: Fully AI-generated, human verified
  • Adversarial review: A separate Claude Code reviewer agent (claude-opus-5-5) read this branch's diff against main at medium effort, checking behaviour, platform guards (iOS, tvOS, macOS), tests and commit hygiene. No findings. The reviewer noted the tests call the re-arm directly rather than through the load path, and checked the load path by reading it.

Note

Restore the plan's subtitle after a credential reload in PlayerViewModel

  • Fixes subtitle loss on access-token reloads. The reload path now passes reselectsPlanSubtitle: true to loadAether, which re-arms the protocol V3 plan's subtitle after preparation and before beginLoad.
  • Adds PlayerViewModel.armProtocolV3SubtitleIntentForSamePlanReload to rebuild the pending embedded/sidecar/server-rendered subtitle intent for the current plan.
  • Adds PlayerViewModel.protocolV3SubtitleSelectionIsPlanOwned to decide what counts as plan-owned: it rejects local selections, live AI tracks, and sidecars absent from the plan; an off plan only matches a nil selection.
  • Adds tests in PlaybackProtocolV3Tests.swift covering embedded, sidecar, and non-plan-owned subtitle reload behavior.

Macroscope summarized 09a3c6c.

Every access-token rotation on a header-authenticated original file reloads the same Protocol V3 plan in place so Aether picks up the new Authorization header. AetherEngine.load clears the engine's subtitle selection, and the plan's pending subtitle pick was already spent on the plan's first load. The reload therefore came back with the picker still showing the subtitle checked and nothing selected in the engine: cues stopped mid-playback with no error, and a resume that hit a rotation a few seconds in never rendered at all.

The credential reload now re-arms the plan's subtitle just before the engine load, after the audio probe's await. Only a selection the plan owns is re-armed; a local pick, a sidecar this session created, and a live AI track keep their own restore paths.
@coderabbitai

coderabbitai Bot commented Oct 5, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 59 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 2bc64d74-6eb6-4965-abc0-02effb899709
📥 Commits

Reviewing files that changed from the base of the PR and between 6242652 and 09a3c6c.

📒 Files selected for processing (2)
  • iosApp/Tests/PlaybackProtocolV3Tests.swift
  • iosApp/iosApp/Screens/Player/PlayerViewModel.swift
  • 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.

@silo-kody

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

@Rhainland Rhainland mentioned this pull request Oct 5, 2026
11 tasks
@Quick104
Quick104 merged commit cff06c4 into Silo-Server:main Oct 6, 2026
6 checks passed
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.

2 participants