mirror of
https://github.com/chenyme/grok2api.git
synced 2026-12-06 08:02:14 +00:00
Every other account-selection path (text chat, image generation, voice, voice websocket) threads the requesting client key's AccountScope through to beginSelectionSessionForKey. The video job's background retry/recovery worker (runVideoJob) used the unscoped beginSelectionSession instead, so once the job's originally pinned account failed, the fallback search for a replacement ignored the client key's provider/tier restrictions entirely. A client key restricted to e.g. Super-tier accounts could end up consuming a Free-tier (or wrong-provider) account's quota purely because its pinned account hit a transient failure, silently widening access beyond what the key was configured to allow. media.Job already stores ClientKeyID, so the fix looks up that key and passes its AccountScope into beginSelectionSessionForKey, matching every other selection path. Added a regression test (TestVideoRetryDoesNotEscapeClientKeyAccountScope) that fails against the prior code (confirmed: the out-of-scope account was used) and passes with the fix.