Skip to content

fix(plugin-browser): keep browser tools out of child sessions - #63691

Closed
zhejingxu wants to merge 1 commit into
anomalyco:devfrom
zhejingxu:browser-child-tools
Closed

zhejingxu wants to merge 1 commit into
anomalyco:devfrom
zhejingxu:browser-child-tools

Conversation

@zhejingxu

@zhejingxu zhejingxu commented Nov 13, 2026 •

Copy link
Copy Markdown

Issue for this PR

Closes #61238

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Child sessions inherit the parent's browser: allow rule, but the attachment is keyed by the parent's session ID, so browser calls from a child always return [browser.disconnected]. Agents without Code Mode, like explore, still got all browser tools as direct tools.

The browser plugin now registers a session context hook that drops its direct tools when the requesting session has no attachment (connecting or connected). Attached sessions are unchanged. I kept it in the plugin instead of changing how children inherit permissions, since that inheritance is intentional for other host rules.

Tools reached through execute are not filtered here; they still return the existing disconnected error.

#63002 also stops grants leaking to subagents as part of a much larger browser change. This is a small standalone fix for #61238 in the meantime; feel free to close it if #63002 lands first.

How did you verify your code works?

  • New test in packages/core/test/browser-attach.test.ts: after attaching, a child created with parentID still inherits the grant, but its context request keeps only non-browser tools while the parent keeps them all. It fails without the change.
  • bun test in packages/plugin-browser, browser-attach/tool-registry/session-model-request tests in packages/core, and bun typecheck in both packages pass.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@opencodejr opencodejr Bot closed this Nov 13, 2026
@opencodejr

opencodejr Bot commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

Thanks for tracking this down and for the clear write-up and test!

I think this duplicates #63614. It fixes the same bug (#61238, which #63690 was closed as a duplicate of): there, a session prompt hook in the browser plugin removes the inherited browser grant from a child session that has no attachment of its own. Subagents like explore then stop getting the browser tools, and the leftover grant on the child is removed too.

If you think #63614 misses something you covered here, it would help a lot to review or test it and comment there. One example is the enum schema rejection from your gateway on direct tools.

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.

Subagents inherit the Desktop browser grant but can't use the parent's attachment

1 participant