GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(browser): keep a configured browser deny when the desktop attaches by Hona · Pull Request #63614 · anomalyco/opencode

Conversation

@Hona

@Hona Hona commented Nov 12, 2026 •
edited by opencodejr Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

A browser deny in config or an agent definition now holds when the desktop attaches a browser, subagents stop inheriting the attach grant, and a grant left by a killed server is removed at startup.

Fixes #54044, #53294, #56869, #61238, #61609. Builds on #61639 (startup sweep, by @feiiiiii5).

One cause, three bugs

Attaching a browser writes browser:* allow into the session's stored permissions. Session rules are evaluated last, are copied to child sessions, and outlive the process; the attachment itself lives in memory under one session ID.

flowchart LR
  attach["desktop attaches"] --> grant["session rule: browser:* allow"]
  grant -->|"evaluated last"| a["configured deny loses"]
  grant -->|"copied to children"| b["subagent has grant, no browser"]
  grant -->|"stored, no shutdown on SIGKILL"| c["grant with no attachment"]
Loading
Before After
Agent or config denies browser, desktop attached calls run refused with [browser.denied]
tool.use policy on browser never evaluated evaluated (permission.assert) on every call
Subagent of an attached session grant inherited, calls fail as disconnected grant removed when its first prompt is admitted
Server killed while attached grant stays in the session removed at startup, before the RPC registers
No deny configured works on attach, no prompt unchanged

How

  • Deny wins (connection.ts authorize): the plugin records each agent's own rules before it appends its default deny. Before a browser call it refuses if those rules, or the session's rules without the grant, deny browser; then it asserts the permission so policies run.
  • Subagents: a session prompt hook removes the inherited grant from a child that has no attachment of its own, under the attachment lock, before any step runs.
  • Stale grants: each grant is recorded in plugin storage with the host, pid and location that wrote it; a successful revoke deletes the record. Startup revokes records for this location whose process is gone.
// Several servers can share one database: never revoke a live process's grant, or another host's.
function running(owner: typeof GrantOwner.Type) {
  if (owner.host !== hostname()) return true
  ...process.kill(owner.pid, 0)
}

Notes for review

  • Why not core. "Agent denies beat session allows" would also let the plugin's own default deny beat the grant, and ACP relies on session allows overriding agent rules. Doing it in core needs a source on permission rules, a Protocol change.
  • Still listed. A denied agent still sees the browser tools and skill while a desktop is attached; every call is refused. Hiding them needs a per-session gate in core (follow-up).
  • Forks also copy the grant and are not covered.
  • Old grants written before this change have no owner record and are not swept; the session's next attach and detach removes them.
  • refactor(browser): serve the in-app browser's tools from the desktop over client MCP #59477 deletes plugin-browser. Subagent and stale-grant fixes become unnecessary there; the deny fix needs browser rules aliased to the new browser_* tool names.
  • Tests: packages/core/test/browser-permission.test.ts drives the real plugin, config files and permission service with a stand-in desktop.

Visual

<svg xmlns="http://www.w3.org/2000/svg" width="240" height="72" viewBox="0 0 240 72" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round">
  <rect x="10" y="22" width="70" height="28" rx="5" opacity=".5"/>
  <path d="M22 36h46" opacity=".5"/>
  <rect x="160" y="14" width="70" height="44" rx="5" opacity=".5"/>
  <path d="M170 24h36M170 34h50M170 44h28" opacity=".35"/>
  <path d="M84 36h30" opacity=".6" stroke-dasharray="3 5">
    <animate attributeName="stroke-dashoffset" values="16;0" dur="1s" repeatCount="indefinite"/>
  </path>
  <circle cx="134" cy="36" r="14" opacity=".9"/>
  <path d="M124 46l20-20" opacity=".9" stroke-width="2"/>
  <path d="M152 36h4" opacity=".2"/>
  <circle cx="134" cy="36" r="14" opacity="0">
    <animate attributeName="r" values="14;22" dur="2s" repeatCount="indefinite"/>
    <animate attributeName="opacity" values=".5;0" dur="2s" repeatCount="indefinite"/>
  </circle>
</svg>

Added by the opencode bot (AI-generated).

Related: #55795

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Hona and others added 3 commits November 13, 2026 08:16
@Hona
fix(browser): let a configured browser deny win over the desktop's at…
34490b7
…tach grant

Attaching a desktop browser writes browser:* and skill:browser allows into the
session's permissions. Session rules are evaluated after agent rules, so the
grant overrode a browser deny from config, an agent definition (for example a
"*" deny) or the session itself. Browser tools never called the permission
check either, so tool.use policies did not apply.

The plugin now records each agent's rules before it appends its own default
deny. A browser call is refused when those rules, plus the session's rules
without the grant, deny the browser, decided the way core's tool filter decides.
The call then runs the permission check with the operation as its resource, so
permission.evaluate hooks such as tool.use policies apply. Sessions without a
deny behave as before: the grant allows the check, so nothing prompts.

Refs #54044, #53294, #56869
@Hona
fix(browser): revoke the attach grant a subagent inherits from its pa…
5778f64
…rent

