Skip to content

Browser tools leak into child sessions, so explore gets every browser tool #63690

Closed as duplicate

Description

@zhejingxu

Description

When the desktop browser is attached to a session, subagents started from that session are sent all ~45 browser tools, including the read-only explore agent.

The grant is written to the parent's session.permissions (browser: allow). Session.create copies the parent's permissions to children, and session rules are merged after the agent's rules, so the allow beats explore's * deny. explore has no Code Mode (execute is denied), so Tool.snapshot sends the browser tools as direct tools.

None of them can work in the child: BrowserConnection.target looks up the attachment by the child's session ID, which never has one, so every call returns [browser.disconnected]. The grant also stays on the child after the parent detaches, because the revoke only rewrites the attached session.

I noticed it because the extra schemas broke the subagent entirely: browser_click.count is { "type": "number", "enum": [1, 2] }, which the gateway I use rejects with 400 ... does not accept JSON Schema keyword(s): enum. The main session was fine since there the browser tools are inside execute.

Plugins

None (built-in desktop browser)

OpenCode version

2.2.5 (dev @ fb11429)

Steps to reproduce

  1. Open a session in the desktop app and let the browser attach.
  2. Ask the agent to start an explore subagent.
  3. Look at the child's request: it lists all browser_* tools; calling one returns [browser.disconnected].

Operating System

macOS 26.5.1

Terminal

Desktop app

Activity

  1. opencodejr commented on Nov 13, 2026

    @opencodejr
    Contributor

    Thanks for the detailed analysis. I think this is a duplicate of #61238. It has the same root cause: attaching the desktop browser adds allow rules to the session's permissions, a child session copies its parent's permissions when none are passed (permissions: input.permissions ?? parent?.permissions in packages/core/src/session.ts), and the attachment exists only for the parent's session ID. So subagents see the browser.* tools, but every call fails with [browser.disconnected]. That issue has already been reproduced.

    Possible duplicates and related issues, ordered by likelihood:

    I'm closing this issue now as a duplicate of #61238. Please add your extra findings there: that it reaches explore, where the tools are sent directly rather than through execute; that the enum in the browser_click.count schema makes your gateway reject the subagent's request with a 400; and that the copied grant stays on the child after detaching. They're useful for whoever fixes it. If you think this is a different problem, reply here and the issue will reopen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions