Skip to content

fix(playback): reload rotated media authorization - #236

Merged
Quick104 merged 1 commit into
mainfrom
t3code/diagnose-playback-loading-icon
Sep 3, 2026
Merged

Quick104 merged 1 commit into
mainfrom
t3code/diagnose-playback-loading-icon

Conversation

@Quick104

@Quick104 Quick104 commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Protocol V3 playback freezes its Authorization header when Aether creates the media asset. A periodic progress request can refresh the account bearer successfully while the active media reader continues using the old bearer. In the production tvOS capture, that sequence led to repeated media 401 responses, a generic Aether read failure, and a loading indicator that never recovered.

The app already had bounded same-plan recovery for typed authentication failures, but the current Aether reader does not preserve a midstream HTTP 401 through its VOD failure path. The client therefore could not recognize this specific failure in time.

I audited upstream Aether from the pinned 6.34.0 lineage through 6.64.0. None of those changes adds midstream bearer refresh or preserves a VOD media 401 as a typed authentication failure. The relevant comparison is blurbery/AetherEngine@6.34.0...6.64.0.

Solution

After each successful periodic progress report, rebuild the current authenticated stream request and compare its Authorization header with the header on the active Aether load. If the bearer changed, reuse the existing bounded same-plan authentication reload at the current playback position.

The reload remains limited to negotiated header-authenticated Protocol V3 playback, revalidates the active plan and session after suspension points, and keeps the existing reactive 401 recovery path. Failed progress reports and unchanged credentials do not trigger a reload.

This PR does not update the Aether dependency.

Validation

  • Regenerated the Xcode project with xcodegen.
  • Ran AetherPlaybackBoundaryTests on an iPhone 17 Pro simulator: 49 tests executed, 1 existing skip, 0 failures.
  • Built the SiloTV scheme for the Apple TV 4K simulator successfully.
  • Ran git diff --check successfully.
  • Completed the required ponytail review: Lean already. Ship.

Risk and follow-up

The proactive reload can cause one brief playback interruption when a bearer rotates, but only after the API transport has successfully refreshed it and only when the active media header differs. A future Aether release that exposes typed midstream HTTP failures could make the proactive check unnecessary, but 6.64.0 does not.

AI disclosure

Developed with OpenAI Codex model gpt-5.6-sol in the T3 Code Codex harness. Claude Opus through CLIProxy was consulted during diagnosis but returned no usable assessment. Validation used XcodeGen, xcodebuild, Git, and GitHub CLI.

Summary by CodeRabbit

  • Bug Fixes
    • Improved playback recovery when streaming authorization expires or changes.
    • Playback can now refresh credentials proactively after successful progress updates, helping prevent interruptions.
    • Avoids unnecessary reloads when credentials remain unchanged.
    • Handles missing sessions and temporary progress-check failures without triggering inappropriate reloads.

@coderabbitai

coderabbitai Bot commented Sep 3, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Team

Run ID: 099c1823-b446-4aa1-ad32-573f24fd7aa6

📥 Commits

Reviewing files that changed from the base of the PR and between 7e49733 and 8546852.

📒 Files selected for processing (3)
  • iosApp/Tests/AetherPlaybackBoundaryTests.swift
  • iosApp/iosApp/Screens/Player/AetherLoadSpec.swift
  • iosApp/iosApp/Screens/Player/PlayerViewModel.swift

Included review availability: 4 reviews are currently available. Your included PR review attempts over the past 7 days set your current allowance at 5 reviews per hour.


📝 Walkthrough

Walkthrough

Protocol V3 playback recovery now evaluates authorization-header rotation after periodic progress checks. Successful checks can reuse refreshed stream requests for reloads, while unchanged credentials, missing sessions, and transient failures do not reload.

Changes

Protocol V3 authentication recovery

Layer / File(s) Summary
Recovery policy and validation
iosApp/iosApp/Screens/Player/AetherLoadSpec.swift, iosApp/Tests/AetherPlaybackBoundaryTests.swift
shouldReloadAfterProgress requires successful progress and changed authorization headers. Tests cover unchanged credentials, missing sessions, and transient failures.
Progress-triggered recovery orchestration
iosApp/iosApp/Screens/Player/PlayerViewModel.swift
Periodic progress results invoke Protocol V3 recovery. Recovery validates playback state, session data, media capability, committed epoch, and refreshed request state.
Reload request execution
iosApp/iosApp/Screens/Player/PlayerViewModel.swift
Reloads validate supplied headers, avoid redundant credential refreshes, use refreshed stream requests when provided, and distinguish expiration from proactive rotation in logs.

Estimated code review effort: 4 (Complex) | ~45 minutes

Merge Risk: ⚪ Minimal · up to 85468

Protocol V3 playback now reloads the active stream at the current position after a successful progress report detects a rotated authorization bearer. The supplied validation and boundary coverage indicate failed reports and unchanged credentials do not trigger reloads, with no outstanding merge-readiness risk identified.

Sequence Diagram(s)

sequenceDiagram
  participant PeriodicProgressReporter
  participant ProtocolV3AuthenticationRecovery
  participant shouldReloadAfterProgress
  participant ReloadTask
  PeriodicProgressReporter->>ProtocolV3AuthenticationRecovery: report progress result
  ProtocolV3AuthenticationRecovery->>shouldReloadAfterProgress: evaluate progress success and header changes
  shouldReloadAfterProgress-->>ProtocolV3AuthenticationRecovery: return reload eligibility
  ProtocolV3AuthenticationRecovery->>ReloadTask: start reload with refreshed stream request
Loading

Suggested reviewers: blurbery

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 10 functions across 3 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: reloading playback when media authorization rotates.
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.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch t3code/diagnose-playback-loading-icon

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

@chatgpt-codex-connector

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-09-03T22:52:11.341293Z 8546852 PR opened
ℹ️ 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.

@Quick104
Quick104 merged commit 5f5e4cf into main Sep 3, 2026
4 checks passed
@Quick104
Quick104 deleted the t3code/diagnose-playback-loading-icon branch September 3, 2026 23:45
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.

1 participant