Skip to content

Accept AQ. Gemini keys in setup - #4283

Closed
Lockyer228 wants to merge 3 commits into
garrytan:mainfrom
Lockyer228:cursor/gemini-aq-key-prefix-9aad
Closed

Lockyer228 wants to merge 3 commits into
garrytan:mainfrom
Lockyer228:cursor/gemini-aq-key-prefix-9aad

Conversation

@Lockyer228

Copy link
Copy Markdown
Contributor

Why (in your own words)

Google AI Studio now issues Gemini auth keys that start with AQ. (AQ.Ab...). setup still required AIza, so a valid key was rejected before the smoke test. Leave off --provider and the same key was classified as OpenAI, then rejected for not starting with sk-. This accepts both prefixes. The live Gemini check also redacts an AQ. key if an error body echoes it.

Live evidence

On current main the gate is still one prefix. A fixture that starts with AQ. fails before any request:

Invalid key. A Gemini key starts with 'AIza'.

After this change, same kind of fixture, temp home, no stub:

Key saved to ~/.gstack/gemini.json (0600 permissions).

Running smoke test (generating a simple image)...
Smoke test FAILED: Gemini API error (401, model gemini-nano-banana-2.1, key from ~/.gstack/gemini.json): API key not valid.

The saved file is mode 0600 and the stored prefix is AQ.. Google rejected the fixture. That is the right failure for a fake key. The prefix gate did not fire, and the fixture was not printed.

bun test design/test/gemini-provider.test.ts — 26 pass, 0 fail.

Scope

  • Changed: the setup prefix gate and its prompt (design/src/cli.ts), the auth comment (design/src/auth.ts), the live-check redactor (design/scripts/live-gemini-check.ts), and the tests (design/test/gemini-provider.test.ts).
  • Verified live by: setup --provider gemini --key-stdin with an AQ. fixture, plus the Gemini provider test file.
  • Did NOT test: a real billed AI Studio key. Gemini returning JPEG instead of PNG is separate (design: Gemini default image model returns image/jpeg, every generate fails ("not a PNG") #4238).

Liveness proof (required for external contributors)

No screenshot in this PR. I am not attaching a generated image.

Checklist

  • Liveness screenshot attached (GSTACK PR typed live into a real surface) or PR author is @garrytan (owner exemption)
  • This is not a generated-file-only diff (I edited the source/template and regenerated)
  • No ETHOS.md edits, and no changes to voice / founder perspective / YC references
  • New public command / external service / host adapter has an accepted issue linked (or N/A)
  • Linked issue or reproduction: design setup: rejects new-format Gemini API keys ("AQ…"), only accepts "AIza…" #4239

Fixes #4239

Lockyer228 and others added 2 commits November 10, 2026 11:01
Google AI Studio now issues keys that start with AQ. setup only
treated AIza as Gemini, so a valid key was rejected before the
smoke test and, with no --provider, classified as OpenAI. Accept
both prefixes. The live Gemini check redacts an echoed AQ key the
same way it already redacted AIza.

Co-authored-by: Lockyer <[email protected]>
Auth keys are AQ. plus the secret. The redactor treated the dot as
the end of the token, so a real key in an error body was printed.
The setup gate already accepted that shape.

Co-authored-by: Lockyer <[email protected]>
@trunk-io

trunk-io Bot commented Nov 10, 2026

Copy link
Copy Markdown

Merging to main in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here

@capy-ai

capy-ai Bot commented Nov 10, 2026

Copy link
Copy Markdown
Contributor

Thanks for this, and for the live check showing the prefix gate no longer fires. We're considering it together with #4238, since the Gemini path also fails on the image format. If we take it, we'll rewrite it on current main and credit you as co-author. gstack is in a tooling freeze until November 21, so it will be looked at after that.

@capy-ai

capy-ai Bot commented Nov 16, 2026

Copy link
Copy Markdown
Contributor

Following up: we're taking this for #4239. It will be rebuilt on current main with you credited as co-author, and this PR will be closed with a link when it lands, after November 21.

@capy-ai

capy-ai Bot commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Thank you for this. We're picking up the idea. A maintainer agent working through a batch of fixes (our tracking thread GSTA-801) will first reproduce the problem on current main. If it reproduces, the agent rebuilds the fix on main with you credited as co-author, because we don't merge outside branches directly, and we'll close this PR with a link when it lands. If it no longer reproduces, we'll close this and say what changed.

@capy-ai

capy-ai Bot commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Thank you. Your change was rebuilt on current main and landed in #4684, with you credited as co-author. The rebuild also adds the AQ. format to secret redaction so the new keys never show up in logs. Closing this in favour of that PR.

@capy-ai capy-ai Bot closed this Nov 22, 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.

design setup: rejects new-format Gemini API keys ("AQ…"), only accepts "AIza…"

1 participant