fix(antigravity): 429 RESOURCE_EXHAUSTED on consumer accounts due to hardcoded endpoint
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 19.9k
- Forks
- 2.3k
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 30
Description
Problem Description
When using the Antigravity provider in jcode (jcode --provider antigravity auth-test or running queries via jcode --provider antigravity -m <model>), requests immediately fail with:
HTTP 429 Too Many Requests: Resource has been exhausted (e.g. check quota).
However, the exact same Google account and models work seamlessly in the official Antigravity IDE at the same time.
Root Cause Analysis
-
Endpoint Discrepancy:
- Inspecting the official Antigravity IDE language server arguments (
ps aux | grep language_server) reveals that it connects to:--cloud_code_endpoint https://daily-cloudcode-pa.googleapis.com - In
jcode,FETCH_MODELS_API_URLandGENERATE_CONTENT_API_URLwere hardcoded tohttps://cloudcode-pa.googleapis.com.
- Inspecting the official Antigravity IDE language server arguments (
-
GFE Host Routing:
- Google Front End (GFE) routes requests based on the
Hostheader. - For consumer accounts (
@gmail.comallocated to projectaicode-consumers),https://cloudcode-pa.googleapis.comrejects requests with:{ "error": { "code": 429, "message": "Resource has been exhausted (e.g. check quota).", "status": "RESOURCE_EXHAUSTED" } } - Testing
https://daily-cloudcode-pa.googleapis.comwith the identical OAuth access token succeeds withHTTP 200 OKacross all models (gemini-3.8-flash-tiered,gemini-3.7-flash-tiered,claude-opus-4-6-thinking,claude-sonnet-4-6).
- Google Front End (GFE) routes requests based on the
Solution
Make the Antigravity endpoint configurable via an environment variable (JCODE_ANTIGRAVITY_ENDPOINT) while defaulting to https://daily-cloudcode-pa.googleapis.com, and add https://daily-cloudcode-pa.googleapis.com to LOAD_ENDPOINTS in jcode-base::auth::antigravity.
1. crates/jcode-provider-antigravity/src/lib.rs
pub const DEFAULT_ENDPOINT: &str = "https://daily-cloudcode-pa.googleapis.com";
pub const ENDPOINT_ENV: &str = "JCODE_ANTIGRAVITY_ENDPOINT";
pub const FETCH_MODELS_API_URL: &str =
"https://daily-cloudcode-pa.googleapis.com/v1internal:fetchAvailableModels";
pub const GENERATE_CONTENT_API_URL: &str =
"https://daily-cloudcode-pa.googleapis.com/v1internal:generateContent";
pub fn antigravity_endpoint() -> String {
std::env::var(ENDPOINT_ENV)
.ok()
.map(|value| value.trim().trim_end_matches('/').to_string())
.filter(|value| !value.is_empty())
.unwrap_or_else(|| DEFAULT_ENDPOINT.to_string())
}
pub fn fetch_models_api_url() -> String {
format!("{}/v1internal:fetchAvailableModels", antigravity_endpoint())
}
pub fn generate_content_api_url() -> String {
format!("{}/v1internal:generateContent", antigravity_endpoint())
}
2. crates/jcode-base/src/provider/antigravity.rs
Use fetch_models_api_url() when querying available models:
let response = client
.post(fetch_models_api_url())
.header(reqwest::header::AUTHORIZATION, format!("Bearer {}", access_token))
...
3. crates/jcode-provider-antigravity-runtime/src/lib.rs
Use generate_content_api_url() when generating content:
let response = self
.client
.post(generate_content_api_url())
.bearer_auth(&tokens.access_token)
...
4. crates/jcode-base/src/auth/antigravity.rs
Add https://daily-cloudcode-pa.googleapis.com to LOAD_ENDPOINTS:
const LOAD_ENDPOINTS: &[&str] = &[
"https://daily-cloudcode-pa.googleapis.com",
"https://cloudcode-pa.googleapis.com",
"https://daily-cloudcode-pa.sandbox.googleapis.com",
"https://autopush-cloudcode-pa.sandbox.googleapis.com",
];
Verification Results
After compiling with this patch:
jcode --provider antigravity auth-test:✓ credential_probe — Loaded Antigravity OAuth tokens for vallabha717@gmail.com ✓ refresh_probe — Antigravity token load/refresh succeeded ✓ provider_smoke — Provider returned AUTH_TEST_OK. ✓ tool_smoke — Tool-enabled provider request returned AUTH_TEST_OK after one validated real Jcode bash tool call result: PASS- Real prompt tests succeeded with HTTP 200 on:
claude-opus-4-6-thinkingclaude-sonnet-4-6gemini-3.8-flash-tiered
Related to #1162.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Review the endpoint constants and request construction in crates/jcode-provider-antigravity/src/lib.rs, crates/jcode-base/src/provider/antigravity.rs, and crates/jcode-provider-antigravity-runtime/src/lib.rs, then inspect LOAD_ENDPOINTS in crates/jcode-base/src/auth/antigravity.rs. Run jcode --provider antigravity auth-test and verify that model discovery and content generation succeed for the daily endpoint while the endpoint remains configurable.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- api, authentication, cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 78/100