Skip to content

[antigravity] Add keychain auth for agy CLI; stop bundle overwriting user plugins on restart#514

Open
yesvus wants to merge 3 commits into
robinebers:mainfrom
yesvus:fix/antigravity-cli-auth-bundle-overwrite
Open

[antigravity] Add keychain auth for agy CLI; stop bundle overwriting user plugins on restart#514
yesvus wants to merge 3 commits into
robinebers:mainfrom
yesvus:fix/antigravity-cli-auth-bundle-overwrite

Conversation

@yesvus
Copy link
Copy Markdown

@yesvus yesvus commented May 27, 2026

Summary by cubic

Adds keychain-based auth for the Antigravity/Gemini CLI so the plugin can use tokens from the OS keychain when LS/DB are unavailable. Also prevents app restarts from overwriting user-installed plugins.

  • New Features

    • Reads tokens from OS keychain using service names: gemini, gemini-cli-oauth, antigravity-cli-oauth.
    • Supports go-keyring base64 envelope and common JSON shapes (access_token/refresh_token, nested tokens, expiry fields).
    • Prefers DB tokens; uses non-expired keychain access tokens or refreshes via keychain refresh token when needed.
  • Bug Fixes

    • Skip copying plugin files if the destination already exists in src-tauri to avoid overwriting user plugins.
    • Guard keychain expiry parsing against NaN to avoid invalid token handling.

Written for commit 8c5e839. Summary will update on new commits. Review in cubic

Copilot AI review requested due to automatic review settings May 27, 2026 15:33
@github-actions github-actions Bot added rust Pull requests that update rust code plugin labels May 27, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds keychain-based OAuth token discovery for the Antigravity plugin (to support Antigravity CLI / Gemini CLI auth), plus expands tests and tweaks file-copy behavior to avoid overwriting existing files.

Changes:

  • Add keychain token loading/parsing (including go-keyring base64 envelope) and integrate it into probe flow with refresh-token fallback.
  • Add extensive Jest coverage for keychain token formats, precedence rules, and refresh flows.
  • Update recursive copy to skip copying files that already exist at the destination.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
src-tauri/src/plugin_engine/mod.rs Changes recursive copy behavior to skip existing destination files.
plugins/antigravity/plugin.js Implements keychain token discovery/parsing and plugs it into probe + refresh logic.
plugins/antigravity/plugin.test.js Adds test cases covering keychain auth formats and precedence/refresh behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +103 to +105
if dst_path.exists() {
continue;
}
Comment on lines +507 to +517
if (expirySeconds === null) {
if (parsed.expiresAt != null) {
expirySeconds = Math.floor(Number(parsed.expiresAt) / 1000)
} else if (parsed.expiresAtMs != null) {
expirySeconds = Math.floor(Number(parsed.expiresAtMs) / 1000)
} else if (parsed.expirySeconds != null) {
expirySeconds = Number(parsed.expirySeconds)
} else if (parsed.expiry_seconds != null) {
expirySeconds = Number(parsed.expiry_seconds)
}
}
Comment thread plugins/antigravity/plugin.js Outdated

function decodeGoKeyringValue(raw, ctx) {
if (typeof raw !== "string") return null
var trimmed = raw.replace(/^\s+|\s+$/g, "")
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 3 files

Reply with feedback, questions, or to request a fix.

Fix all with cubic | Re-trigger cubic

Comment thread plugins/antigravity/plugin.js
yesvus and others added 2 commits May 27, 2026 18:18
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

plugin rust Pull requests that update rust code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants