Skip to content

Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.

Wait for the stored context length after reload instead of reading it once (#11624)

Daniel Hana468b1b57fcb
diff --git a/tests/studio/playwright_model_config.py b/tests/studio/playwright_model_config.py
index d0861ddf96b..c1550e7aae8 100644
--- a/tests/studio/playwright_model_config.py
+++ b/tests/studio/playwright_model_config.py
@@ -762,12 +762,34 @@ with sync_playwright() as p:
if open_config(popover, MODEL_HINT) is None:
fail("could not reopen run-settings after reload")
else:
- ctx_in = context_input(popover)
- val = ctx_in.input_value() if ctx_in else None
- if _as_int(val) == DISTINCT_CTX:
- info(f"OK persist(reload): Context Length still {val!r} after reload")
+ # The popover can render before the stored per-model config has been applied to it, so a
+ # single read right after opening can see the default. Wait for the stored value; a value
+ # that was really lost never shows up and still fails below.
+ val = None
+ deadline = time.monotonic() + 15
+ while True:
+ ctx_in = context_input(popover)
+ val = ctx_in.input_value() if ctx_in else None
+ if _as_int(val) == DISTINCT_CTX or time.monotonic() >= deadline:
+ break
+ page.wait_for_timeout(250)
+ # The input alone cannot prove the remembered record survived: with the model still loaded
+ # the page seeds the field from the active runtime, which also says 4096. Read the stored
+ # per-model entry again, after the reload, so a lost record fails even if the UI looks right.
+ stored = [
+ e
+ for e in entries_for_model(read_configs())
+ if e.get("customContextLength") == DISTINCT_CTX
+ ]
+ if not stored:
+ fail(
+ "the remembered per-model entry lost customContextLength across reload "
+ f"(entries={json.dumps(entries_for_model(read_configs()))[:400]})"
+ )
+ elif _as_int(val) == DISTINCT_CTX:
+ info(f"OK persist(reload): stored entry and Context Length both {val!r} after reload")
else:
- fail(f"Context Length did not persist across reload (got {val!r})")
+ fail(f"Context Length did not persist across reload (got {val!r} after 15s)")
shoot("07-after-reload")
# ─────────────────────────────────────────────────────