Skip to content

Studio: Run scripts setting and per-site Unlabelled clicks rule for the browser agent - #13529

Merged
danielhanchen merged 23 commits into
mainfrom
studio-browser-script-click-settings
Oct 13, 2026
Merged

danielhanchen merged 23 commits into
mainfrom
studio-browser-script-click-settings

Conversation

@shimmyshimmer

@shimmyshimmer shimmyshimmer commented Oct 13, 2026 •

Copy link
Copy Markdown
Member

Stacked on #13505 (base studio-browser-pointer-actions).

What changes

  • Settings > Browser > Browser use > Run scripts: Ask every time (default) or Never. There is deliberately no Allow: approving each script is the only check a script passes. With Never, browser_evaluate is no longer offered to the model, and the executor refuses an evaluate action that still arrives (The user doesn't let the agent run scripts on pages.).
  • Agent permissions > Unlabelled clicks (default and per site): Requires approval or Always allow. Always allow skips the once-per-site question before clicking or dragging on a target with no role, name or link (a canvas). A site whose Actions rule is Always allow still skips it too, as before.
  • Stored values are checked on load: an unknown scriptAccess (including allow written by hand) reads as ask, and an unknown or missing unlabelled falls back to the default rule's ask, so rules saved before this change keep asking.
  • New strings in all 14 locales; Run scripts is indexed in settings search.

Verification

  • npm run typecheck, npm test (11767 pass), npm run build, npm run i18n:check.
  • tests/browser-agent-gate.test.ts: checkedPermissions / ruleFor for the new field, the turn's tool list without browser_evaluate when scripts are Never, and the durable-gate list still equals the full browser tool set.
  • Isolated Studio (own UNSLOTH_STUDIO_HOME and port) driven with Playwright, seeded with stored scriptAccess: "allow" and a site with unlabelled: "always": both rendered as ask; the Run scripts menu offers only Ask every time and Never; choosing Never and Always allow persisted and survived a reload.

Not tested here

  • A model actually calling browser_evaluate or clicking a canvas end to end (needs a loaded tool-calling model; this host is CPU only). The gate paths are covered by the unit tests and code reading.
  • Desktop (Tauri) build.

Screenshots

Settings > Browser, before (#13505's head) and after this change, each a separate Studio built from its tree:

Run scripts row and Unlabelled clicks rule

…hrough shadow roots, and tie screenshot points to scroll and document
…e links, and let any scroll retire screenshot points
…he browser agent

Settings > Browser gains Run scripts (Ask every time / Never). Never stops offering browser_evaluate and the executor refuses any evaluate that still arrives. Site permissions gain Unlabelled clicks (Requires approval / Always allow), which skips the once-per-site pointer question on canvases and other unnamed targets. Stored values are checked on load: anything unknown reads as ask.
@shimmyshimmer

Copy link
Copy Markdown
Member Author

@codex review

@shimmyshimmer

Copy link
Copy Markdown
Member Author

@codex security review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-13T09:50:16.830403Z 50711f3 New commits
🔒 Security Review ✅ Completed 2026-10-13T04:56:58.880297Z 3981c37 Manual request
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Breezy!

Reviewed commit: 3981c37f01

ℹ️ 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".

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review

Security review completed. No security issues were found in this pull request.

Reviewed commit: 3981c37f01

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@danielhanchen danielhanchen self-assigned this Oct 13, 2026
@danielhanchen

Copy link
Copy Markdown
Member

@codex review

1 similar comment
@danielhanchen

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. What shall we delve into next?

Reviewed commit: 792b39f63e

ℹ️ 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".

Stop a drag whose page navigates mid-drag before it touches the new page,
land the last step on the end point exactly, refuse to press a disabled
control, and recheck the release target after the page's hover and dragover
handlers, as the press already does.
@danielhanchen

Copy link
Copy Markdown
Member

@codex review

1 similar comment
@danielhanchen

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

Reviewed commit: 3ead127b34

ℹ️ 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".

danielhanchen pushed a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Oct 13, 2026
Base automatically changed from studio-browser-pointer-actions to main October 13, 2026 09:47
@danielhanchen
danielhanchen merged commit 3d64021 into main Oct 13, 2026
@danielhanchen
danielhanchen deleted the studio-browser-script-click-settings branch October 13, 2026 10:23
danielhanchen added a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Nov 14, 2026
…thai#16707)

Fixes unslothai#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". unslothai#13529 left
out Allow on purpose, so this keeps "Ask every time" as the default and
makes the hands-off choices explicit:

- **Settings > Browser > Run scripts** now offers `Ask every time`
(default), `Always allow` and `Never`. Picking `Always allow` (or
setting the Default row's Scripts rule to `Always allow`, which also
covers every site) first opens an "Allow all scripts?" confirmation;
Cancel keeps the current setting. With `Always allow` the 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.
- **Agent permissions** gain a **Scripts** rule, on the default row and
per site: `Requires approval` (default) or `Always allow`. With Run
scripts on `Ask every time`, a script on a site whose rule is `Always
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.
- `Never` still removes `browser_evaluate` from the turn and the
executor still refuses it, whatever the site rules say.
- Full access does not cover scripts: only Run scripts or a site's own
Scripts rule skips that prompt, as before.
- Stored values are still checked on load: `scriptAccess` reads `allow`
and `never` as saved and anything else as `ask`; a site rule saved
before this change (no `scripts`) or with an unknown value reads as
`Requires approval`.
- The "auto-allow read-only scripts" idea from the issue is left out: a
script's source can't reliably prove it has no side effects.
- Two new strings (`scriptsColumn`, `scriptsAllowDescription`) in all 25
locale files.

## Tests

- `tests/browser-agent-gate.test.ts`: `scriptRunsWithoutAsking` across
Always allow / Ask / Never, site and subdomain rules, a narrower
subdomain rule winning, a lookalike host, about:blank;
`checkedPermissions` for the new `scripts` field; `browser_evaluate`
stays 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.
- Existing rule literals in `browser-agent-steps.test.ts` and
`browser-settings.test.ts` gain the new field.

## Verification (Windows 11, Ryzen 5 5600H)

- `npm run typecheck`, `npm run i18n:check:strict`: clean.
- `npm test`: 14915 pass, 0 fail.
- Real Settings dialog in headless Chromium (vite + the
`smoke-settings.html` harness): Run scripts lists the three options and
saves `allow`; the warning description appears; the default row and a
newly added site show a Scripts rule; the site's `Always allow` is
saved; both survive a reload; a hand-written `scriptAccess: "yes"` reads
as Ask every time; no page errors.

Not tested here: a model actually calling `browser_evaluate` end to end
in the browser panel (needs a loaded tool-calling model); the skip path
is covered by the `scriptRunsWithoutAsking` unit 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).

![Settings > Browser, permissions
table](https://raw.githubusercontent.com/danielhanchen/unsloth-staging-2/pr-media/pr/16707/pr16707_pair_00-c8bf4a1ad579.png)

Run scripts menu: Ask every time / Never before, Ask every time / Always
allow / Never after.

![Run scripts
options](https://raw.githubusercontent.com/danielhanchen/unsloth-staging-2/pr-media/pr/16707/pr16707_pair_01-bb3439af47e5.png)

Picking Always allow asks for confirmation first. Cancel leaves Run
scripts on Ask every time.

![Allow all scripts
confirmation](https://raw.githubusercontent.com/danielhanchen/unsloth-staging-2/pr-media/pr/16707/pr16707_pair_02-f518ad834b8c.png)

After confirming, the row's description switches to the warning that
models run scripts on any page without asking.

![Run scripts set to Always
allow](https://raw.githubusercontent.com/danielhanchen/unsloth-staging-2/pr-media/pr/16707/pr16707_pair_03-ebc9d92d942b.png)

---------

Co-authored-by: Daniel Han <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants