Repository navigation
Studio: let Deep Research wait out a long prompt eval instead of failing at 120s - #17934
Merged
Merged
Conversation
Codex Review Summary: ✅ CompletedThis 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. |
Member
Author
|
@codex review |
1 similar comment
Member
Author
|
@codex review |
|
Codex Review: Didn't find any major issues. More of your lovely PRs please. 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". |
This was referenced Nov 16, 2026
danielhanchen
added a commit
that referenced
this pull request
Nov 16, 2026
…apper above it (rest shard red on main) (#17952) ## Summary `Repo tests (CPU, rest)` fails on current main (seen on #17921, #17934 and the staging run of #17904) in: ``` tests/test_flex_mask_graph_breaks.py::test_compiled_flex_mask_has_no_graph_breaks_and_matches_eager E torch._dynamo.exc.Unsupported: Data-dependent branching E File ".../unsloth_zoo/temporary_patches/misc.py", line 1318, in flex_attention_mask E return original(*bound.args, **bound.kwargs) E File ".../unsloth/import_fixes.py", line 2471, in flex_attention_mask E return original(*args, **kwargs) E File ".../transformers/masking_utils.py", line 685, in flex_attention_mask E if attention_mask is not None and not fast_all(attention_mask): ``` It started with unslothai/unsloth-zoo#2551 (the test passes with zoo at its parent and fails at it). That PR wraps the registered `flex_attention` mask builder to keep the padding `mask_mod` during training, and forwards every call as `original(*bound.args, **bound.kwargs)`, i.e. by position. The wrapper it sits on is Unsloth's `fix_transformers_flex_mask_graph_breaks` patch, which only handled keyword calls: with any positional argument it called transformers directly, so while Dynamo traces the `fast_all(attention_mask)` branch came back and `fullgraph` tracing broke. Both patches are right on their own; the Unsloth one was fragile about how it is called, so this hardens it rather than changing zoo. ## Change - `unsloth/import_fixes.py`: the flex mask patch binds positional arguments to the original's signature and continues with keywords (new helper `_keyword_arguments`, which merges `**kwargs` parameters and returns `None` for anything it cannot express as keywords; then the call goes through unchanged, as before). - `tests/test_flex_mask_graph_breaks.py`: new `test_a_wrapper_forwarding_by_position_keeps_the_compiled_path` registers a wrapper that forwards by position above the patch (as zoo's does) and checks the `fullgraph` compile of a padded batch matches eager. It does not depend on which zoo is installed. ## Testing | unsloth | unsloth_zoo | `test_flex_mask_graph_breaks.py` | |---|---|---| | main | main | 1 failed (the CI failure) | | this PR | main | 4 passed, 1 skipped | | this PR | before #2551 | 4 passed, 1 skipped | | main | before #2551 | 1 failed: the new positional-wrapper test | CPU, torch 2.10, transformers 5.17 (the CI pins for this shard).
This was referenced Nov 16, 2026
danielhanchen
added a commit
that referenced
this pull request
Nov 16, 2026
…he gloo shard (2100 s cap) (#17969) ## Summary `Repo tests (CPU, gloo)` is timing out again: the shard's pytest runs under `timeout --signal=INT 2100` and recent runs were cut off there with nothing failing: | run | result | |---|---| | #17934 (upstream) | 257 passed, 3 skipped in 2089.55 s, exit 124 | | staging run of #17904 | 258 passed, 3 skipped in 2095.11 s, exit 124 | | staging run of #17957 | 251 passed, 1 failed in 2096.44 s, exit 124 | For comparison the same shard ran 241 tests in 1292 s when #17892 merged this morning. Since then #17886 (`test_tp_dpo_peft_ref_adapter_gloo.py`), #17930 (`test_cp_ulysses_media_towers_gloo.py`), `test_cp_ulysses_dynamic_len_gloo.py` and the DeepSeek-V4.1 additions to `test_parallel_deepseek_v41_gloo.py` landed in it, and a slower runner now goes over the cap. Every one of those tests passes; the shard just no longer fits. ## Change - `.github/workflows/studio-backend-ci.yml`: `tests/test_tp_[!n]*gloo*.py` (the non-native tensor parallel files: `tp_env`, `tp_eval`, `tp_full_finetune`, `tp_replica`, `tp_kv_replicated`, `tp_moe_dropout`, `tp_dpo_peft_ref_adapter`, ...; 12 files) moves out of `gloo` into a new `gloo-tp-env` shard. `gloo` keeps its other three globs (19 files). Comment added with the numbers above. - `tests/studio/test_backend_ci_parallel_isolation.py`: the command scan's expected counts go from 15 parallel runs / 10 repo-root shards to 16 / 11, as its message asks when a shard is added. ## Why that split Measured locally on main with the shard's exact command (`-n 4 --dist loadgroup`): 275 passed in 1302.83 s. Of the 40 slowest tests (2815 worker-seconds), 2716 s are in `tests/test_tp_[!n]*gloo*.py`; out of about 5200 worker-seconds in total, so these 12 files are well over half of the shard. Each half now has room under the cap on a slower runner. ## Testing - `tests/test_ci_repo_cpu_shards.py` (every repo test file collected by exactly one shard, every glob matches a file): 15 passed. - All 15 test files that read `studio-backend-ci.yml`: 341 passed, 3 skipped. - The new shard's first run on this PR is the timing check.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #17907
Problem
Deep Research gives every local model call 120 seconds to produce its first token. Studio's
/v1/chat/completionsalready reports a long prompt eval to clients that did not ask for raw progress: while llama-server's prompt processing advances, it sends a: prefill-progressSSE comment, and stays silent (or sends a plain: keep-alive) when it is stalled. Chat generation runs treat that comment as liveness. Deep Research ignored it, so a decision call whose prompt (earlier steps' results plus notes) takes over two minutes to evaluate failed withLocal model never started producing output, even though llama-server was working the whole time.This matches the report: planning and three steps succeed, then a later "Choosing the next step" call fails exactly 120 seconds in, on a 26B MoE GGUF spilled to system RAM on a 6 GB laptop GPU. The decision prompt grows with every step, and the step counter, query history and research state sit before the gathered evidence, so the evidence is re-evaluated in full on every call.
Change
Before the first token, a
: prefill-progresscomment restarts the first-output budget, as: admission-donealready does. Nothing else changes:Tests
studio/backend/tests/test_research_runs_hardening.py:test_prefill_progress_renews_the_first_output_budget: fails on main (ModelFirstOutputTimeout), passes here.test_prefill_progress_after_output_does_not_reset_the_idle_guard: the idle guard still fires after output starts.test_prefill_progress_marker_matches_the_inference_route: pins the comment text to the constant the inference route sends.tests/test_research_runs*.py+tests/test_chat_generation_lease_compat.py: 530 passed.End to end on a real Studio (GGUF-only install, llama-server on CPU, Qwen3-1.7B Q4_K_M, 128-token prompt batches, first-output budget lowered to 60 seconds so a CPU prefill outlasts it):
failedat 63 s:Local model never started producing outputfailedat 12 s, same errorThe probe stream from the same server shows what a research call receives during that prefill:
: prefill-progresscomments while llama-server advances,: keep-alivebetween them, nodata:until the first token.Limit: llama-server reports progress once per prompt batch (2048 tokens by default, and for MoE expert spill), so a machine evaluating under ~17 tokens/second could still spend over 120 seconds inside one batch. A partially offloaded MoE on a discrete GPU runs far faster than that.