Repository navigation
v1.92.11.0 feat: design mockups with Gemini when there's no OpenAI key (#990) - #3768
Conversation
… OpenAI key (#990) Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…et-shaped assignments Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…rovider export; Gemini iterate fallback tests) Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…ds only absolute-path PNGs under 15 MB; sessions store absolute output paths Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
|
😎 This pull request was merged. |
E2E Evals: ✅ PASS2 executed, 0 reused rule/judge records | 0 manual accepted (unscored; no score-cache credit) | $.14 rule/judge cost | reconcile exit: 0 Profile: pr / mode Rule and judge shards
Fail-closed reconciliationSliced lane: planner → duration-packed executors → fail-closed report. Behavior cases run a pre-registered 3-trial panel (PASS at 2/3 with no contract violation); a PASS 2/3 is shown with its failed trial, never as a clean pass. Reused results retain their original provenance and expiry. Dispatched narrow screen (gstack-ship-queue ready --screen) of merge commit |
What changed
Before: a Gemini key alone fails with 'No OpenAI API key found' and the design skills draw wireframes. After: the design binary uses Gemini and saves the mockup (Google's answer stubbed locally for this capture, no network).
Before/after as text: Before: a Gemini key alone fails with 'No OpenAI API key found' and the design skills draw wireframes. After: the design binary uses Gemini and saves the mockup (Google's answer stubbed locally for this capture, no network; session ids shortened).
Why
Issue #990: "non-OpenAI image providers in design". Without an OpenAI key, or with an OpenAI organization that hasn't passed ID verification (now required for every OpenAI image model),
/design-shotgun,/design-review,/plan-design-reviewand/design-htmlfall back to HTML wireframes. Gemini keys are free to create and need no ID check, so the design binary now uses Gemini when no OpenAI key is set, and anyone with an OpenAI key sees no change.Blast radius
Every design command (
generate,variants,iterate,evolve,check,diff,extract,prompt,setup) now goes through one provider seam indesign/src/provider.ts. OpenAI stays first whenever its key resolves (config file, then env), and OpenAI requests are still built by the same body builders as on main, so OpenAI users' requests don't change:design/test/(222 tests, including the existing OpenAI suites) passes unchanged except one expected-message string (script ran).Approvals
Source: gstack-approvals record for capy/gsta223-design-gemini (display only; not an approval citation).
Summary
Before this change,
GEMINI_API_KEYalone gave "No OpenAI API key found" (failing-first test on main 2d1b55d: expected exit 0, got 2). Now:GSTACK_DESIGN_PROVIDER=openai|geminiwhen set, else an OpenAI key (~/.gstack/openai.json, thenOPENAI_API_KEY), else a Gemini key (~/.gstack/gemini.json, thenGEMINI_API_KEY). A failure on one provider is never retried on the other; the OpenAI verification error names the switch.models/<m>:generateContent(responseModalities: ["IMAGE"], aspect ratio from the size); screenshot reading uses Google's OpenAI-compatible Chat Completions endpoint. Defaults:gemini-nano-banana-2.1(image),gemini-3.8-flash(vision); overrides must begemini-…names.iterateon Gemini edits the last image and regenerates only on a 400.variantshonors Gemini's RetryInfo and stops retrying a daily quota.$D setup --provider openai|gemini --key-stdinstores a key with no terminal; when OpenAI would still win later runs, setup prints the export that switches.design-gemini(fail-open, likedesign-openai).Not checked against the live API. No Gemini key exists on the crew machines (decision E1). Request and response shapes follow Google's docs (fetched 2026-10-31) and the fixtures in
design/test/gemini-provider.test.ts.GEMINI_API_KEY=... bun run design/scripts/live-gemini-check.ts(about $0.04) checks the defaults once a key exists; that and a JPEG answer (refused today) are filed in TODOS.md.Security read. New network call:
generativelanguage.googleapis.com(needed: it is the provider). New secret: the Gemini key, read from~/.gstack/gemini.json(written 0600 from creation) orGEMINI_API_KEY; it travels only in thex-goog-api-keyheader (Authorization Bearer on the OpenAI-compatible endpoint), never in a URL or log line, andOPENAI_BASE_URLnever applies to Gemini. On Google's free tier, prompts and images may be used to improve Google's products;$Dsays so once per run.iterateuploads the session's last image only when it is an absolute-path PNG under 15 MB. No dependency, workflow, setup or install change. Ideas credited from #990, #998, #946, #881 and #777; no outside code was checked out, run or carried over.Test Coverage
Coverage: deterministic (each of 20 changed runtime files has a changed test naming it). New:
design/test/gemini-provider.test.ts(fake Gemini, no network).Tests ran: design 222
Tests ran: egress 295
Remote free tier (Ubicloud, tree 5ae08b75bf27): 18631 tests, 0 failed.
Pre-Landing Review
REVIEW_LOOP: passes=1 blocking_found=0 deferred=0 noted=1 fixed=4 scope=frozen fix_checks=2 dispatches=3 est_input_tokens=89609
Pass 1 (specialists, Red Team, QA): 3 informational findings, all fixed:
setup --key-stdindropped a piped key when another key resolved;setup --provider geminiclaimed success while later runs still picked OpenAI (now prints the export); Gemini iterate fallbacks had no tests. Step 11 (native adversarial, outside voice on gpt-6.1-sol, targeted money/auth/secret): three findings labeled critical, all fixed before release: a thinking Gemini answer could save an interim draft (now the last non-thought image part); iterate could upload any file a session JSON named (now absolute-path PNG under 15 MB only); relative session paths reopened against another working directory (sessions now store absolute paths). Two fix-checks read the fixed hunks; the targeted reader at the final tree found nothing.Gate edits: none detected (5 listed, 2 read; patterns: RH-1,RH-3,RH-4,RH-12,RH-13,RH-14,RH-15,RH-16; unlisted idioms: none)
Outside review: completed (openai/gpt-6.1-sol), finding fixed.
Review notes
GEMINI_API_KEYis set is approved plan decision 1; the once-per-run data notice is the disclosure.$D checkstill reports a failed vision call aspass: true, status: "skipped"on both providers, as on main; filed in TODOS.md as its own decision.Exploratory QA
Smoke (2 of 12 probes, both pass): the changed tests exit 0;
$D generatewith no key exits 2 with "No image API key found (OpenAI or Gemini)", the Fix line andsaved: []. No live-key success path (no key).Design Review
No frontend files changed — design review skipped.
Eval Results
Two skill templates changed by one sentence each (plan-design-review relays the last
Fix:line; design-html names the provider's vision model); parity and size guards pass at their pins. Paid evals run in CI on this PR (evals.yml, PR profile).Plan Completion
Plan: plans/GSTA-223.md in the GStack Minder drive (autoplan run autoplan-20261031203710, approved). All five build items shipped; the live render stays conditional on a key (B1/E1).
Issues
Fixes #990
TODOS
No TODO items completed in this PR. Added "Gemini design provider follow-ups" (live check,
$D checksemantics) and narrowed the provider-pluralism theme now that Gemini shipped.Documentation
Status: updated. One factual edit, no blockers.
Scope: base 2d1b55d to head 20a04e1 (27 files: Gemini design provider). No staged, unstaged or untracked content. Audited the changed docs and templates plus the README, ARCHITECTURE, CONTRIBUTING, CLAUDE and nested docs that mention the design binary or its API keys.
Documentation health:
docs/CONTRIBUTOR_REFERENCE.md [Updated] (egress fail-open list: 'design OpenAI calls' became 'design OpenAI and Gemini calls')
docs/hosts.md [Current] (Gemini provider section already added)
docs/troubleshooting.md [Current] (new Gemini error anchors already added)
README.md [Current]
ARCHITECTURE.md [Current]
CONTRIBUTING.md [Current]
CLAUDE.md [Current]
docs/PROJECT_STRUCTURE.md [Current]
design-html, plan-design-review and design-shotgun templates [Current]
CHANGELOG.md [Not edited: ship-owned boundary; entry is the changelog.d fragment]
TODOS.md [Not edited: ship-owned boundary; Gemini follow-ups already filed]
Documentation coverage:
Gemini design provider: reference yes (docs/hosts.md), how-to yes (docs/troubleshooting.md), tutorial no, explanation no.
Diagram drift: none found.
Test plan
bun test design/test/: 222 pass, 0 failbun test test/egress-receipt-wiring.test.ts test/troubleshooting-anchors.test.ts: 295 passbun run typecheckclean;bun run typecheck:test814 known, none new; parity and SKILL.md size guards pass