Repository navigation
Studio (Windows): read a runtime lock held by an elevated Unsloth process as busy, not a broken install - #13301
Merged
Merged
Conversation
…cess as busy, not a broken install
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. |
Member
Author
|
@codex review |
Member
Author
|
@codex security review |
|
Codex Review: Didn't find any major issues. Nice work! 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 Oct 11, 2026
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 #9928 (Symptom 2: desktop auto-repair stuck on the runtime lock).
The defect
The desktop app and the CLI open the managed environment's runtime lock (
Global\UnslothStudioManagedEnvironment-<SID>) withCreateMutexW. When the name already exists,CreateMutexWasks forMUTEX_ALL_ACCESS. If the lock is held by an Unsloth process running as administrator (for exampleinstall.ps1from an elevated PowerShell, which keeps the lock until it exits, including while it waits at "Start Unsloth Studio now?"), a normal desktop process is refused that access and the call fails withERROR_ACCESS_DENIED:The lock is simply held, but error 5 never reaches the busy path. Preflight's probe reports the CLI as unusable, auto-repair starts, the update fails on the same error, the bundled installer (whose .NET
Mutexalready falls back to reduced rights) correctly reports "busy", and repair fails. The same thing repeats on every launch for as long as the elevated process lives.The change
Open the lock with only the rights it uses,
SYNCHRONIZE | MUTEX_MODIFY_STATE(wait and release), viaCreateMutexExW, in bothstudio/src-tauri/src/process.rsandunsloth_cli/_studio_runtime_gate.py. A lock held by an elevated process now reads as busy, which preflight already handles (no auto-repair, the existing wait). Mutex names and all other behaviour are unchanged, soinstall.ps1and older builds interoperate as before. No UI or flow change.Evidence (windows-latest, base = main
fc5cf50, head = this branch)runas /trustlevel:0x20000)OSError winerror=5: Access is deniedStudioRuntimeGateBusySYNCHRONIZE | MUTEX_MODIFY_STATE(Python gate)OSError winerror=5StudioRuntimeGateBusya_holder_that_denies_full_access_reads_as_busyCould not create the Unsloth runtime lock: Access is denied. (os error 5)test_runtime_gate_reads_a_holder_it_cannot_fully_open_as_busy['winerror 5'] == ['blocked']studio_runtime_launch_guard_tests(Rust, Windows)tests/python/test_studio_runtime_gate.py(Windows)The other parts of #9928 are already handled on main: the pydantic-core replace failure during
studio setup/studio updatewas fixed by #9890 (the Windows mutating entry no longer imports pydantic), and the llama.cpp access-denied hint by #10075 and #10182.