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.

Reset the permission step's storage at the start of the next document (#12073)

Daniel Han7a2251582fb0
diff --git a/tests/studio/playwright_chat_ui.py b/tests/studio/playwright_chat_ui.py
index c4c3580c537..6b2a39583d6 100644
--- a/tests/studio/playwright_chat_ui.py
+++ b/tests/studio/playwright_chat_ui.py
@@ -244,6 +244,29 @@ def exercise_permission_mode_controls(page, shoot):
expect(item).to_be_visible()
item.click()
+ # Every caller reloads straight after this, and the page being left can still write the level
+ # back in between: a hydrating GET of its own lands after the clear and caches the installation's
+ # level locally. On WebKit that page stayed alive about a second after the clear and its GET came
+ # back 200 (Unsloth UI CI on main at 2c1830830 and 6c19cf007: the fresh profile opened on "Run
+ # automatically", the level the previous engine's run left on the install). So the storage is
+ # set again by an init script at the start of the next document, after the old page is gone
+ # and before the app reads it. sessionStorage carries the instruction across the reload and
+ # the script consumes it, so later navigations are untouched.
+ page.add_init_script(
+ """(() => {
+ const pending = sessionStorage.getItem("__pw_permission_storage");
+ if (pending === null) return;
+ sessionStorage.removeItem("__pw_permission_storage");
+ const legacyValue = JSON.parse(pending);
+ localStorage.removeItem("unsloth_chat_permission_mode");
+ if (legacyValue === null) {
+ localStorage.removeItem("unsloth_chat_confirm_tool_calls");
+ } else {
+ localStorage.setItem("unsloth_chat_confirm_tool_calls", legacyValue);
+ }
+ })();"""
+ )
+
def set_legacy_confirm(legacy_value):
page.evaluate(
"""(legacyValue) => {
@@ -256,6 +279,10 @@ def exercise_permission_mode_controls(page, shoot):
legacyValue,
);
}
+ sessionStorage.setItem(
+ "__pw_permission_storage",
+ JSON.stringify(legacyValue),
+ );
}""",
legacy_value,
)