Skip to content

docs(decisions): adr for youtube extraction reliability gating - #1471

Merged
LucasSantana-Dev merged 1 commit into
mainfrom
docs/1468-youtube-extraction-adr
Jun 16, 2026
Merged

LucasSantana-Dev merged 1 commit into
mainfrom
docs/1468-youtube-extraction-adr

Conversation

@LucasSantana-Dev

@LucasSantana-Dev LucasSantana-Dev commented Jun 16, 2026 •

Copy link
Copy Markdown
Owner

What

Records the decision behind #1468 (the #play "No results found" half of the 2026-06-16 voice incident) via /research-and-decide.

Decision (deferred, direction decided): fix YouTube reliability by adding po_token+visitorData to the existing discord-player-youtubei extractor (not a proxy, not OAuth, not an extractor swap), gated on a homelab verification test — because the bot egresses via a residential homelab IP and the decision-critic (artifact-only Opus) flagged "a Node po_token generator works on that IP" as the load-bearing, unverified claim. Escalation path if po_token churns: yt-dlp-as-primary metadata extractor.

This keeps #1468 honest as needs-info (blocked on homelab logs/test) while preserving the rationale so the next operator-assisted session can act immediately.

Process: Phase 1 research (discord-player-youtubei v3 / 2026 YouTube auth landscape), Phase 2 decision-critic → NEEDS_REVISION (gate added), Phase 3 skipped (defer-with-gate), Phase 4 this ADR.

@cubic-dev-ai


Summary by cubic

Adds an ADR documenting the decision for #1468 to improve YouTube extraction reliability by adding po_token + visitorData to the existing discord-player-youtubei extractor, gated on a homelab verification test, with yt-dlp as the escalation path. It also recommends structured logging on youtubei extraction failures to collect evidence and clarify user-facing errors.

Written for commit ad562f8. Summary will update on new commits.

Review in cubic

Records the #1468 decision: fix recurring youtubei "No results found" by
adding po_token+visitorData to the existing extractor (not proxy / oauth /
extractor-swap), deferred behind a homelab verification gate. The
decision-critic (artifact-only) flagged the generator-works-on-residential-ip
claim as unverified, so the commit is gated on a homelab test; escalation path
is yt-dlp-as-primary.

Refs #1468
@vercel

vercel Bot commented Jun 16, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
lucky Ready Ready Preview, Comment Jun 16, 2026 9:10pm

Request Review

@coderabbitai

coderabbitai Bot commented Jun 16, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@LucasSantana-Dev, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 31 minutes and 15 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 4cf8808d-4ab3-410a-8f1b-2da29e169723

📥 Commits

Reviewing files that changed from the base of the PR and between 1a55cdc and ad562f8.

📒 Files selected for processing (1)
  • decisions/2026-06-16-youtube-extraction-reliability.md
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch docs/1468-youtube-extraction-adr

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 and usage tips.

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

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

@github-actions

Copy link
Copy Markdown

Failed to generate code suggestions for PR

@cubic-dev-ai cubic-dev-ai 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.

No issues found across 1 file

Auto-approved: Adds an architecture decision record (ADR) for YouTube extraction reliability, a documentation-only change.

Re-trigger cubic

@sonarqubecloud

Copy link
Copy Markdown

@LucasSantana-Dev
LucasSantana-Dev merged commit 22e7981 into main Jun 16, 2026
42 checks passed
@LucasSantana-Dev
LucasSantana-Dev deleted the docs/1468-youtube-extraction-adr branch June 16, 2026 21:13
LucasSantana-Dev added a commit that referenced this pull request Jun 16, 2026
## What

Closes #1468 — the `#play` "No results found" half of the 2026-06-16
incident.

## Verification reversed the diagnosis

The prior ADR (#1471) guessed po_token / YouTube IP-blocking. I ran the
verification gate from the home network's **residential** egress IP
(same public IP the homelab uses), with the installed
`discord-player-youtubei@3.0.0-beta.4`:

- raw `youtubei.js` `getBasicInfo` (full player) → `playability: OK`,
**26 streaming formats**, no po_token
- the extractor's real path (`discord-player-youtubei` on a real
`discord.js` Client → `Player`, as the bot registers it), **no
po_token**: `watch?v=` URL → 1 track + stream OK; `youtu.be` → 1 track +
stream OK; text search → 19 tracks + stream OK

**→ the IP is not blocked and po_token is not needed.** ADR updated to
record the reversal.

## Actual root cause (`playerFactory.ts`)

Extractor registration is fire-and-forget, and YouTube was sequenced
**behind** an awaited, **un-timed** `play-dl.getFreeClientID()` network
call (play-dl is unmaintained). Registration failures were swallowed by
`warnLog`. So a slow/hung play-dl init or a transient registration
failure — likely right after the ~17:00 restart that also caused the
#1467 auto-join — left the bot with **no YouTube extractor**, and every
`#play <url>` returned "No results found" until restart.

## Fix

- register YouTube **before** the play-dl SoundCloud init (extractor
priority unchanged: Spotify → YouTube → SoundCloud …)
- bound `play-dl.getFreeClientID()` with a 10 s timeout (new
dependency-free `withTimeout` helper)
- retry youtubei registration once; **escalate a final failure to
`errorLog`** so the degraded state is visible instead of silently
swallowed

## Tests

- `withTimeout.ts` covered by 3 new cases in `playerFactory.spec.ts`
(resolve / timeout / propagate-rejection) — 20/20 pass
- existing `playerFactory.test.ts` 11/11 pass; bot type-check clean
- live reproduction above confirms the extractor itself is healthy

@cubic-dev-ai

<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Hardened YouTube extractor registration to stop the “No results found”
regression for `#play`. We register YouTube earlier, bound the `play-dl`
SoundCloud init with a timeout, and added retry + clear error logging to
avoid silent degraded boots.

- **Bug Fixes**
- Register `discord-player-youtubei` before `play-dl` SoundCloud init;
extractor priority unchanged.
  - Add `withTimeout` and bound `play-dl.getFreeClientID()` to 10s.
- Retry YouTube extractor registration once and escalate a final failure
to `errorLog`.
- Updated ADR after verification: `po_token` not needed; added tests for
`withTimeout`.

- **Refactors**
  - Simplified `withTimeout` by removing a dead timer guard.

<sup>Written for commit 2999d59.
Summary will update on new commits.</sup>

<a
href="https://cubic.dev/pr/LucasSantana-Dev/Lucky/pull/1472?utm_source=github"
target="_blank" rel="noopener noreferrer"
data-no-image-dialog="true"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img
alt="Review in cubic"
src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a>

<!-- End of auto-generated description by cubic. -->

This branch was successfully deployed

1 active deployment
Preview — ad562f8e Deployed Jun 16, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant