Skip to content

fix(ai): antigravity secret extraction tries all GOCSPX candidates (#1633) - #1642

Merged
dezren39 merged 1 commit into
mainfrom
queue/9666-1633-antigravity-candidates
Nov 4, 2026
Merged

dezren39 merged 1 commit into
mainfrom
queue/9666-1633-antigravity-candidates

Conversation

@dezren39

@dezren39 dezren39 commented Nov 4, 2026

Copy link
Copy Markdown

Fixes #1633 (fix task 9666, routed from triage task 9664; lane opencode-a).

What

binaryIntel() in packages/ai/src/providers/antigravity-auth.ts no longer trusts run position:

  • It collects every GOCSPX run in the agy binary (chunked scan, no early exit; matches are taken from the stable region of each chunk so a run split across a chunk boundary is matched whole, never as a truncated prefix) and builds the candidate list: each run's [:35], plus [35:70] for runs ≥70 chars (the 1.4.8 concatenated-pair layout), deduped in scan order. The extraction cache is keyed by binary path.
  • refresh() tries candidates in order — the previously accepted candidate first — and advances to the next candidate only when the token endpoint answers 401 with error: "invalid_client". Every other failure (invalid_grant from a bad stored grant, 5xx, transport, timeouts, oversize bodies) surfaces unchanged, exactly as before. The winner is cached in memory only.
  • No candidate value is ever logged or persisted (the pre-existing error messages carry only the endpoint's response text, unchanged). Stale comments asserting the first-run pairing are replaced.

Tests (synthetic fixtures only — no real credential material)

packages/ai/test/provider/antigravity-auth.test.ts, new #1633 describe:

  • 1.4.11 layout (40/43/40 runs): decoy rejected with invalid_client, pairing secret accepted, third never tried; a second refresh goes straight to the cached winner.
  • 1.4.8 layout (one 70-char run): both halves are candidates; the second half wins when the endpoint accepts only it.
  • Non-advance: an invalid_grant failure does not cycle candidates and surfaces verbatim (exactly one request).

Results: file suite 6/6 pass, antigravity.test.ts 18/18 pass, tsgo --noEmit clean for packages/ai.

The interim AGY_BIN pin to the 1.4.8 binary can be dropped once this lands. The door copy in developing-today/code is out of scope (retires under #1414).

…1633)

binaryIntel() no longer trusts position: it collects every GOCSPX run in the agy binary (each run's first 35 chars, plus chars 35-70 for 70+ char runs, deduped) and refresh() tries candidates in order, advancing only when the token endpoint rejects a candidate with invalid_client (401 + error=invalid_client); all other failures surface unchanged. The accepted candidate is cached in memory only and tried first next time; nothing is logged or persisted. Tests cover both binary layouts with synthetic fixtures. 6/6 file tests, antigravity.test 18/18, tsgo clean.

Note: branch created via the Git Data API because the laptop git credential helper hangs on push (recurring infra issue); contents byte-identical to local commit bc8863dc76.
@dezren39

dezren39 commented Nov 4, 2026

Copy link
Copy Markdown
Author

@codex review

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.

antigravity: client-secret extraction (first GOCSPX match) stale for agy 1.4.11 — refresh fails invalid_client

1 participant