Skip to content

fix(playback): recover after Aether authorization expires - #204

Merged
Quick104 merged 2 commits into
mainfrom
t3code/fix-playback-auth-expiry-recovery
Aug 27, 2026
Merged

Quick104 merged 2 commits into
mainfrom
t3code/fix-playback-auth-expiry-recovery

Conversation

@Quick104

@Quick104 Quick104 commented Aug 27, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • recognize typed HTTP 401 and AVPlayer authentication failures on committed header-authenticated Protocol V3 loads
  • refresh the account bearer through the existing API transport, then rebuild the same committed plan at the latest source position
  • require a changed Authorization header before reloading and otherwise fall back to the existing bounded Protocol V3 route ladder
  • preserve timeline mapping, queued track changes, seek reanchors, and local seeks made while refresh is in flight

Why

Aether and AVPlayer freeze request headers when an asset is loaded. During long playback, the normal API transport can rotate an expired account token while the active media asset continues using the old bearer. The media request then fails with 401 even though the playback URL and committed plan are still valid.

An earlier pre-Aether fix in #172 addressed signed ?st= media URLs, but that PR closed unmerged and #180 replaced that player path with the current tokenless-media/header-authenticated contract. This implements the equivalent recovery at the current Aether boundary.

Validation

  • xcodegen generate
  • xcodebuild test -project Silo.xcodeproj -scheme Silo -destination 'platform=iOS Simulator,...' -only-testing:SiloTests/AetherPlaybackBoundaryTests CODE_SIGNING_ALLOWED=NO — 43 passed, 1 fixture-dependent skip, 0 failures
  • xcodebuild build -project Silo.xcodeproj -scheme SiloTV -destination 'platform=tvOS Simulator,...' CODE_SIGNING_ALLOWED=NO — succeeded

A full-suite attempt executed 1,140 tests but reported 14 failures in unrelated suites and then hung while Xcode finalized the result bundle. The scoped player suite completed cleanly before and after the final concurrency adjustment.

Summary by CodeRabbit

  • New Features

    • Added automatic recovery for expired playback authorization.
    • Preserves the current playback position when reloading authenticated media.
    • Maintains pending track changes and seek adjustments during recovery.
    • Supports improved position mapping for Protocol V3 playback sessions.
  • Bug Fixes

    • Prevents unnecessary reloads when refreshed authorization is unchanged.
    • Falls back to bounded route recovery when authentication recovery is unavailable.
    • Ensures playback reloads use the correct starting position.

@coderabbitai

coderabbitai Bot commented Aug 27, 2026 •

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

Next included review available in 44 minutes.

View limit details

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

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

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 3311f600-426f-43c1-a9a5-a195e9089374

📥 Commits

Reviewing files that changed from the base of the PR and between 94541f5 and f2d2b97.

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

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 7037986c-5b90-4ac5-9916-4ef09b766c66

📥 Commits

Reviewing files that changed from the base of the PR and between 3168e5e and 94541f5.

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

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


📝 Walkthrough

Walkthrough

Protocol V3 playback now detects expired bearer failures, refreshes credentials, reloads changed streams, and preserves playback position. Load specifications translate source positions to Aether positions. Tests cover recovery classification, reload gating, and timeline translation.

Changes

Protocol V3 recovery

Layer / File(s) Summary
Load specification and position mapping
iosApp/iosApp/Screens/Player/AetherLoadSpec.swift, iosApp/iosApp/Screens/Player/AetherPlaybackController.swift
The load specification classifies bearer expiration, stores aetherStartPosition, and translates valid resumed source positions. The controller passes this position to engine.load.
Authenticated media recovery
iosApp/iosApp/Screens/Player/PlaybackSessionBridge.swift, iosApp/iosApp/Screens/Player/PlayerViewModel.swift
Playback validates the committed session, refreshes credentials, reloads only when authorization headers change, preserves the source position, and restores queued track or seek operations.
Recovery boundary tests
iosApp/Tests/AetherPlaybackBoundaryTests.swift
Tests cover authentication failure classification, unchanged-header rejection, and position translation during credential reload.

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

Merge Risk: ⚪ Minimal · up to 94541

The change adds recovery for expired playback authorization and preserves playback state during refresh. No actionable merge-blocking risk remains after normal checks and review.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 21.05% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 19 functions across 5 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: playback recovery after Aether authorization expiration.
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 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch t3code/fix-playback-auth-expiry-recovery

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

@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: 94541f53a1

ℹ️ 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".

@Quick104
Quick104 merged commit 8224fde into main Aug 27, 2026
1 check passed
@Quick104
Quick104 deleted the t3code/fix-playback-auth-expiry-recovery branch August 27, 2026 12:45

@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: f2d2b97ea7

ℹ️ 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".

Comment on lines +2651 to +2652
} else {
aetherPlaybackController.pause()

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Keep paused reloads reflected as paused

When credential recovery preserves a paused intent, Aether can publish .firstFrame after this pause() call; handleAetherStartupMilestone then invokes handleFileLoaded(), which unconditionally sets both isPlaying and Now Playing to true. Because the engine is already paused, no later state transition is guaranteed to correct the model, leaving controls and progress reports claiming playback is active and potentially requiring two toggle presses to resume. Reconcile the startup milestone with shouldPlayWhenReady (or the engine state) for this paused-load path.

Useful? React with 👍 / 👎.

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