Repository navigation
Studio: wait for a pending embedding model download instead of failing every linked-folder file - #16722
Conversation
…g every linked-folder file A linked-folder sync that ran while the embedding model's Settings transfer was still pending sent every file to the embedder, each one raised EmbeddingModelDownloadRequiredError, and all of them were saved to the folder's failed-file list, which keeps unchanged failed files out of periodic syncs for 6 hours. The folder stayed failed after the download finished until a manual Rebuild. Before ingesting, the sync now checks whether the model's download is still pending (embeddings.download_required: free when no transfer is pending, otherwise asks the cache-only loader). If it is, the job fails with one job-level "still downloading" message and no file is marked failed, so the next periodic sync indexes the folder once the transfer lands. A download-required error that still happens mid-sync is not saved to the failed-file list, and entries saved that way before this change are retried. Fixes unslothai#16714
…ed-load retry (#16768) ## Summary `Chat UI Tests (extra)` fails on unrelated PRs several times a day at the same place, for example #16722, #16741 and the staging run for #16750: ``` File "tests/studio/playwright_multi_account.py", line 173, in run open_login(page) File "tests/studio/playwright_multi_account.py", line 67, in open_login page.goto(url) playwright._impl._errors.TimeoutError: Page.goto: Timeout 30000ms exceeded. Call log: - navigating to "http://127.0.0.1:18894/login", waiting until "load" ``` #16437 added a recorded retry for exactly this stalled `/login` load, but it never runs in these failures. None of the failing logs print its `WARN: /login did not fire load ...` line, and the whole step lasts about 33 s, i.e. one 30 s timeout. `open_login` gives aborts and timeouts one shared two-attempt budget: right after a log-out the app's own 401 redirect (`redirectToAuth`) aborts the first `goto` with `ERR_ABORTED`, which spends attempt 1, and the stalled load then happens on attempt 2, where it is fatal. ## Change `tests/studio/playwright_multi_account.py`, `open_login` only: - Aborts and timeouts each get their own single retry, so an abort can no longer use up the retry #16437 added for a stalled load. A second abort, a second timeout, or any other error still fails the run as before. - When the abort came from the app's redirect and that redirect has already loaded `/login`, the page is used as it is instead of navigating to `/login` a second time. A redirect that ends anywhere else (for example `/change-password`) still navigates to `/login`. Nothing outside this Playwright driver changes. `tests/studio/test_playwright_multi_account_open_login.py` drives `open_login` with a scripted page and the real Playwright error types: | goto outcomes | expected | |---|---| | abort, redirect already on `/login` | returns after one goto | | abort elsewhere, timeout, load | returns after the third goto (the CI failure) | | abort to `/change-password`, load | navigates to `/login` | | two aborts / two timeouts / abort then two timeouts | raises | | an error other than an abort | raises, no retry | ## Testing - New test: 7 passed. Against the driver on main: 3 failed, including `test_a_timeout_after_an_abort_still_gets_its_retry`, the sequence the CI logs show. - `tests/test_ci_repo_cpu_shards.py`, `tests/studio/test_playwright_suites_run_in_ci.py` and `tests/studio/test_pwsh_calls_use_the_shared_runner.py` pass. --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
# Conflicts: # studio/backend/core/rag/folder_sync.py
…pending marker in tests The pending marker is also set when the user never started the Settings download, so 'still downloading' could wait forever. Folders without auto sync are told to sync again. The new tests left the process-wide resolution memo pending, which broke 7 llama-server embedding tests run after them in the same session. [skip ci]
|
@codex review |
1 similar comment
|
@codex review |
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. |
|
Codex Review: Didn't find any major issues. Delightful! 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. Bravo. 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". |
Fixes #16714
What was wrong
When a linked folder synced while the embedding model's Settings transfer was still pending, every file went to the embedder and each one failed the same
EmbeddingModelDownloadRequiredErrorcheck in_load. All of them were then saved to the folder'sfailed_fileslist, which keeps unchanged failed files out of periodic syncs for 6 hours (#13095). The folder stayed at "N files that couldn't be indexed" after the download finished, until a manual Rebuild.What this changes
embeddings.download_required(model): True while the model's pending-download marker is set and the cache-only loader still can't load it. It costs nothing when no transfer is pending. Otherwise it asks the loader, which retires the marker once the cache is complete, so a finished download reads False.folder_sync._reconcile_folder: before ingesting, if there is work and the download is still pending, the job fails with one job-level message ("The embedding model '...' is not downloaded yet. Indexing starts on its own once its Settings download finishes."; a folder with auto sync off is told to sync again instead). No file is marked failed and the existing index is left as it is. The periodic sync then indexes the folder by itself once the transfer lands, with no Rebuild needed.failed_files, so the next sync retries those files. Entries written that way before this change are no longer held back either, so folders already stuck like the one in the report recover on the next periodic sync.Testing
On Windows 11, Ryzen 5600H, RTX 3050 4 GB, Python 3.12:
tests/test_rag_folder_sync_download_pending.py(8 tests): the check skips the loader when nothing is pending, follows a pending transfer to completion, and leaves other load failures to the documents. The sync waits without marking files, then a periodic sync indexes all of them once the download lands. A Rebuild while pending keeps the existing index. Mid-sync download errors aren't held back, but a genuinely bad file still is. Pre-existing stuck entries retry.run.py --api-only, sentence-transformers on CPU, empty HF cache,RAG_FOLDER_SYNC_INTERVAL_S=5): savedunsloth/bge-small-en-v1.5in Settings (stored withdownload_pending: true), linked a 40-file folder, then started Studio's own download throughPOST /api/hub/downloadand waited, triggering only periodic syncs.40 file(s) could not be indexed, each failing with "is not downloaded yet". After the download completed, the folder still showed 40 failures and 0 documents.ruff checkis clean on the changed files.Not covered: the llama-server embedding backend end to end (no llama-server binary on this machine). Its raise site only switched to the shared message helper.
Follow-up (maintainer)
finish_pending, resolved keeping both).test_rag_embed_llama_server.pyfailed when run after it in one session.