A child session copies its parent's permissions, so a subagent spawned from an
attached session got the browser:* and skill:browser allows but no attachment.
It listed the browser tools and the Browser skill, every call failed with
[browser.disconnected], and the copied allow outlived the parent's attachment.

The plugin now revokes the grant from a child session while the child's prompt
is admitted (session prompt hook), before any step of the child can list the
tools, so there is no race with its first step. It holds the attachment lock
while it checks and writes, and skips a child that has an attachment of its own.
A subagent whose agent denies the browser stays denied even when the desktop
attaches to it, through the check from the previous commit.

Refs #61238
@Hona @feiiiiii5
fix(browser): revoke attach grants left behind by a server that was k…
be740a5
…illed

The attach grant is a stored session rule, but its revoke runs only from the
plugin's finalizer. After SIGKILL, a crash or a stop timeout, the session kept
browser:* and skill:browser allows with no attachment behind them, so the next
server listed the browser tools and every call failed with
[browser.disconnected].

Each grant is now recorded in plugin storage with the server process that wrote
it (host and process ID) and its location, before the grant is written; a
successful revoke removes the record. When the plugin starts for a location, and
before it registers the browser RPC so no attach can race it, it revokes the
grants recorded for that location by a process that no longer runs.

Several server processes can share one database (a desktop's server and a
manual `opencode serve` both use opencode.db), so a sweep of every session in
the location could revoke another server's live grant. The sweep skips records
of a running process and of another host, which cannot be checked. Grants
written before this change have no record and are left alone; the next attach
and detach of their session removes them.

The startup sweep before RPC registration, its location scoping and ignoring
per-session failures come from #61639.

Fixes #61609

Co-authored-by: Chen Yufeiyang <[email protected]>
Copilot AI balanced review requested due to automatic review settings November 12, 2026 22:28
Copilot AI reviewed Nov 12, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
opencodejr[bot]
opencodejr Bot reviewed Nov 12, 2026
View reviewed changes

@opencodejr opencodejr Bot left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whole-browser denies, inherited subagent grants and stale grants after a kill are all handled. I checked with the new browser-permission tests: 6 of the 7 cases I could run on the base fail there (the eighth needs the new export), and all 8 pass with this PR. bun test in plugin-browser passes, and tsc --noEmit there is clean. The package's typecheck script fails here with Script not found "check", so I couldn't type-check core. I couldn't run an end-to-end repro: the serve + attach RPC script from #61609 got RPC is unavailable: experimental.browser on both checkouts, and the desktop app can't run here.

Public API: unchanged. Browser calls now go through permission.assert, so tool.use policies apply. There is a new [browser.denied] tool error and internal plugin storage keys (grant:<sessionID>).

One concern, inline: the pre-check only catches a deny on all of browser. A deny or ask on a single operation is still overridden by the attach grant.

Related: #55795

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread packages/plugin-browser/src/connection.ts
...(configured.get(tool.agent) ?? []),
...(session.permissions ?? []).filter((rule) => !BrowserMachine.isGrant(rule)),
]
if (BrowserMachine.deniesBrowser(rules))

@opencodejr opencodejr Bot Nov 12, 2026

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

deniesBrowser only refuses when the last matching rule is a deny on browser with resource *. Two cases still go through the grant:

  • A deny on one operation, e.g. { action: "browser", resource: "evaluate", effect: "deny" }, or on files.upload. The permission.assert below adds the session's browser:* allow after it, and that allow wins. I checked this with a throwaway test: a browser:tabs.list deny in opencode.json still let browser.tabs.list run with a desktop attached.
  • A configured browser: ask. The grant turns it into a silent allow.

These are probably the next denies users will write. Could this match configured plus the non-grant session rules against browser / operation, the same way assert does, and then refuse on deny or ask on ask, instead of only checking the * case?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@opencodejr opencodejr Bot mentioned this pull request Nov 13, 2026
fix(plugin-browser): keep browser tools out of child sessions #63691
Closed
3 of 6 tasks
@Hona

Hona commented Nov 16, 2026

Copy link
Copy Markdown
Member Author

Folded into #63002, which now carries these fixes (a configured deny or ask wins over the attach grant per operation, subagents do not inherit the grant, stale grants are swept at startup) with the rest of the browser work. Closing in its favour.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Hona Hona closed this Nov 16, 2026
@TotalChris TotalChris mentioned this pull request Nov 17, 2026
agents: browser tools exposed despite agent-level "deny browser" when the agent has execute #54044
Open
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

Copilot code review Copilot
Copilot review effort
Applies to this pull request for everyone.Learn more about Copilot code review.
Copilot left review comments
@opencodejr opencodejr[bot] opencodejr[bot] left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

agents: browser tools exposed despite agent-level "deny browser" when the agent has execute browser tools stay listed after a hard restart leaves a stale session grant Subagents inherit the Desktop browser grant but can't use the parent's attachment browser: config deny for browser permission is overridden by plugin-appended allow rule agents: browser tools exposed despite agent-level "deny browser" when the agent has execute

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@Hona
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.