mirror of
https://github.com/Wei-Shaw/sub2api.git
synced 2026-10-25 07:59:04 +00:00
resolveAntigravityForwardBaseURL() used ForwardBaseURLs() (which reorders the daily/sandbox endpoint to the front) and returned the first entry by default — daily-cloudcode-pa.sandbox.googleapis.com. Every Antigravity gateway request was therefore sent to Google's sandbox endpoint, which rejects production OAuth tokens: the account is benched with "OAuth 401: Invalid bearer token" (native paths surface it as 502) and never recovers. The dashboard "test connection" uses the production endpoint (antigravity.BaseURL), which is exactly why the test succeeds while the gateway 401s. Default to production (antigravity.BaseURLs[0] = cloudcode-pa.googleapis.com), matching the OAuth/test path; the daily/sandbox endpoint is now opt-in via GATEWAY_ANTIGRAVITY_FORWARD_BASE_URL=daily|sandbox. Fixes #3611, #2962. Supersedes the token-refresh self-heal approach (that premise — token staleness — was disproven: a 30s-old freshly-authorized token also 401s on the gateway while working on the test path). Verified on a live instance with a freshly-authorized Antigravity account: /antigravity/v1/messages and /v1/messages now return real completions (claude-sonnet-4-6, claude-opus-4-6); the same account/token 401/502'd before.