fix(imagegen): bump image-to-image timeout to 180s (was 60s shared with t2i)#19
Merged
fix(imagegen): bump image-to-image timeout to 180s (was 60s shared with t2i)#19
Conversation
…th t2i)
The single 60s timeout on the main /v1/images/{generations,image2image}
fetch covered both x402 retry attempts AND the actual generation. That
budget is generous for text-to-image (gpt-image-1 finishes in 10–30s)
but consistently insufficient for image-to-image:
- gpt-image-2 is reasoning-driven; an edit easily takes 60–150s on its
own
- the request body carries a few MB of base64 reference image, adding
measurable upload time on slower links
- the timeout has to share its budget across two POSTs (the 402 round
trip plus the paid one)
End result: every gpt-image-2 reference-image call I tried hit AbortError
before the upstream model returned, with a misleading message ("Try a
simpler prompt") that made it look like a server problem.
This patch:
- splits the budget — image-to-image gets 180s, text-to-image keeps 60s
- updates the timeout error message to mention the 180s limit and the
most likely causes (image too large, model under load) when the
reference-image path is taken
The existing 30s timeouts on resolveReferenceImage (URL fetch) and on
the result download stay unchanged — those are network-bound and
shouldn't routinely be slow.
KillerQueen-Z
added a commit
that referenced
this pull request
Apr 28, 2026
…timeout UX - New mascot artwork on the empty state: a bigger AI+coin themed Franklin pixel-art portrait. The PNG ships with a flood-filled alpha channel so the mascot composites directly onto whichever theme background sits behind the panel — no rounded-rectangle frame, no mix-blend-mode hack. Original PNG (with the dark frame) also kept on disk as franklin-mascot.png for record / fallback. - Settings popover gains a "Per-turn spend cap (USD)" field. Empty keeps the existing $0.25 default; "0" disables the cap entirely; any positive number sets it. Local mirror of core PR #20. Core (cherry-picks of in-flight PRs) - src/tools/imagegen.ts: image-to-image gets a 180s timeout (was shared 60s with text-to-image — gpt-image-2 edits on a few-MB reference image consistently hit AbortError before completion). Mirror of PR #19. - src/agent/loop.ts + src/commands/config.ts: MAX_TURN_SPEND_USD is no longer hard-coded; reads max-turn-spend-usd from config with fallback to $0.25. Mirror of PR #20. Bumps vscode-extension to 0.4.5; updates README changelog.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The 60s
setTimeouton the main/v1/images/{generations,image2image}fetch insrc/tools/imagegen.tscovers both x402 retry attempts AND the actual generation. That budget is generous for text-to-image but consistently insufficient for image-to-image with gpt-image-2.Root cause
```typescript
const controller = new AbortController();
const timeout = setTimeout(() => controller.abort(), 60_000); // 60s timeout
```
For text-to-image (gpt-image-1, ~10–30s) — fine. For image-to-image (gpt-image-2):
End result: every gpt-image-2 image-to-image call hits `AbortError` before upstream returns, with a misleading error message ("Image generation timed out (60s limit). Try a simpler prompt.") that made it look like a server problem.
Reproduction
```bash
franklin
/model sonnet
Hangs at AbortError every time on a 1–4MB reference image.
Fix
Split the budget by mode:
Also updates the timeout error message so users know the longer limit applies and gives more relevant remediation hints (smaller image / simpler prompt) when the reference-image path was taken.
Out of scope
Test plan
```
src/tools/imagegen.ts | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
```