Skip to content

Studio: run Detailer inpaints on the image-generation pool - #17188

Merged
danielhanchen merged 3 commits into
mainfrom
dh/detailer-image-executor
Nov 9, 2026
Merged

danielhanchen merged 3 commits into
mainfrom
dh/detailer-image-executor

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

Follow-up to #17108.

What happened

#17108 moved queued image renders off the default asyncio executor onto their own image-generate pool, because a render waits for the one-render slot inside its thread and a few queued renders could hold every default worker, stalling status reads and everything else that uses asyncio.to_thread.

The Detailer pass in the same route was left on asyncio.to_thread. _run_detailer hands backend.generate to the Detailer, and each crop inpaint is a synchronous generate call that waits on the same render slot. So a few Detailer requests queued behind a render still filled the default executor. A reviewer reproduced it with the route's dispatch expression: four Detailer workers blocked on a held slot exhausted a four-worker default executor and a status read timed out after 0.2 s, while the same work dispatched through _image_generate_in_thread left the read responsive.

Fix

Dispatch _run_detailer through _image_generate_in_thread, like the primary render. The caller's context is still copied (account access), and the existing UNSLOTH_DIFFUSION_GENERATE_EXECUTOR=0 switch restores asyncio.to_thread for both.

Tests

studio/backend/tests/test_image_generate_executor.py::test_detailer_inpaints_wait_on_the_image_pool reads how the route awaits _run_detailer: it fails on main (asyncio.to_thread) and passes here. The existing saturation, context and kill switch tests in that file still pass (5 passed).

The Detailer's crop inpaints call backend.generate and wait on the render
slot, so dispatching them through asyncio.to_thread held default executor
workers the same way queued renders did before #17108.
@danielhanchen danielhanchen self-assigned this Nov 9, 2026
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-09T02:44:51.807723Z 704e0af 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. Nice work!

Reviewed commit: 704e0af916

ℹ️ 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".

danielhanchen added a commit that referenced this pull request Nov 9, 2026
…uff-unsloth wheel (#17211)

## Summary

The Backend CI step that installs the pinned `ruff-unsloth` wheel
retries 3 times with 5 s and 10 s gaps. Between 05:19 and 05:40 UTC
today, GitHub served intermittent 504s for the release asset, and every
attempt of an unlucky job landed inside one burst. That turned `Repo
tests (CPU, fsdp2 / gloo-cp / gloo-pp / gloo-tp / rest /
studio-install)` red on #17188, #17191, #17197, #17201 and #17202, while
sibling jobs in the same runs installed the wheel fine a minute later.

This raises the loop to 6 attempts with exponential backoff (10, 20, 40,
80, 160 s, about 5 minutes total). A healthy download still never
sleeps, and a lasting outage still fails the job with the same
`::error::` line, so the fixed-point formatter guard keeps failing
loudly in CI when the wheel is truly unavailable.

## Changes

- `.github/workflows/studio-backend-ci.yml`: 6 attempts, `sleep $((10 <<
(attempt - 1)))`.
- `tests/test_ruff_unsloth_install_retries.py`: runs the step's own
`run:` script under bash with `pip` and `sleep` faked on `PATH`, and
checks that
- 5 failed downloads in a row still install, after at least 300 s of
backoff,
- a download that never recovers still fails the job, in under 10
minutes,
  - a healthy download does not wait at all.

## Testing

- `pytest tests/test_ruff_unsloth_install_retries.py`: 3 passed.
- Against the old step from `main`, the burst test fails with
`ruff-unsloth install failed after 3 attempts`.
- The other tests that read `studio-backend-ci.yml` pass.
@danielhanchen
danielhanchen merged commit 185abcf into main Nov 9, 2026
@danielhanchen
danielhanchen deleted the dh/detailer-image-executor branch November 9, 2026 10:07
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