Skip to content

Studio: Always allow on the browser script prompt saves that site's Scripts rule - #17959

Merged
danielhanchen merged 3 commits into
mainfrom
studio-script-prompt-always-allow-site
Nov 16, 2026
Merged

danielhanchen merged 3 commits into
mainfrom
studio-script-prompt-always-allow-site

Conversation

@danielhanchen

@danielhanchen danielhanchen commented Nov 16, 2026 •

Copy link
Copy Markdown
Member

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.

Script prompt before and after

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.

Agent permissions before and after

@danielhanchen danielhanchen self-assigned this Nov 16, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-16T10:50:51.752638Z fb17003 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.

danielhanchen pushed a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Nov 16, 2026
danielhanchen pushed a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Nov 16, 2026
[skip ci]
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

1 similar comment
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

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

Reviewed commit: fb17003a95

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

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.

[Bug] "Open links in: Default browser" is ignored and "Run scripts" re-prompts despite "Always allow"

1 participant