Commit graph

1 commit

Author SHA1 Message Date
juancarlos.cavero
5a6f428075 fix(alerts): probe the static pool the way the download asks
The watcher fetched the YouTube watch page through each static IP with a
bare httpx client and no cookies. Anonymously, a datacenter IP making ~400
YouTube hits a day is rate-limited into "Sign in to confirm you're not a
bot", so playabilityStatus comes back LOGIN_REQUIRED and the watcher
declared the pool down. Those same IPs were serving every real download
fine, because a download carries YOUTUBE_COOKIES.

Measured in production on 8-sep-2026, all three statics, same minute:

    anonymous (what the watcher did)  -> LOGIN_REQUIRED
    with the download's cookies       -> OK

while proxy_usage showed 119 YouTube jobs routed to HD-static1 in the last
24 h with zero paid bytes. So the page that said "every download costs
money until the statics are back" fired while nothing was being spent, and
it re-nags every 2 h.

CLAUDE.md already recorded this shape for cloud/metering.probe_url_minutes
("The probe also carries YOUTUBE_COOKIES, like the download does"); the
watcher probe never got the same treatment. It does now, parsed once and
cached, and a blob that is not a Netscape cookie file is recognised before
the stdlib prints "http.cookiejar bug!" into the log every 30 minutes.

The paid probe stays anonymous on the cheap HTTP 204: it is billed per GB
and has no reason to carry a session.

The failure detail now names what YouTube actually said
(playabilityStatus: LOGIN_REQUIRED / UNPLAYABLE / ...) instead of blaming
the IP for every case. With cookies configured, LOGIN_REQUIRED means the
session expired and wants rotating, which is not the same problem as a
flagged address and should not read as one.

Claude-Session: https://claude.ai/code/session_01UZGqjYcZyfmKww1gcyKrp5
2026-09-08 11:30:26 +02:00