Repository navigation
Studio: quiet the image and video generation progress polls - #7869
Conversation
|
@codex review |
|
Codex Review: Didn't find any major issues. Keep it up! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
… load polls Two defects in the original change, both found by reviewing it against what the flags promise. --verbose sets both dedup windows to 0 and promises to log every request, but the drop-the-2xx suppressor has no window of its own, so it kept swallowing those paths regardless. It now reads the same signal, and --verbose really does log everything. The image and video load-progress polls were fully suppressed on the reasoning that diffusion.loaded and video.loaded already cover the load. They do not: those fire once the load is finished, and unlike /api/inference/load-progress, whose handler emits inference_load_progress every 10%, these endpoints only read state. A diffusion load runs minutes through download, quantise and compile, so full suppression left no sign it was still moving. They move to the 10s heartbeat instead, which is the shape the rest of that list already uses.
Re-review: measured effect, and two defects this round fixedI measured the actual line rate in a running Studio rather than reasoning about it from the poll intervals, then went looking for cases where the new suppression is wrong rather than merely effective. Two real defects came out, both in code this PR introduced. 1. Before and afterMeasured live in a running Studio, counting access-log lines across the five newly quieted paths:
A 95.7% cut. Reproduced under Chromium, Firefox and WebKit, which matters because the rate is set by the frontend's timers, not by anything server-side. The five paths and the timers behind them:
The two 300ms 2. Is the issue realYes, and it is worth being precise about why the existing dedup did not already handle it. The generic access-log dedup window and the frontend poll interval are both 300ms, so the two beat against each other: every poll is "new" by a millisecond or two. The fix is not a bigger generic window (which would start hiding real request pairs) but a named set of paths whose line means only "still polling", collapsed to a 10s heartbeat. 3. What this round changeda. b. The two diffusion load-progress paths would have gone silent during a load. They were in the full-suppression set on the rationale that the 4. Does merging break anythingThe suppressor is GET-only and 2xx-only, so no mutation, no error and no non-GET request is affected on any path. Every quieted path still logs its first hit and every error; only the repeat 2xx polls collapse. Nothing outside the two literal path sets changes behaviour, so no route this PR does not name can be affected. Operationally the escape hatch is complete in both directions: 5. Verification
6. One thing a path list cannot fix
|
|
@codex review |
Verification summaryTwo changes landed on top of the original fix after a closer look at what the poll channel is actually carrying. Details below. 1. Before and after, measuredDriven against the real
A 10 minute video generation goes from roughly 1,990 access-log lines to 60. Confirmed on a live Studio instance built from this branch and driven through a real browser, in all three engines. The spread before the fix is genuine
Edge and Safari were not run. Edge is Blink and Safari is WebKit, so they track the Chromium and WebKit rows; the dedup is entirely server side and no client can influence it. 2. Is the fix the right shapeThe symptom was real, and the root cause is confirmed: both suppressor lists are exact-string matches, so an unlisted path falls back to the 300ms burst window, which a 300ms poll timer straddles. Measured directly, about 61% of polls survive that window, erratically, because the comparison is decided by float error at that spacing. Raising Heartbeat rather than full suppression is the right call for First change. That same reasoning did not hold for the two Second change. 3. Merge riskObservability only, so the risk is lost signal rather than a crash. Checked:
4. Compatibility, and whether to generalizeBackwards: purely additive to two module-private sets. Nothing outside Forwards is the real question, and the exact-string matching is indeed what caused this. The lists have been amended four times in seven weeks, always reactively, and the rot window here was five hours: the routes landed in #6763 at 12:11 and this was filed at 17:10. I looked hard at generalizing and concluded it should not happen in this change:
The durable fix is to move the declaration to the route, which is viable here: FastAPI populates Tests
The one red check on the previous head, |
|
@codex review |
|
Codex Review: Didn't find any major issues. What shall we delve into next? Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
|
@codex review |
1 similar comment
|
@codex review |
|
Codex Review: Didn't find any major issues. Nice work! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
Generating a single image floods stdout with one access-log line per progress poll:
The Image and Video tabs poll
generate-progressevery 300ms while a job is running, plus a 1s recovery loop, so a one minute generation produces a couple of hundred of these lines and buries everything else.Why the existing suppressors missed it
The access log already has two guards in
studio/backend/loggers/handlers.py, and both are exact-path matches:_QUIET_SUCCESS_PATHSdrops the 2xx line entirely for polls whose signal is carried by real events._QUIET_POLL_PATHScollapses liveness polls to a 10s heartbeat.Everything else falls back to
_ACCESS_LOG_DEDUP_MS, a 300ms burst window meant for the SPA fanning one cache invalidation into several list fetches. A poll running at 300ms or slower always lands just outside that window, so every single request logged.Both lists were written before the image and video routes existed, and those routes live one segment deeper (
/api/inference/images/...,/api/inference/video/...) than the already-listed/api/inference/load-progress, so none of the new polls ever matched. The same applies to the diffusion training status poll.What changed
Added the timer-polled paths to the existing lists. No new mechanism.
Heartbeat every 10s (
_QUIET_POLL_PATHS):/api/inference/images/generate-progress/api/inference/video/generate-progress/api/train/diffusion/statusGeneration is fire-and-forget: the POST returns immediately and the terminal outcome only reaches the UI through these polls, so I kept a pulse rather than dropping them outright.
Suppressed on 2xx (
_QUIET_SUCCESS_PATHS):/api/inference/images/load-progress/api/inference/video/load-progressThese mirror
/api/inference/load-progress, which is already on the list. The load phases are logged bydiffusion.loadedandvideo.loaded.What stays logged
/api/inference/images/status,/api/inference/images/infoand/api/inference/video/status.Tests
Extended
studio/backend/tests/test_logging_middleware.pywith four cases: the polls collapse to one heartbeat, a repeated 500 on the same path logs every time, the load polls are suppressed while a 503 still logs, and the unrelated image and video routes are untouched.studio/backend/tests: 16523 passed, 20 failed, 68 skipped. The 20 failures are pre-existing on main (mcp stdio, openai tool passthrough, live studio_api server tests) and reproduce unchanged on an untouched checkout.studio/backend/hub/tests: 172 passed.