Repository navigation
Studio: Always allow for browser scripts, globally or per site - #16707
danielhanchen merged 6 commits into
Conversation
Settings > Browser > Run scripts gains "Always allow" next to "Ask every time" and "Never", with a description that warns scripts then run on any page without asking. Agent permissions gain a Scripts rule (default and per site: Requires approval / Always allow), so scripts on trusted sites skip the prompt while other sites still ask. Never still refuses scripts everywhere, Full access still does not cover scripts, and a stored value that isn't ask/allow/never still reads as ask. Fixes unslothai#16705
# Conflicts: # studio/frontend/src/features/browser/agent/executor.ts
… Always allow and site Scripts rules; tighten comments
|
@codex review |
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. |
|
Codex Review: Didn't find any major issues. Delightful! 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". |
…iffusers is missing (#17685) ## Summary `(Python 3.13, a-f)` fails on main and on every PR based on it since #17595 (seen on the staging runs for #15275 and #16707): 25 tests in `studio/backend/tests/test_diffusion_vae_canvas.py`, for example ``` tests/test_diffusion_vae_canvas.py:126: in test_constant_grid_matches_the_overlap_add_and_stock_does_not tests/test_diffusion_vae_canvas.py:25: in _image_vae_cls core/inference/diffusion_minimax_h3_image.py:211: in vae_class core/inference/diffusion_minimax_h3_image.py:178: in _load_vendored E ModuleNotFoundError: No module named 'diffusers' ``` `vae_class()` returns diffusers' `AutoencoderKLMiniMaxH3Image` or, failing that, the vendored copy in `studio/backend/vendor/diffusers_minimax_h3_image/`. The vendored file builds on diffusers' own base classes (`from diffusers.configuration_utils import ConfigMixin`, `diffusers.models.attention`, ...), so without diffusers both paths fail. The Studio backend CI shards do not install diffusers. The product code is fine: Studio only reaches this VAE when diffusers is installed. Only the test assumed diffusers was there. One test in the file already guards on it (`pytest.importorskip("diffusers")` at line 439). Reproduced on main with `diffusers` blocked: 25 failed, 3 passed, 2 skipped. ## Change `_image_vae_cls()`, the helper every VAE-building test goes through, calls `pytest.importorskip("diffusers")` first. The tests that do not build the VAE (the bad-output probe and the graph race bookkeeping) still run without diffusers. Test-only change. ## Testing - `diffusers` blocked: 3 passed, 27 skipped. main: 25 failed. - With diffusers installed: 30 passed, same as main.
|
@codex review |
1 similar comment
|
@codex review |
|
Codex Review: Didn't find any major issues. Keep it up! 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". |
…cripts rule (#17959) Fixes #17837 ## Problem When the browser agent wants to run a script on a page, the prompt only offers Deny and Allow. #16707 added hands-off options for scripts, but only in Settings > Browser (Run scripts: Always allow, or a per-site Scripts rule under Agent permissions). Nothing on the prompt leads there. A user who keeps answering the prompt keeps getting it on every script, so a task left running on a trusted site stalls until someone comes back to click Allow again. The "Always allow" answers people give on other prompts (opening a site, sign-ins, risky buttons) never cover scripts, which reads as if Always allow is ignored. ## What changes - The script prompt now also shows **Always allow**, next to Deny and Allow. Clicking it runs the script and saves a Scripts rule of Always allow for the page's own host (`www.` dropped, as the Settings site list does), so later scripts on that site run without asking. Other sites still ask. - The saved rule is the same one a user could set by hand in Settings > Browser > Agent permissions, and can be changed or removed there. - If the site already has its own rule, only its Scripts value changes. - Otherwise a new rule for the host keeps whatever applied there before (Actions, Downloads, Unlabelled clicks from a broader site rule or the defaults) and opens the site without asking, like a site added in Settings. - Always allow on a script prompt stays disabled until the script has been scrolled to the end, as Allow already is. - No button when the page has no host (about:blank) or the site list is full (200 rules); those prompts look and work as before. - Nothing else moves: Run scripts "Never" still removes the tool and the executor still refuses it, Full access still does not cover scripts, and every other prompt type keeps its per-chat Always allow exactly as before. Clicking Always allow again is never needed (the next script on that site is not asked), and saving the same rule twice gives the same stored value. ## Tests - `tests/browser-agent-script-allow.test.ts`: drives the real executor. The script prompt offers Always allow; answering it runs the script, stores `scripts: "allow"` on the existing site rule while keeping its other fields (`downloads: "block"` survives); the next script on that site runs without a prompt; a script on another site still asks and does not run. Fails on main (the prompt offers no Always allow there). - `tests/browser-agent-gate.test.ts`: `scriptSiteRule` saves the page's own host rather than a broader matching rule, keeps the broader rule's fields, updates an existing rule in place, returns null for about:blank and for a full list while still updating a site already on it. Local: `npm run typecheck` clean, `npm test` 16407 tests, 16406 pass, 1 skipped, 0 failures. ## Screenshots Base (`501ad46cb`, merge base) vs this PR, each from its own checkout: the real executor and agent bar in a Vite harness, with only the page answered by a stub (as in the node tests). A script on `shop.example.com` is asked, answered, then a second script on the same site is sent. The script prompt gains Always allow.  Settings > Browser after answering. Before: Allow saves nothing and the second script asks again. After: Always allow adds `shop.example.com` with Scripts set to Always allow, and the second script runs without a prompt. 
Fixes #16705
What changes
The issue asks for a hands-off option for
browser_evaluate, since Run scripts currently offers only "Ask every time" or "Never". #13529 left out Allow on purpose, so this keeps "Ask every time" as the default and makes the hands-off choices explicit:Ask every time(default),Always allowandNever. PickingAlways allow(or setting the Default row's Scripts rule toAlways allow, which also covers every site) first opens an "Allow all scripts?" confirmation; Cancel keeps the current setting. WithAlways allowthe row's description switches to a warning that models run scripts on any page without asking and that a script can read and change anything on the page.Requires approval(default) orAlways allow. With Run scripts onAsk every time, a script on a site whose rule isAlways allow(or a subdomain of it) runs without the prompt; every other site still asks. The most specific site rule wins, as for the other columns, and a page with no host (about:blank) always asks.Neverstill removesbrowser_evaluatefrom the turn and the executor still refuses it, whatever the site rules say.scriptAccessreadsallowandneveras saved and anything else asask; a site rule saved before this change (noscripts) or with an unknown value reads asRequires approval.scriptsColumn,scriptsAllowDescription) in all 25 locale files.Tests
tests/browser-agent-gate.test.ts:scriptRunsWithoutAskingacross Always allow / Ask / Never, site and subdomain rules, a narrower subdomain rule winning, a lookalike host, about:blank;checkedPermissionsfor the newscriptsfield;browser_evaluatestays in the turn under Always allow.tests/browser-sync-across-windows.test.ts:scriptAccess: "allow"written by another window is kept and saved; an unknown value reads as ask.browser-agent-steps.test.tsandbrowser-settings.test.tsgain the new field.Verification (Windows 11, Ryzen 5 5600H)
npm run typecheck,npm run i18n:check:strict: clean.npm test: 14915 pass, 0 fail.smoke-settings.htmlharness): Run scripts lists the three options and savesallow; the warning description appears; the default row and a newly added site show a Scripts rule; the site'sAlways allowis saved; both survive a reload; a hand-writtenscriptAccess: "yes"reads as Ask every time; no page errors.Not tested here: a model actually calling
browser_evaluateend to end in the browser panel (needs a loaded tool-calling model); the skip path is covered by thescriptRunsWithoutAskingunit tests. Desktop (Tauri) build not tried.Screenshots
Settings > Browser, main (
7bf13f21c) on the left, this PR (2525437054) on the right, two separate Studio installs.The Default permissions row gains a Scripts rule (Requires approval by default).
Run scripts menu: Ask every time / Never before, Ask every time / Always allow / Never after.
Picking Always allow asks for confirmation first. Cancel leaves Run scripts on Ask every time.
After confirming, the row's description switches to the warning that models run scripts on any page without asking.