# New-API relay farm: wave ops (regfarm/github_oauth) Farm location: `C:/Users/User/tmp/regfarm/github_oauth` — registers GitHub accounts onto free New-API relay panels via per-panel GitHub OAuth apps. GHSession goes through a rotating proxy pool; panels are hit DIRECT (panel-side 403s proxy IPs). ## Pre-wave checklist 1. **Smoke-test existing pool keys before treating the pool as an asset.** Free relay panels periodically purge/revoke user tokens — an entire aggregated pool (30 panels, ~1000 keys) can go 401 `Invalid token` in days. Test 2-3 keys per panel with `POST /v1/chat/completions` (cheap model). Keys in pool CSVs are often stored WITHOUT the `sk-` prefix — auth needs `Bearer ***`, try both forms before declaring a key dead. 2. **Regenerate `_gh_proxies.json`:** select `alive=1` from `C:/Users/User/Desktop/proxy_bot/proxies.db` (table `pool`), live-test each against `https://github.com/login` (ThreadPool 40, ~12s timeout), write a flat JSON list of proxy URLs. GHSession round-robins this list and auto-rotates on network errors (-1). 3. **Check per-panel frontiers:** `_idx4_.txt` line count = GH accounts consumed on that panel. Accounts are reusable ACROSS panels (each panel = a different GitHub OAuth client_id), so per-panel capacity = pool_size − idx4_count. ## Wave run - Runner: `OUTNAME=wave_ PYTHONIOENCODING=utf-8 PYTHONPATH="" reg_proxy100.py `; results in `out/.json`, redirect stdout to `wave_.log`. - `PYTHONIOENCODING=utf-8` is MANDATORY when redirecting to a file — the runner prints `→` and crashes under cp1252 on the first print, silently killing the whole wave (exit=1, near-empty log). - Run waves SEQUENTIALLY in one bash loop. Parallel waves = concurrent OAuth authorize hits from the same exit-IP pool → GitHub `state fail: POST 429` rate explodes. - Before a long background run, do a 2-3 account sanity wave on the target panel and read the log — pipeline drift (dead proxies, panel changes) shows up in the first minutes, not hours. ## Log-line classification - Success: `user_id=N quota=... mode=token key=YES`. - `authorize redirect without code: github.com/account/unverified-email` — account email unverified; PERMANENT for that account, skip. - `callback http=200 Unable to connect to GitHub server` — panel-side OAuth exchange failure; RETRYABLE. - `state fail: POST 429` — GitHub OAuth app/IP rate limit; retryable later with pacing (runner already forces sleep ≥20s). - `WinError 10060` proxy timeouts — auto-rotated, count as retryable if the account never got a code. - Expect ~30-50% yield per pass; plan a retry pass over retryable classes after the wave. ## Pool quality - The TAIL of `gh_accounts.json` (high indices) tends to be unverified-email accounts — don't assume remaining idx capacity is usable; a 2-account probe reveals it. - Pool record shape: `{login, email, password, totp}`. ## Panel liveness rules - 401 `Invalid token` (new-api error format) = panel ALIVE, keys dead → re-register. - HTTP 500 `Database error` = panel broken → skip. - 403 `request blocked` / Cloudflare HTML = panel fronted/blocked → skip or browser path. - Never trust a forwarded post's model list — smoke-test with the panel's SMOKE_MODEL (see `reg_proxy100.py`) immediately after registering.