Repository navigation
Studio: let Allow microphone recover from a saved "Don't allow" on Windows - #9006
Conversation
…ndows WebView2 saves a denied microphone prompt in its profile and ships no site-settings UI, so one accidental "Don't allow" blocked dictation permanently. The profile survives reinstalls, and because the request never reaches the OS, Windows privacy settings never list the app to toggle either, which leaves the user with nothing to undo it (#9001). Allow microphone now clears that saved answer before it asks. The reset only erases the stored decision, never grants access: the next getUserMedia raises the same prompt the first one did. It is best effort, since a browser tab has no command to call and a WebView2 runtime older than the permission APIs has nothing to clear, and in both cases the request is still worth attempting. The blocked-microphone messages also stop pointing desktop users at browser site permissions, which the desktop WebView has no UI for.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8aafa6ae0d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
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".
| micAccessBlocked: | ||
| "Microphone access was blocked. Allow microphone access for this Unsloth page, then try again.", | ||
| "Microphone access was blocked. Click Allow microphone to be asked again.", |
There was a problem hiding this comment.
Keep browser denial recovery instructions
In a normal browser tab, resetMicrophonePermission() immediately returns because isTauri is false, so a saved denial remains in effect and clicking Allow microphone generally rejects again without showing a prompt. Since this shared message is also rendered outside the desktop app, replacing the previous site-permission guidance misdirects browser users; keep the original browser wording or select the message based on isTauri.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Right, and fixed in 832effb. The premise holds: resetMicrophonePermission returns at if (!isTauri) return;, so a browser tab keeps its saved deny and clicking the button rejects again with no prompt. Telling those users they will be asked again was wrong, and Studio runs in a browser tab as often as it runs in the desktop app.
There was a second problem in the same change that the comment surfaces indirectly: I had only reworded en.ts, so English disagreed with all eleven other locales, which still carried the page-permission wording. micAccessBlocked now goes back to that wording everywhere, and a new micAccessBlockedDesktop covers the desktop build, selected on isTauri at the call site the way the dictation adapter already does.
I worded the desktop message as the retry plus the system privacy settings rather than naming the WebView2 prompt, because the reset is a deliberate no-op on macOS and Linux: WKWebView defers to the system permission and webkit2gtk asks per session. So the one string holds on all three desktop platforms.
Added to all twelve locales, since i18n:check:strict fails on an en-only key. Three new tests, each mutation checked: collapsing the toast back to one message fails the selection test, restoring the desktop wording on the shared key fails the browser-copy test, and dropping the key from a single locale fails the coverage test and the parity check.
micAccessBlocked is shown in Settings > Voice on the desktop app and in a browser tab, and the reset behind Allow microphone only exists on the desktop: resetMicrophonePermission returns early when isTauri is false. So a browser keeps its saved deny, clicking the button rejects again with no prompt, and telling those users they will be asked again is wrong. The shared key goes back to the page-permission wording every other locale already carried, and a new micAccessBlockedDesktop covers the desktop build. Its text names the retry and the system privacy settings, so it also holds on macOS and Linux, where the reset is a deliberate no-op. Added to all twelve locales, since strict parity fails on an en-only key.
|
@codex 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". |
Fixes #9001.
What happens
The reporter clicked "Don't allow" on the microphone prompt and could not find a way back. They are right that this is ours rather than Windows.
The desktop app runs on WebView2, and WebView2 saves the answer to a permission prompt in its profile. Once "Don't allow" is stored, nothing in Unsloth undoes it:
PermissionRequested,SetPermissionStateandICoreWebView2Profileappear nowhere insrc-tauri.clear_webview_cachesdeliberately clears onlyCache,Code Cache,GPUCacheandService Worker, keeping storage, and the profile lives in%LOCALAPPDATA%\ai.unsloth.studio\EBWebViewwhich the uninstaller does not touch.macOS and Linux do not have this trap: WKWebView defers to the system permission, which System Settings exposes, and webkit2gtk asks per session.
The change
reset_microphone_permissioncommand. On Windows it callsICoreWebView2Profile4::SetPermissionState(MICROPHONE, origin, DEFAULT), which erases the saved answer. It never grants anything, so consent still comes from the prompt the next request raises. It is a no-op elsewhere.getUserMedia, so the button does what it says on the first click instead of being refused from stored state.getUserMediais still worth attempting.permission_originrefuses URLs thatSetPermissionStatewould reject withE_INVALIDARG.Verification
The Windows path cannot run on the machine I develop on, so I verified it in the two places that carry the risk:
x86_64-pc-windows-msvcagainst the pinnedwebview2-com 0.38, which checks the interface casts, the completion-handler closure type,&HSTRINGas thePCWSTRargument and the enum constants. The app's full Windows cross-check is not possible here becauseaws-lc-sysneeds a Windows C toolchain.with_webviewhop, the channel and the timeout.webview.controller()returningICoreWebView2Controlleris already relied on bysetup_windows_browser_guards, so that junction is not new.Tests: 2 Rust cases for origin derivation, 6 frontend cases covering the desktop reset, the browser no-op, a rejecting runtime, ordering of the reset before the request, the message change, and command registration. The four that can regress silently fail when the fix is reverted.
cargo test356 passed, frontend suite 2882 passed,i18n:check:strictandtypecheckclean, and the two eslint errors in the dictation adapter are pre-existing on main.Worth a follow-up
Camera and notification prompts have the same shape and the same missing handler, so the next one of those to be added will land users in the same dead end.