internal/runtime/executor: Antigravity first OAuth refresh changes antigravitySignatureCacheScope, stranding pre-refresh Claude thinking signatures

Open Beginner friendly
#7,968 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
74/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
go

Research direction

Read internal/runtime/executor/antigravity_executor_auth.go, specifically refreshTokenWithOptions around lines 230-251, alongside antigravitySignatureGrantIdentity and antigravitySignatureCacheScope. Trace how cpa_signature_cache_grant gets set in the trailing else branch after access_token is already overwritten on line 242, then compute the pre-refresh grant identity before that assignment. Done looks like the repro TestRepro_AntigravityFirstRefreshBreaksSignatureCacheScope passing with the scope unchanged, plus the existing executor tests still green under go test -race ./internal/runtime/executor.

Written by the indexing model from the issue text.

Description

Is it a request payload issue?
  • Yes, this is a request payload issue.
  • No, it's another issue (internal/runtime/executor).
Describe the bug

Commit 85225381 (fix(antigravity): isolate signature cache by credential) scopes the Antigravity Claude signature cache via antigravitySignatureCacheScope(auth), which embeds antigravitySignatureGrantIdentity(auth) (cpa_signature_cache_grant if set, otherwise grant(refresh_token, access_token)).

However, before a credential's first refresh, cpa_signature_cache_grant and cpa_signature_cache_grant_binding are absent from auth.Metadata, so grantRetained in refreshTokenWithOptions (internal/runtime/executor/antigravity_executor_auth.go:230-251) is "". Consequently, if grantRetained != "" && grantBinding == currentBinding (line 234) is false, auth.Metadata["access_token"] is overwritten on line 242, and the trailing else branch (lines 248-251) initializes cpa_signature_cache_grant using antigravitySignatureGrantIdentity(auth) after access_token was replaced. This binds cpa_signature_cache_grant to the new access_token instead of the pre-refresh access_token, mutating antigravitySignatureCacheScope on the first refresh and stranding all pre-refresh cached Claude thinking signatures.

Environment & verification scope
  • CLIProxyAPI revision: origin/dev at 32842348 (confirmed on v8.1.2 85225381)
  • OS / Go: Windows 11 amd64, go1.27.4
  • CLI Type / Provider: antigravity
End-to-End Pipeline Trace (Verified on origin/dev 32842348)
  1. Pre-refresh credential (refresh_token: "r1", access_token: "a1", project_id: "p1", no cpa_signature_cache_grant) computes antigravitySignatureCacheScope(auth) = "id:...\x00grant:<hash(r1,a1)>\x00p1".
  2. refreshTokenWithOptions (internal/runtime/executor/antigravity_executor_auth.go:230-251) overwrites auth.Metadata["access_token"] = "a2" at line 242 before calling antigravitySignatureGrantIdentity(auth) at line 249.
  3. antigravitySignatureCacheScope(updated) changes to "id:...\x00grant:<hash(r1,a2)>\x00p1", causing subsequent signature cache lookups to miss.
Minimal reproduction & Observed vs Expected
go test -v -race -count=1 -run TestRepro_AntigravityFirstRefreshBreaksSignatureCacheScope ./internal/runtime/executor

Observed output (origin/dev 32842348):

=== RUN   TestRepro_AntigravityFirstRefreshBreaksSignatureCacheScope
    repro_v812_exec_test.go:46: antigravitySignatureCacheScope changed on first refresh:
        before="id:ag-first-refresh\x00grant:dda1f107bf886c07\x00p1"
        after ="id:ag-first-refresh\x00grant:a4c1303e72ffac5a\x00p1"
--- FAIL: TestRepro_AntigravityFirstRefreshBreaksSignatureCacheScope (0.02s)
Check / Field Observed (origin/dev 32842348) Expected
antigravitySignatureCacheScope after 1st refresh Changed (dda1f107bf886c07 -> a4c1303e72ffac5a) Preserved (dda1f107bf886c07)
Suggested minimal fix

In refreshTokenWithOptions (internal/runtime/executor/antigravity_executor_auth.go:230-251), compute the pre-refresh antigravitySignatureGrantIdentity(auth) before overwriting auth.Metadata["access_token"] on line 242, and store that pre-refresh grant identity in cpa_signature_cache_grant when grantRetained == "" (for the same grantBinding).

What ran / Not run
  • Ran: Hermetic go test -v -race -count=1 -run TestRepro_AntigravityFirstRefreshBreaksSignatureCacheScope ./internal/runtime/executor against origin/dev (32842348).
  • Not run: Live upstream OAuth refresh (scope-key mutation is deterministic in refreshTokenWithOptions).
Dominant language
Go
Stars
59.4k
Forks
9.1k
Avg merge
14h 20m
Merged PRs (30d)
67

Getting set up

  • Ships a Dockerfile or Docker Compose file
  • No pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from router-for-me/CLIProxyAPI

All issues in router-for-me/CLIProxyAPI

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.