[PR #101] [MERGED] fix(antigravity): implement automatic Project ID discovery to resolve 403 errors #263

Closed
opened 2026-02-27 07:18:44 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/justlovemaki/AIClient-2-API/pull/101
Author: @lethanhson9901
Created: 12/9/2025
Status: Merged
Merged: 12/9/2025
Merged by: @justlovemaki

Base: mainHead: fix/antigravity-project-id-discovery


📝 Commits (1)

  • 6342801 fix(antigravity): implement automatic project ID discovery and prevent overwrite

📊 Changes

1 file changed (+172 additions, -99 deletions)

View changed files

📝 src/gemini/antigravity-core.js (+172 -99)

📄 Description

Summary

This PR resolves the 403 Permission Denied error encountered when using the gemini-antigravity provider by implementing automatic Google Cloud Project ID discovery.

Problem

Previously, the Antigravity provider generated a random, non-existent Project ID (e.g., swift-core-xxxxx) for every request. The Google API rejected these requests because the project did not exist or the user was not authorized for it, resulting in persistent 403 errors.

Solution

  1. Implemented Project ID Discovery:

  2. Fixed ID Overwrite Bug:

Verification

  • Test: Run gemini-antigravity provider without a hardcoded config.json project ID.
  • Expected Result:
    • Server logs show: [Antigravity] Discovered existing Project ID: <valid-id> (or "Onboarded...").
    • API requests return 200 OK instead of 403 Permission Denied.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/justlovemaki/AIClient-2-API/pull/101 **Author:** [@lethanhson9901](https://github.com/lethanhson9901) **Created:** 12/9/2025 **Status:** ✅ Merged **Merged:** 12/9/2025 **Merged by:** [@justlovemaki](https://github.com/justlovemaki) **Base:** `main` ← **Head:** `fix/antigravity-project-id-discovery` --- ### 📝 Commits (1) - [`6342801`](https://github.com/justlovemaki/AIClient-2-API/commit/6342801749da9707a860926bd6b183ca5c67d3e1) fix(antigravity): implement automatic project ID discovery and prevent overwrite ### 📊 Changes **1 file changed** (+172 additions, -99 deletions) <details> <summary>View changed files</summary> 📝 `src/gemini/antigravity-core.js` (+172 -99) </details> ### 📄 Description ## Summary This PR resolves the `403 Permission Denied` error encountered when using the `gemini-antigravity` provider by implementing automatic Google Cloud Project ID discovery. ## Problem Previously, the Antigravity provider generated a random, non-existent Project ID (e.g., `swift-core-xxxxx`) for every request. The Google API rejected these requests because the project did not exist or the user was not authorized for it, resulting in persistent 403 errors. ## Solution 1. **Implemented Project ID Discovery**: - Ported the [discoverProjectAndModels](cci:1://file:///home/son/Documents/tmp/AIClient-2-API/src/gemini/antigravity-core.js:381:4-454:5) and `onboardUser` logic from [gemini-core.js](cci:7://file:///home/son/Documents/tmp/AIClient-2-API/src/gemini/gemini-core.js:0:0-0:0) to [src/gemini/antigravity-core.js](cci:7://file:///home/son/Documents/tmp/AIClient-2-API/src/gemini/antigravity-core.js:0:0-0:0). - The service now attempts to find an existing Cloud Code project via `loadCodeAssist`. - If no project exists, it automatically onboards the user to the free tier via `onboardUser`. 2. **Fixed ID Overwrite Bug**: - Updated the [geminiToAntigravity](cci:1://file:///home/son/Documents/tmp/AIClient-2-API/src/gemini/antigravity-core.js:90:0-157:1) helper function to accept and respect the discovered `projectId`. - Updated request generation methods ([generateContent](cci:1://file:///home/son/Documents/tmp/AIClient-2-API/src/gemini/gemini-core.js:518:4-529:5), [generateContentStream](cci:1://file:///home/son/Documents/tmp/AIClient-2-API/src/gemini/gemini-core.js:531:4-555:5)) to pass the active `projectId`, ensuring valid credentials are used instead of random placeholders. ## Verification - **Test**: Run `gemini-antigravity` provider without a hardcoded `config.json` project ID. - **Expected Result**: - Server logs show: `[Antigravity] Discovered existing Project ID: <valid-id>` (or "Onboarded..."). - API requests return `200 OK` instead of `403 Permission Denied`. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-27 07:18:44 +03:00
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/AIClient-2-API-justlovemaki#263
No description provided.