Skip to content

fix(gemini-cli): Surface specific missing companion error instead of generic unavailable status#92

Merged
slkiser merged 2 commits into
slkiser:mainfrom
anthonyhaussman:tone/fix/opencode_gemini_quota
May 15, 2026
Merged

fix(gemini-cli): Surface specific missing companion error instead of generic unavailable status#92
slkiser merged 2 commits into
slkiser:mainfrom
anthonyhaussman:tone/fix/opencode_gemini_quota

Conversation

@anthonyhaussman
Copy link
Copy Markdown
Contributor

Summary

Fix an issue where a missing opencode-gemini-auth companion package resulted in a generic Gemini CLI: Unavailable (not detected) status message instead of the intended actionable error.

Details

Why:
In version 3.8.3, changes to how the companion package is resolved led to a regression in error reporting. The hasGeminiCliQuotaRuntimeAvailable() function was checking for both the presence of valid OAuth configuration and the companion package.
When the companion package was missing, it returned false, which caused the entire provider to be marked as unavailable.
This early exit bypassed the fetch phase (queryGeminiCliQuota()) where the specific and actionable error (Install opencode-gemini-auth separately to enable Gemini CLI quota) is actually generated and returned to the user.

How:

  • Removed inspectGeminiCliCompanionPresence from hasGeminiCliQuotaRuntimeAvailable().
  • The availability check now only verifies that Gemini CLI auth configuration is present.
  • Companion validation is now correctly delegated to the fetch phase (queryGeminiCliQuota()), which properly captures the companion state and surfaces the appropriate error message to the user if it's missing or incompatible.

Linked Issue

Current version :

> node ./dist/bin/opencode-quota.js show

[Copilot] (personal)
Quota                                          16d
████████████████████░░░░░░░░░░░░░░░░░░░   52% left

Gemini CLI: Unavailable (not detected)

Fix version:

> node ./dist/bin/opencode-quota.js show        

[Copilot] (personal)
Quota                                          16d
████████████████████░░░░░░░░░░░░░░░░░░░   52% left

[Gemini CLI]
Gemini Pro                                     24h
███████████████████████░░░░░░░░░░░░░░░░   59% left
Gemini Flash                                 23.5h
███████████████████████████████████████   99% left
Gemini Flash Lite                                 
███████████████████████████████████████  100% left

OpenCode Validation

  • Current production released OpenCode version tested: 1.15.0
  • Why this version is relevant to the fix: -

Quality Checklist

  • I ran npm run typecheck
  • I ran npm test
  • I ran npm run build
  • This is the smallest safe root-cause fix (no unnecessary hook/output mutation logic)
  • I preserved behavioral invariants and updated/added boundary tests as needed
  • I updated docs for user-facing workflow/command/config changes (README.md and CONTRIBUTING.md when applicable)
  • For new API-key/token providers, I started from contributing/provider-template/ or explained why the template does not apply
  • For provider setup/auth wording changes, I checked the relevant dummy .ts template in contributing/provider-template/ and verified README.md against src/lib/provider-metadata.ts (authentication/authFallbacks) and provider auth resolver/diagnostics behavior

By removing the companion presence validation from the provider's
availability probe, we allow the provider to attempt a fetch when auth
is configured. This delegates companion validation to the query phase,
correctly surfacing the descriptive "missing plugin" error instead of
the generic "Unavailable (not detected)" state.
@anthonyhaussman anthonyhaussman marked this pull request as ready for review May 15, 2026 07:25
@slkiser slkiser merged commit 4cae5ca into slkiser:main May 15, 2026
3 checks passed
@slkiser
Copy link
Copy Markdown
Owner

slkiser commented May 15, 2026

@anthonyhaussman thanks!

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.

2 participants