Repository navigation
Description
Summary
On Linux, agy-cli-manager cannot import, log in, or switch accounts when paired with a recent Antigravity CLI (agy). Like the macOS Keychain problem in #2 and the Windows Credential Manager problem in #1/#5, agy stores its OAuth token in the OS credential store instead of the antigravity-cli/antigravity-oauth-token file that this project expects — but no Linux report exists yet, so the credential-store rework is currently Linux-unaware.
The good news: on Linux the stored value is plain JSON, not an opaque blob, so the fix is considerably smaller than the macOS one. See Why Linux is easier below.
Environment
agy-cli-manager: v0.2.2 (latest release wheel)agy(Antigravity CLI): 1.2.14- OS: Linux (CachyOS, KDE Plasma)
- Credential store: Secret Service via KWallet (
kwalletd6/libsecret) - Python: 3.14
Steps to reproduce
agy itself works and is authenticated:
$ agy
▄▀▀▄ Antigravity CLI 1.2.14
▀▀▀▀▀▀ user@example.com (Google AI Pro)But every profile-import path fails:
$ agy-cli-manager import-current main ~/.gemini
error: Profile source is missing required auth files: /home/<user>/.gemini
$ agy-cli-manager import-current main ~/.gemini/
error: Profile source is missing required auth files: /home/<user>/.geminiagy-cli-manager login fails the same way — the interactive agy login completes successfully, then:
error: agy login did not produce a usable auth profile.This matches #2 exactly, so the current upstream diagnosis ("credential store need rework with different logic on different OS") applies here as well.
Root cause
agy 1.2.x migrated the token to the Secret Service. The account is present, but not as a file:
$ secret-tool search service gemini
[/org/freedesktop/secrets/collection/login/…]
label = Password for 'antigravity' on 'gemini'
attribute.service = gemini
attribute.username = antigravityNothing is ever written to ~/.gemini/antigravity-cli/.
Evidence
1. The agy logs report keyring-backed auth:
keyring.go:64] keyringAuth: loaded token, expiry=2026-10-01 00:54:46 +0800 expired=false
auth.go:157] ChainedAuth: authenticated via keyring (effective: keyring)
server_oauth.go:198] applyAuthResult: email=<redacted>, authMethod=consumer
server_oauth.go:203] OAuth: authenticated successfully
2. The agy binary never references the legacy token path:
$ strings ~/.local/bin/agy | grep antigravity-oauth-token
# (no output)3. The agy binary does embed a Secret Service client — it vendors zalando/go_keyring plus its own detectors:
third_party/golang/github_com/zalando/go_keyring/v/v0/keyring.go
third_party/golang/github_com/zalando/go_keyring/v/v0/keyring_unix.go
third_party/golang/github_com/zalando/go_keyring/v/v0/keyring_fallback.go
third_party/golang/github_com/zalando/go_keyring/v/v0/secret_service/secret_service.go
third_party/jetski/cli/backend/auth/keyring.go
third_party/jetski/language_server/code_assist_client/keyring_detector.go
third_party/jetski/language_server/code_assist_client/keyring_detector_dbus.go
with log messages such as Using file-based token storage because %s detected, Keyring SaveToken timed out after %v, falling back to file storage, and Failed to load token from keyring, falling back to file: %v.
4. agy exposes no profile/home override (agy --help has no --profile, GEMINI_HOME, or equivalent), so per-account home directories cannot be used to isolate credentials.
Because the token lives in a single global Secret Service slot (service=gemini, username=antigravity) and never in a file, profile_has_login_artifacts() returns false and every import/switch path aborts.
Why the Linux fix is smaller than macOS
In #2 the macOS Keychain value is a 686-byte opaque blob, so the proposed workaround cannot reuse the existing quota/identity code. On Linux the value is plain JSON, and its schema is byte-compatible with what manager._load_antigravity_token_state() already parses:
{
"token": {
"access_token": "<redacted>",
"token_type": "Bearer",
"refresh_token": "<redacted>",
"expiry": "2026-10-01T01:00:18.126701991+08:00"
},
"auth_method": "consumer",
"id_token": "<redacted JWT; carries the account email claim>"
}Concretely, manager.py already reads data["token"]["access_token"], data["token"]["refresh_token"], data["token"]["expiry"], and data["id_token"] — all of which exist here. So a bridge that copies the document between the Secret Service and the expected file path makes all existing code work unmodified, including:
_extract_access_token()/_has_refresh_token()/_token_expiry_due()refresh-usage(real Cloud Code quota calls)_identity_from_antigravity_token()via theid_tokenemail claimwhoamiviagoogle_userinfo
Minimal implementation sketch
secret-tool is already a standard dependency on KDE/GNOME systems and is enough — no D-Bus library needed:
# Secret Service -> file
secret-tool lookup service gemini username antigravity
# > ~/.gemini/antigravity-cli/antigravity-oauth-token
# file -> Secret Service (on switch)
secret-tool store --label="Password for 'antigravity' on 'gemini'" \
service gemini username antigravity < profile-token-fileRound-tripping the document verbatim is byte-exact, so a switch does not reformat the stored credential. Hooks needed (four, all one-liners):
| Location | Direction |
|---|---|
save_account_profile() |
export, before the profile_has_login_artifacts() check |
_sync_runtime_to_live_dir() |
import, after _copy_account_profile() |
login_account() |
export, after the agy subprocess exits |
new keyring-sync command |
re-capture the active profile after agy rotates its token |
A guard is needed on the export side: only export when the target really is a live agy home (e.g. it contains antigravity-cli/log) and has no token file yet. Otherwise adding a saved profile directory would overwrite that account's stored credential with whatever is currently live.
I have a working local implementation of exactly this (~150 lines, plus 3 hooks) and can provide a diff or a PR if that is useful.
Caveats a Linux implementation must handle
These are the same constraints #5 lists for Windows, restated for Secret Service:
- Single global slot. Switching overwrites the live entry. There is one credential, not N.
- Restart required.
agycaches the token in memory, so a switch only takes effect after restarting theagyprocess. Same as the existing file-based model. - Refresh-token rotation.
agyrefreshes on its own and rewrites the entry, so a profile saved earlier goes stale. Akeyring-sync-style command (export live → active saved profile) is needed to keep stored copies usable, and a stale refresh token may eventually be revoked by Google. - Plaintext token files are a new exposure. The file-based model materialises a 0600 credential file that did not previously exist on Linux. Worth documenting.
- Secret Service availability.
secret-toolmay block on a locked collection or prompt for a password in some setups; failures should degrade gracefully rather than abort a switch.
Related
- agy-cli-manager v0.2.1 fails to import or log in to accounts on macOS when paired with Antigravity CLI (
agy) 1.1.2. #2 — macOS Keychain (same root cause, opaque blob) - Please add windows system support #1 / Store Windows agy tokens in Credential Manager for profile switch #5 — Windows Credential Manager (same root cause; Store Windows agy tokens in Credential Manager for profile switch #5 has a proposed implementation)
Happy to test any approach, including a --credential-store abstraction that covers all three platforms.
Activity
Dandroid-D commentedon Oct 2, 2026
Draft comment for zcop/agy-cli-manager issue #7 — NOT POSTED (awaits user approval)
Linux workaround that works in production (4 Pro accounts, agy 1.2.14)
Thanks for the excellent diagnosis in this issue — we hit exactly this on
CachyOS/KDE (Plasma, gnome-keyring via org.freedesktop.secrets) and confirmed
every part of it live, plus a few extra behaviors that may help other Linux users:
Additional findings
token file is present — a fresh
$HOMEwith the keyring reachable silentlyauthenticates the keyring's account (this is why
login/import"auto-login"to the existing account).
the file — so after any manual token-file switch, the stale keyring entry
keeps winning until it is cleared.
secret-tool search service geminican MISS the entry on somesetups; the reliable emptiness check is the two-attribute
org.freedesktop.Secret.Service.SearchItemscall with both{'service': 'gemini', 'username': 'antigravity'}.Working procedure (since agy 1.2.13 dual-writes, token files still exist)
loads the new account from the file and re-seeds the keyring correctly
(self-healing). We enforce this with a systemd user path unit watching the live
token file AND the manager's state.json (the manager copies auth files before
publishing state, so watching state.json alone misses crash windows).
DBUS_SESSION_BUS_ADDRESSpointed at a dead socket,otherwise agy writes refreshed tokens to the keyring and the manager keeps
reading stale files (PermissionError loop).
can be captured with
secret-tool lookup service gemini username antigravity,its account identified by decoding the
id_tokenJWTsub/email, andimported with
agy-cli-manager add <name> <dir-with-.gemini>.Happy to contribute the guard units or a patch sketch if useful.
zcop commentedon Oct 3, 2026
Fixed in
043f204and pushed tomain.Implemented Linux Secret Service support with:
auto,file, andsecret-servicecredential backendsagyis runningValidation completed against a real Debian 13 GNOME/KVM desktop session:
service=gemini,username=antigravityattributes0600saved credentialagycorrectly blocked switching and preserved the active keyring credentialCI passed on Python 3.10 and 3.13, distribution build/install passed, and Pages deployment succeeded.