Repository navigation
Studio: download image model assets without loading - #10789
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Two of the three failures here are not yours. Two things are yours, and both are in the same new file:
Rebase once #10832 is in and the rest should clear. |
🛡️ Codex Security Review · Automatically triggeredSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
8b8389d to
06f357e
Compare
🛡️ Codex Security Review · Automatically triggeredSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
🛡️ Codex Security Review · Automatically triggeredSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
🛡️ Codex Security Review · Automatically triggeredSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
A ?model= arrival claimed the page even in Download only mode, revoking the token of a load that was already staging so resumePendingLoad dropped it once its files arrived. A refused Download only pick called abandonPick(), which reverts and clears the rollback slot that staged load owns.
…solved download-only pick The dense transformer shards are already excluded for a GGUF pick, so a prequant lookup that fails leaves a plan naming neither transformer source while calling itself complete: Download only reported success and the load still pulled multi-GB inline. And an unresolvable GGUF filename reverted the staged load's own baseline through onNotStarted.
The busy guard exists because the backend 409s a second load. A download-only pick submits none, and the selector stays interactive during a generation, so picking a model to download there was a silent dead click.
# Conflicts: # .github/workflows/studio-ui-smoke.yml
/images/download-plan validates exactly as /images/load does, so an unrecognised repo is refused with a 400 before the planner is reached and the page surfaces the reason: Download only never sees an empty plan for one. The checkpoint fallback I added for that case could not run, so it is gone, and a route test now records why the empty-plan branch is the right answer.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4794c89961
ℹ️ 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".
| if (startQueuedDownload()) return; | ||
| resumePendingLoad(); |
There was a problem hiding this comment.
Resume the completed staged load before queued downloads
When a normal load is staging and the user then queues one or more Download-only selections, completion of the normal plan takes this branch and starts the later download queue instead of calling resumePendingLoad(). The model the user asked to load therefore remains unloaded until every subsequently queued model—potentially many gigabytes—finishes downloading. Resume the ready load first; the download-only queue can start alongside or after that load.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
The problem is real, but I am deferring the fix rather than shipping the obvious one, because I measured it and it is worse.
Two attempts, both against this PR's own regression driver (playwright_image_download_queue.py, PW_LOAD_SECOND=1 PW_HOLD_FIRST_PLAN=1, Chromium, 6 runs each):
- resume the load first, then start the queue alongside it: 1/6 pass (baseline 6/6).
- resume the load first and chain the queue onto its completion: 3/6 pass.
The failure is not the assertion order, it is a wedged transfer: the queued job starts its checkpoint and its companion never starts at all (starts ends at 3 of 4, one job left 'running' on a single poll). Both the load and the queue go through the one 'diffusion' staging scope, and handing that scope over at load time leaves a job stranded mid-transfer.
So the honest position for this PR: a load queued behind download-only picks waits for them, which is a delay, and the alternative as written loses downloads outright. Making the load pre-empt the queue safely needs the staging scope to support handover, which is a change to useStagedDownload rather than to this page, and belongs in its own PR. Filing it as a follow-up.
| if failures_out is not None: | ||
| failures_out.append(exc) |
There was a problem hiding this comment.
Mark missing prequant filenames as a failed plan
When the configured prequant repository is reachable but its metadata contains neither the primary nor fallback filename, _dit_prequant_plan_source() returns None before this exception-only failure recording runs. The resulting response has plan_failed: false, even though the GGUF plan excluded the dense transformer shards, so Download only reports success without staging either transformer source and a later offline load fails (or downloads inline). Record this successful-lookup-but-missing-artifact path in failures_out as well.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Genuine, and fixed: the successful-lookup-but-missing-artifact path now records into failures_out too, so plan_failed is set and Download only refuses instead of reporting success. The 'no prequant is used' return above it stays silent, which test_a_prequant_repo_missing_its_artifact_marks_the_plan_incomplete and test_a_prequant_lookup_that_finds_nothing_is_not_a_failure pin apart.
The repo answers and holds neither the primary nor the fallback filename. That is not 'no prequant is used': the pick is configured to use one and the dense shards are already excluded for it, so the plan named no transformer source at all while calling itself complete.
|
@codex review |
1 similar comment
|
@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". |
…icked Chat UI Tests (extra) has been failing at the same line on main and on a dozen branches since #10789 added the download-only pass: `Locator.click: Timeout 30000ms exceeded` on the klein row, and nothing else, because the 30 seconds are spent waiting on a row inside a menu that is no longer open. The picker dismisses on scroll, and this pass opens it with the Advanced panel expanded and two fields just filled, so a late re-render can close it in the frame after it opened. The open is now driven until the menu and the row are both there, without clicking an open picker shut, and the two failure shapes are told apart: a picker that will not stay open, and a picker that is open without the row in it. Either way the message names which.
* Fix the three Backend CI failures on main Backend CI has been red on main across several commits with three separate failures, one per shard. None of them is a real product defect in what the tests cover, but one is a real robustness defect next to it. tests/test_mcp_stdio_sessions.py::test_close_generation_keys_hold_no_secrets closed sessions that were never opened, so no close generation was recorded and its `assert gen_keys` guard was satisfied only by keys earlier tests in the file had left in two module-level maps that are never pruned. Under `--dist load`, which spreads one file across workers, it could run on a worker that left them empty. It now opens a session for the secret URL before each close and asserts on the keys that appear as a result. tests/test_scoped_download_job.py::test_a_full_snapshot_download_reports_no_file_list inherited a running scoped job for the same repo from whatever ran earlier in the process: the download registry is a process global and nothing resets it, and a running scoped job deliberately serializes a full snapshot of that repo, so the full row the test asks for is never created. An autouse fixture retires the repo's jobs around every test in the file. tests/test_account_tool_confinement.py::test_projects_home_under_a_granted_root_hides_other_accounts died with "Exception occurred in preexec_fn". _landlock_rules walks a granted ancestor child by child and the forked child opens each path afterwards, so a path removed in between raised out of preexec_fn and took the whole tool call with it. The tests race each other through the interpreter prefix, but production has the same window against a cache purge, a model delete or an account delete. Landlock denies by default, so a grant that vanished is now dropped rather than fatal, and a test covers that directly. * Reopen the image picker if it is dismissed before the klein row is clicked Chat UI Tests (extra) has been failing at the same line on main and on a dozen branches since #10789 added the download-only pass: `Locator.click: Timeout 30000ms exceeded` on the klein row, and nothing else, because the 30 seconds are spent waiting on a row inside a menu that is no longer open. The picker dismisses on scroll, and this pass opens it with the Advanced panel expanded and two fields just filled, so a late re-render can close it in the frame after it opened. The open is now driven until the menu and the row are both there, without clicking an open picker shut, and the two failure shapes are told apart: a picker that will not stay open, and a picker that is open without the row in it. Either way the message names which. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* Allow downloading image assets without loading a model * Preserve download-only picks across page switches * Preserve download planning errors and ownership across eject * Preserve complete image download plans across selections * Keep download intent through GGUF filename resolution * Serialize late image plans behind active staged files * Run download-only retry modes in Studio UI checks * Avoid restaging completed image load assets * Follow the staged-load continuation in rollback checks * Stop a Download only pick from stranding a staged load handleModelSelect called beginPick() and pickGuard.claim() before it looked at the selection mode, and loadGgufRepoPick did the same. beginPick drops pendingStagedLoad, pendingLoadEntries, stagedLoadDeferred and stagedQuantRevert, and the claim makes the staged load's token stale, so resumePendingLoad refuses it afterwards. Picking a second model in Download only mode therefore retired a load that was already downloading: the first model finished downloading and then never loaded, with no toast and nothing to retry from. loadOrStage cleared the same refs a second time on its way in, so fixing one site alone would not have been enough. A download-only pick now claims nothing and retires nothing. It carries no pick token (undefined from handleModelSelect, 0 from the repo-level path), which also means it can no longer be undone by an eject: pendingDownloadPick and its exception in dropResidentState are gone. That exception was inert anyway, since the marker was cleared in a finally that ran when the PLAN resolved rather than when the download finished, so it covered a few hundred milliseconds of a multi-minute transfer. Two more in the same path: - The direct local .gguf and .safetensors branches lost the pickGuard.holds(token) guard their five siblings have when they moved from handleLoad to loadOrStage, so a superseded pick could revert the optimistic label over a newer one. quantRevert is one slot. - Two picks of the same model queued the same file set twice and downloaded every byte twice; the second start could also come back "busy" against the first and be dropped silently. Queued plans are now deduplicated by their file set. owns() had a download-only arm that read like protection and provided none (the token was claimed microseconds earlier, so isLatest was always true); it says what it means now. Three source contracts cover the above and all three fail on the previous revision. Verified on this Linux host against a vite preview of the built frontend: the five CI variants of tests/studio/playwright_image_download_queue.py green in Chromium 151, Google Chrome 147, Microsoft Edge 151, Firefox 153 and WebKit 26.5, 25 runs, 0 failures. Frontend typecheck, the 7540 node unit tests and 182 picker contracts pass; test_diffusion_routes.py and the legacy install/upgrade simulations pass. The remaining local failures (fastmcp floor, one video download-plan partition case) reproduce identically on main at 66a38c7. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Plan the checkpoint of an unrecognised GGUF pick Download only had nothing to download for a repo whose id and filename match no family: the planner returned an empty plan, so the action reported a benign no-op and fetched nothing. The selected file is still knowable, so plan it, with the same cache probe and best-effort sizing the rest of the planner uses. * Assert the route, not the full URL, after a Hub round trip The Hub appends its own ?tab= once it mounts, so an exact-URL assertion loses that race; it failed the download-only cancel/retry driver on CI. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Keep a Download only pick out of the load pick's state Two ways one could damage an ordinary selection that was still in flight: - it advanced pickSeq, so the pending load failed its own stale check after its plan returned and gave up silently, leaving that model neither staged nor loaded; - it installed an optimistic label into quantRevert, the single slot the staged load owns, then reverted it, restoring the previous resident's quant and recipe under a load that was still coming and leaving it nothing to commit. A Download only pick now takes no sequence number and installs no label. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Leave a staged load alone when a routed or refused pick is download-only A ?model= arrival claimed the page even in Download only mode, revoking the token of a load that was already staging so resumePendingLoad dropped it once its files arrived. A refused Download only pick called abandonPick(), which reverts and clears the rollback slot that staged load owns. * Report a swallowed prequant lookup, and hand nothing back for an unresolved download-only pick The dense transformer shards are already excluded for a GGUF pick, so a prequant lookup that fails leaves a plan naming neither transformer source while calling itself complete: Download only reported success and the load still pulled multi-GB inline. And an unresolvable GGUF filename reverted the staged load's own baseline through onNotStarted. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Let a Download only pick through while the page is busy The busy guard exists because the backend 409s a second load. A download-only pick submits none, and the selector stays interactive during a generation, so picking a model to download there was a silent dead click. * Drop the unreachable unrecognised-GGUF plan branch /images/download-plan validates exactly as /images/load does, so an unrecognised repo is refused with a 400 before the planner is reached and the page surfaces the reason: Download only never sees an empty plan for one. The checkpoint fallback I added for that case could not run, so it is gone, and a route test now records why the empty-plan branch is the right answer. * Report a prequant repo that is missing its artifact The repo answers and holds neither the primary nor the fallback filename. That is not 'no prequant is used': the pick is configured to use one and the dense shards are already excluded for it, so the plan named no transformer source at all while calling itself complete. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: danielhanchen <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* Fix the three Backend CI failures on main Backend CI has been red on main across several commits with three separate failures, one per shard. None of them is a real product defect in what the tests cover, but one is a real robustness defect next to it. tests/test_mcp_stdio_sessions.py::test_close_generation_keys_hold_no_secrets closed sessions that were never opened, so no close generation was recorded and its `assert gen_keys` guard was satisfied only by keys earlier tests in the file had left in two module-level maps that are never pruned. Under `--dist load`, which spreads one file across workers, it could run on a worker that left them empty. It now opens a session for the secret URL before each close and asserts on the keys that appear as a result. tests/test_scoped_download_job.py::test_a_full_snapshot_download_reports_no_file_list inherited a running scoped job for the same repo from whatever ran earlier in the process: the download registry is a process global and nothing resets it, and a running scoped job deliberately serializes a full snapshot of that repo, so the full row the test asks for is never created. An autouse fixture retires the repo's jobs around every test in the file. tests/test_account_tool_confinement.py::test_projects_home_under_a_granted_root_hides_other_accounts died with "Exception occurred in preexec_fn". _landlock_rules walks a granted ancestor child by child and the forked child opens each path afterwards, so a path removed in between raised out of preexec_fn and took the whole tool call with it. The tests race each other through the interpreter prefix, but production has the same window against a cache purge, a model delete or an account delete. Landlock denies by default, so a grant that vanished is now dropped rather than fatal, and a test covers that directly. * Reopen the image picker if it is dismissed before the klein row is clicked Chat UI Tests (extra) has been failing at the same line on main and on a dozen branches since unslothai#10789 added the download-only pass: `Locator.click: Timeout 30000ms exceeded` on the klein row, and nothing else, because the 30 seconds are spent waiting on a row inside a menu that is no longer open. The picker dismisses on scroll, and this pass opens it with the Advanced panel expanded and two fields just filled, so a late re-render can close it in the frame after it opened. The open is now driven until the menu and the row are both there, without clicking an open picker shut, and the two failure shapes are told apart: a picker that will not stay open, and a picker that is open without the row in it. Either way the message names which. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Selecting an image model previously downloaded its missing requirements and then loaded it automatically. Add an On model selection control with Download and load as the default and an explicit Download only option.
Download only uses the existing cache-aware planner and download manager for checkpoint and companion files. It restores the resident selection immediately, preserves generation settings, supports cancellation and retry, and continues across page switches and resident-model ejection. Each accepted selection keeps its filename resolution and complete download plan when later selections arrive. The original settings and action are captured before a slow GGUF lookup, so its delayed result neither changes them nor replaces a newer pending load.
Staging uses one queue to avoid competing requests for shared companion files. A late plan waits behind the active staged file set, including a different quantization being downloaded for a normal load. Completing or cancelling that active plan cannot discard a download-only plan that has not started. A later load selection waits for accepted download-only plans to finish staging; newer selections can still replace that pending load intent. Cancellation and errors belong to the active load token, so they cannot erase a newer pending selection. Ordinary load selections still cancel on eject. Reapply and adapter deployment remain explicit load actions.
Completion clears staged entries only for the load that finished. After queued downloads finish, that prepared load starts without staging its files again. A newer selection keeps its own required files, and a hidden page waits until it is shown before loading.
Planning failures and incomplete metadata report an error without falling back to loading. The backend response model preserves the planner's
plan_failedfield; planners that omit it retain the default false value.Addresses standalone Required Assets preparation in #10716. This is separate from #10709's presentation of cached companion assets in the Hub inventory.
Validation:
42b8463because it still counted the old inline callback. It now checks the visible continuation and deferred effect separately, retaining the load-result and selection-ownership rollback guards.21331c0: Q8 and its companion were requested twice. The current code requests the four files required by the two plans and loads once.Checks used the isolated workspace environment on macOS with simulated backend/model data. Browser checks were not repeated for this test-only update. WebKit is not shipping Safari; Linux, Windows and real GPU throughput were not measured. The shared downloader, inference kernels and hardware policies are unchanged. No full suites were run and no CI completion was awaited.
Before / after
Two isolated Studio installs built from the PR's own merge base and head, photographed by the same scene on an idle Studio (no model, no weights, no GPU). The Advanced disclosure goes from five selects to six: On model selection heads the panel, reads Download and load, and offers Download only. The default is the old behaviour, so an existing install that never opens this panel is unaffected.