Skip to content

fix(usage): reuse Gemini CLI project ID for quota checks (port 9router#1428) - #4454

Merged
diegosouzapw merged 1 commit into
release/v3.8.32from
feat/port-pr-1428-reuse-gemini-cli-project-id
Jun 20, 2026
Merged

diegosouzapw merged 1 commit into
release/v3.8.32from
feat/port-pr-1428-reuse-gemini-cli-project-id

Conversation

@diegosouzapw

Copy link
Copy Markdown
Owner

Summary

Ports decolua/9router#1428 by @Delcado19 (122 LOC upstream).

The Gemini CLI usage path (getGeminiUsage in open-sse/services/usage.ts) now:

  1. Reuses the stored connection projectId — when present, it short-circuits the loadCodeAssist round-trip instead of always going to the network.
  2. Normalizes both upstream shapes — loadCodeAssist returns the project either as a bare string or wrapped in { id: "..." }; both are now unwrapped consistently. This matches the existing executor/oauth normalization in open-sse/executors/gemini-cli.ts::extractProjectId and src/lib/oauth/services/gemini.ts.
  3. Trims stray whitespace on stored project ids.
  4. Replaces the dead-end "Gemini CLI project ID not available." message with actionable guidance pointing the operator at reconnect / Code Assist setup.

The projectId was already plumbed through the connection (3rd argument to getGeminiUsage); upstream surfaced the normalization gap that prevented it from short-circuiting in OmniRoute's flow.

Test plan

  • TDD: new tests/unit/gemini-usage-projectid.test.ts (4 cases) — RED before fix, GREEN after.
    • Stored projectId → skips loadCodeAssist, calls retrieveUserQuota directly.
    • loadCodeAssist returns {cloudaicompanionProject: {id: "..."}} → unwrapped.
    • Whitespace-padded stored id → trimmed.
    • No projectId available → message contains "Reconnect Gemini CLI" + "Gemini Code Assist".
  • Related usage tests still green: agy-usage-quota, antigravity-usage-fetcher, antigravity-usage-service (18/18 pass).

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

Ports decolua/9router#1428 by @Delcado19. The Gemini CLI usage path now
short-circuits the `loadCodeAssist` round-trip when the connection
already carries a stored `projectId` (or `providerSpecificData.projectId`),
and normalizes the two upstream shapes — bare string or `{ id: "..." }` —
plus trims stray whitespace, matching the executor/oauth normalization
already shipped in `open-sse/executors/gemini-cli.ts` and
`src/lib/oauth/services/gemini.ts`. The dead-end "Gemini CLI project ID
not available." message is replaced with actionable guidance pointing
the operator at reconnect / Code Assist setup.

TDD: new `tests/unit/gemini-usage-projectid.test.ts` (4 cases)
covers stored-projectId short-circuit, `{id:...}` normalization,
whitespace trimming, and the improved error message.

Co-authored-by: Delcado <Delcado19@users.noreply.github.com>
@diegosouzapw
diegosouzapw force-pushed the feat/port-pr-1428-reuse-gemini-cli-project-id branch from 392b503 to f3431d7 Compare June 20, 2026 23:24
@diegosouzapw
diegosouzapw merged commit 84fd187 into release/v3.8.32 Jun 20, 2026
4 checks passed
@diegosouzapw
diegosouzapw deleted the feat/port-pr-1428-reuse-gemini-cli-project-id branch June 21, 2026 12:33
tkgo11 pushed a commit to tkgo11/OmniRoute that referenced this pull request Sep 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant