Skip to content

Studio: do not re-send the image generate POST after a dropped connection - #13790

Merged
oobabooga merged 3 commits into
unslothai:mainfrom
drakeo338:claude/13781-fix
Oct 15, 2026
Merged

oobabooga merged 3 commits into
unslothai:mainfrom
drakeo338:claude/13781-fix

Conversation

@drakeo338

Copy link
Copy Markdown
Contributor

Fixes #13781.

generateDiffusionImage posted to /api/inference/images/generate through authFetch, which retries network errors. When the connection dropped after the backend had started generating, the POST was sent again and the whole generation ran a second time, instead of the dropped reply reaching GenerateResponseLostError (which the caller settles from progress and the gallery). The call now passes retryNetworkErrors: false. I added a test that a dropped generate reply is surfaced as lost and not re-sent; it fails on the parent commit and passes with the change.

AI-assisted (Claude Code).

…tion

The desktop fetch ladder retries a POST that rejects with a TypeError, up
to 3 times. For a synchronous image generate that re-ran the whole
generation, so one click produced 4 runs when the reply was lost.

Pass retryNetworkErrors: false, as cancelDiffusionGeneration already
does, so the dropped reply reaches GenerateResponseLostError and the
caller settles it from progress and the gallery.

Fixes unslothai#13781
@oobabooga

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-15T19:00:14.681541Z 62d761b Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep them coming!

Reviewed commit: a8b7ff9bd6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@oobabooga

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep them coming!

Reviewed commit: 62d761bfc2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@oobabooga

Copy link
Copy Markdown
Member

Thanks @drakeo338! This adds the missing retry opt-out and brings desktop image generation in line with the browser.

The history explains why it belongs here:

Validation on the tree at a8b7ff9bd6:

  • Native Linux desktop app A/B, using a controlled 65-second job and a socket disconnect at 60 seconds: four POSTs and four gallery entries before; one of each after.
  • Recovery and Stop passed in the native app, including Stop after a dropped reply with three runs requested.
  • 12,469 frontend tests, typechecking, and 33 focused backend tests passed.
  • CI on oobabooga/unsloth#376: 83 checks passed; all nine failures were verified unrelated to this PR.

If the POST never reached the backend, the user now gets an error and retries deliberately, as in the browser, instead of risking an automatic duplicate generation.

@oobabooga
oobabooga merged commit 0737d7d into unslothai:main Oct 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Images: slow generate request is re-sent, producing 4 duplicate images

3 participants