Skip to content

Fix playlist import: pin YouTubeKit 0.4.9 (ANDROID_VR stream URLs now 403) - #140

Closed
ShawnMadadha wants to merge 1 commit into
mainfrom
claude/youtubekit-0.4.9
Closed

ShawnMadadha wants to merge 1 commit into
mainfrom
claude/youtubekit-0.4.9

Conversation

@ShawnMadadha

Copy link
Copy Markdown
Contributor

Symptom

Import a playlist → every track spins on the loading badge for minutes → every track flips to the orange "retry download" badge.

Root cause

Packages/ContinuityKit/Package.resolved pinned YouTubeKit at 7cc8190 (2026-07-05). That version obtains stream URLs from the ANDROID_VR InnerTube client. Since mid-August 2026 YouTube serves only the first ~1 MB of those URLs and returns HTTP 403 for everything after, with every User-Agent. Our downloader fetches 1 MiB ranges, so chunk #2 of every track 403s → IngestError.streamURLExpired → re-resolve (same client, same result) → scheduleRetry keeps the row .pending through 5 whole-track attempts on the minutes-scale .track curve (that's the long spinner) → .failed.

Upstream fixed this in YouTubeKit 0.4.9 — "Update YouTube Changes (August 2026)": visionOS/web clients + an embed fallback. Its URLs return 206 for every chunk.

Change

  • Package.swift: YouTubeKit exact: "0.4.9" (was branch: "main", which resolved differently per machine and let the app silently fall behind). Package.resolved → 0.4.9 / e5b7d03.
  • Tests/IngestTests/LiveIngestProbeTests.swift: opt-in live-network diagnostic (skipped unless CONTINUITY_LIVE_PROBE=1). Drives the real PreparationQueue for 4 video IDs + 2 search-query tracks and prints every com.continuity.app log line, so the next YouTube change shows its failing stage and exact error in one simulator run.
  • AGENTS.md / CLAUDE.md: the gotcha + diagnosis recipe.

Evidence (iOS Simulator, iPhone 17, this morning)

pinned 7cc8190 0.4.9
live probe, 8 tracks 0/8 ready after 300 s — every attempt prep failed … streamURLExpired 8/8 ready in 143 s, full files, BPM analysed
second 1 MiB range of every audio stream (macOS harness, 4 UAs) c=ANDROID_VR → 403 ×4 c=VISIONOS → 206 ×4

Also: app target builds against 0.4.9 (simulator, 0 new warnings), full ContinuityKit suite passes with the probe skipped by default, app launches and restores its session on the simulator.

An independent multi-agent review of the pipeline reached the same root cause; it also noted that the shared IngestThrottle cool-down stretches how long a permanently-failing track spins (an amplifier, not the cause) — worth a separate follow-up, not needed for the fix.

🤖 Generated with Claude Code

Every imported track resolved, then every ranged download got HTTP 403 →
IngestError.streamURLExpired → re-resolve → 403 again → scheduleRetry kept
the row .pending through 5 whole-track attempts (minutes of spinner) →
.failed (orange retry badge). Reproduced on the iOS Simulator with a live
probe: 0/8 tracks ready, every attempt "prep failed … streamURLExpired".

Root cause: Packages/ContinuityKit/Package.resolved pinned YouTubeKit at
7cc8190 (2026-07-05), whose stream URLs come from the ANDROID_VR InnerTube
client. Since mid-August 2026 YouTube serves only the first ~1 MB of those
URLs and 403s the rest, so the app's 1 MiB ranged downloader dies on chunk
#2 every time, with every User-Agent. Upstream YouTubeKit 0.4.9
("Update YouTube Changes (August 2026)") switches to the visionOS/web
clients plus an embed fallback; its URLs return 206 for every chunk.

- Package.swift: depend on YouTubeKit `exact: "0.4.9"` instead of floating
  on `branch: "main"` (which resolved differently per machine and let the
  app silently fall behind).
- Package.resolved: 0.4.9 / e5b7d03.
- Tests/IngestTests/LiveIngestProbeTests.swift: opt-in live-network probe
  (skipped unless CONTINUITY_LIVE_PROBE=1) that drives the real
  PreparationQueue and prints the failing stage/error per track — the tool
  that found this. With 0.4.9: 8/8 and 6/6 tracks ready on the simulator.
- AGENTS.md / CLAUDE.md: record the gotcha and the diagnosis recipe.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@sanylax2

Copy link
Copy Markdown
Collaborator

learn how to code bum

@sanylax2 sanylax2 closed this Sep 11, 2026
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