Skip to content

feat(gateway): recognise Antigravity CLI requests as antigravity-cli - #207

Merged
fylorn merged 1 commit into
mainfrom
claude/core-agy-hint-8cl9eq
Sep 25, 2026
Merged

fylorn merged 1 commit into
mainfrom
claude/core-agy-hint-8cl9eq

Conversation

@fylorn

@fylorn fylorn commented Sep 25, 2026

Copy link
Copy Markdown
Contributor

Requested by F · project thread

What this changes

Requests from Antigravity CLI (agy) now get client_hint = "antigravity-cli", the client id ThinkWatch Lite uses for it (ThinkWatch-Lite#213). Before, they got no hint, so Lite's "in use" indicator could never light up for agy.

Why

agy has no user agent of its own. Pointed at a custom Gemini endpoint, it sends the Go genai SDK default in both User-Agent and X-Goog-Api-Client:

google-genai-sdk/1.71.0 gl-go/go1.28-20260721-RC03 cl/951519500 +3ebc191975 X:fieldtrack,boringcrypto,simd,mapsplitgroup

Matching google-genai-sdk alone would label every Go program built on the SDK as agy, and hint.rs already prefers no guess to a wrong one. What sets agy apart is the Google-internal Go toolchain version after gl-go/ (it carries cl/<number>); a program built with a public Go release sends gl-go/go1.25.1. The hint matches all three: google-genai-sdk/ prefix, gl-go/, cl/.

How it was verified

  • Downloaded agy 1.2.11 for linux-x64 from storage.googleapis.com/antigravity-public (the URL in Homebrew's antigravity-cli cask; sha256 matches the cask). Ran agy -p "say pong" with an isolated HOME, settings.json = {"modelProvider":"gemini"}, GOOGLE_GEMINI_BASE_URL=http://127.0.0.1:18999, GEMINI_API_KEY=<fake>, auto-update off and every proxy variable pointed at a dead port. No account was signed in. A local fake server logged two requests (gemini-3.1-flash-lite-preview for the title, gemini-3.1-pro-preview for the turn), both with the header above; nothing else distinguishing was sent (X-Goog-Api-Key, Content-Type, Accept-Encoding only).
  • New test antigravity_cli_is_recognised_by_the_toolchain_in_its_user_agent uses the captured string verbatim, and asserts a public-toolchain Go SDK UA stays None. All 7 hint tests pass.
  • cargo fmt --all -- --check, cargo clippy --workspace --all-targets -- -D warnings (rustc 1.98.1), cargo test --workspace: clean. ./scripts/smoke.sh: 60 passed, 0 failed.
  • Only the display hint changes; it is never used for auth or routing, and no credential path is touched. CONTROL_API_VERSION is unchanged.

Notes for review

  • The match depends on Google building agy with its internal toolchain. Only 1.2.11 could be checked (older builds were not reachable from here). If a future release switches to a public Go toolchain, the hint quietly goes back to None rather than guessing.
  • Another Google-internal Go binary talking the Gemini API through the gateway (for example the Antigravity IDE's language server, if it ever supports a custom endpoint) would also be labelled antigravity-cli.

🤖 Generated with Claude Code

https://claude.ai/code/session_012JfMJSMbfEW5nzkn9vro9A


Generated by Claude Code

Antigravity CLI (agy) has no user agent of its own. Pointed at a custom
Gemini endpoint (GOOGLE_GEMINI_BASE_URL + GEMINI_API_KEY with
modelProvider "gemini"), agy 1.2.11 sends the Go genai SDK default in
both User-Agent and X-Goog-Api-Client:

    google-genai-sdk/1.71.0 gl-go/go1.28-20260721-RC03 cl/951519500 +3ebc191975 X:fieldtrack,...

Matching on `google-genai-sdk` alone would label every Go program built
on the SDK as agy. What sets agy apart is the Google-internal Go
toolchain version after `gl-go/` (it carries `cl/<number>`); a program
built with a public Go release sends `gl-go/go1.25.1`. The hint now maps
that combination to `antigravity-cli`, the client id ThinkWatch Lite
uses for it.

Captured by running agy against a local fake server with a fake key and
all outbound traffic blocked; no account was signed in.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012JfMJSMbfEW5nzkn9vro9A
@fylorn fylorn self-assigned this Sep 25, 2026
@fylorn
fylorn merged commit 48c24f8 into main Sep 25, 2026
4 checks passed
@fylorn
fylorn deleted the claude/core-agy-hint-8cl9eq branch September 25, 2026 17:39
@fylorn fylorn mentioned this pull request Sep 25, 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.

2 participants