Skip to content

design: bump per-image OpenAI timeout from 120s to 240s#1638

Open
ionianFury wants to merge 1 commit into
garrytan:mainfrom
ionianFury:fix/design-timeout-from-120s-to-240s
Open

design: bump per-image OpenAI timeout from 120s to 240s#1638
ionianFury wants to merge 1 commit into
garrytan:mainfrom
ionianFury:fix/design-timeout-from-120s-to-240s

Conversation

@ionianFury
Copy link
Copy Markdown

Summary

The hardcoded 120s setTimeout(() => controller.abort(), 120_000) in design/src/{generate,iterate,variants,evolve}.ts fires too often against gpt-image-1 at the default quality: "high" + size: "1536x1024". Real session today (mid-2026): all 3 design variants calls timed out at exactly 120s while the OpenAI API was actively processing the request. Direct curl --max-time 240 to the same endpoint with the same payload returned 200 in 33s.

✗ variant-A.png: Timeout (120s)
✗ variant-B.png: Timeout (120s)
✗ variant-C.png: Timeout (120s)
0/3 variants generated (123.0s)

Bumping each call to 240s.

Why 240s

  • Observed gpt-image-1 wall times at high + 1536x1024: typically 60-180s, occasionally 200s+ under provider load.
  • 240s gives ~2x headroom over the typical worst-case while staying under the threshold where users walk away.
  • Lower options I considered: 180s would have caught most spikes but still cliffs in the tail. 240s is the sweet spot.

Sites touched

  • design/src/generate.ts:40
  • design/src/iterate.ts:85, 133
  • design/src/variants.ts:61
  • design/src/evolve.ts:55

Each carries a brief comment pointing back to generate.ts for the rationale.

What I deliberately did NOT change

  • Quality default stays high. That's what produces the polished mockups skill users expect. The timeout was the cliff, not the quality.
  • No shared-constant refactor. Could promote to design/src/constants.ts or a GSTACK_DESIGN_TIMEOUT_MS env var, but I'm keeping this PR small. Happy to follow up if you want the env-var or shared-constant change in a separate PR.

Verification

bun install               # 230 packages, no issues
bun build --compile design/src/cli.ts --outfile /tmp/test-bin
# [120ms] compile /tmp/test-bin → succeeds

No test changes — the timeout itself isn't easily unit-testable without injecting a stub clock or a slow mock fetch, and the existing design/test/ suite doesn't cover it today.

Repro

$D variants --brief "<any dense brief>" --count 3 --output-dir /tmp/
# Reliably reproduces 120s timeouts on busy OpenAI hours

(Filed by ionianFury — happened to me mid-/plan-design-review today.)

The hardcoded 120-second abort in design/src/{generate,iterate,variants,evolve}.ts
fires too often against the gpt-image-1 image_generation tool at the
default quality:"high" + size:"1536x1024". A real session today had
all 3 `variants` calls timeout at exactly 120s while the OpenAI API
was actively processing — direct curl with max-time 240s returned 200
in 33s.

Bumping each call to 240s gives ~2x headroom over typical worst-case
(60-180s observed) while staying under user patience. Quality default
unchanged — high is what produces the polished mockups users expect;
the timeout was the cliff, not the quality.

Touches 5 sites:
- design/src/generate.ts:40
- design/src/iterate.ts:85, 133
- design/src/variants.ts:61
- design/src/evolve.ts:55

All carry an inline comment explaining the picked value. A future
follow-up could promote this to an env var (GSTACK_DESIGN_TIMEOUT_MS)
or a shared constant in design/src/constants.ts, but I'm keeping this
PR small.

Verified: bun install + bun build --compile design/src/cli.ts succeeds.
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.

1 participant