You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Subagents inherit the Desktop browser grant but can't use the parent's attachment #61238
When a Desktop session has the in-app browser attached, its subagents also get the browser.* tools and the Browser skill, but they can't use them. Every call from the child fails as disconnected, so the subagent wastes turns and then falls back to another tool.
plugin-browser/src/connection.ts: attaching the browser to a session grants browser: * and the Browser skill by appending allow rules to that session's permissions. The attachment itself is stored only under that session ID.
core/src/session.ts (Session.create): a child copies parent.permissions when none are passed, so it inherits the allow rules.
core/src/session/context.ts: session permissions are merged after agent permissions, so the inherited allow beats the plugin's default deny. The child sees the tools as available, but there is no attachment for its own session ID.
In my local history, all 5 subagents that hit "disconnected" had the inherited browser allow rules on their session.
Possible fix: don't let attachment grants carry over to children (e.g. strip the browser and Browser-skill allows in child sessions unless the child has its own attachment), or check the attachment when building the tool list instead of relying on the permission alone.
Thanks for the detailed report. I reproduced this on 2.2.0, and it still happens on the latest dev (ff90ed916).
The Desktop app can't run in this sandbox, so I simulated the attach step. The script gives the parent session the same two allow rules the browser plugin adds when the Desktop browser attaches (browser: * and the Browser skill). It then has the main agent start a general subagent, which calls browser.tabs.list in a simulated run.
The subagent's session copies the parent's permissions, including both browser allows.
Its model request lists the browser.* tools and Browser skill.
The call fails with [browser.disconnected] No desktop browser is connected to this session..., because the attachment exists only for the parent's session ID.
This matches your analysis: Session.create copies parent.permissions, and the session's allow rules override the plugin's deny rules for every agent. The recording and screenshot below are from the 2.2.0 run, and the script below reproduces it. A closely related issue is #54044 (browser tools exposed despite an agent-level deny browser), but it happens through a different path.
recording.mp4
Reproduction script (drive.ts)
// Repro for #61238: a subagent inherits the parent's browser grant (session permissions)// but has no browser attachment of its own, so browser.* calls fail as [browser.disconnected].// The Desktop "attach browser" step is simulated by applying exactly the allow rules that// plugin-browser's grant() (packages/plugin-browser/src/connection.ts) appends to the attached session.import{Effect,Stream}from"effect"import{Llm,OpenCodeDriver}from"opencode-drive"constseen: string[]=[]exportdefaultOpenCodeDriver.use({
...(process.env.OC_DEV ? {opencode: {dev: process.env.OC_DEV}} : {}),tui: {recording: true},},({ ui, llm, opencode })=>Effect.gen(function*(){yield*llm.serve((request: any)=>{constmessages: any[]=request.body?.messages??[]constsystem=String(messages[0]?.content??"")if(system.includes("You name conversations"))returnStream.make(Llm.text("Browser test"))constbody=JSON.stringify(request.body)constusers=messages.filter((m)=>m.role==="user").map((m)=>JSON.stringify(m.content))consttool=messages.filter((m)=>m.role==="tool").map((m)=>JSON.stringify(m.content))constexposed=body.includes("browser.tabs")||body.includes("Desktop browser tools")constisChild=users.some((u)=>u.includes("Take a screenshot of example.com"))constisParent=users.some((u)=>u.includes("Start a subagent"))if(isChild){if(tool.length===0){seen.push(`CHILD request: browser tools exposed to subagent = ${exposed}`)returnStream.make(Llm.toolCall({index: 0,id: "call_browser",name: "execute",input: {code: "return await tools.browser.tabs.list({})"}}),Llm.finish("tool-calls"),)}constm=tool.join("\n").match(/\[browser\.[a-z_]+\][^"\\]*/)seen.push(`CHILD browser call result: ${m ? m[0] : tool.join("\n").slice(0,400)}`)returnStream.make(Llm.text(`Subagent browser call failed: ${m ? m[0].slice(0,80) : "unknown"}`))}if(isParent){if(tool.length===0){seen.push(`PARENT request: browser tools exposed = ${exposed}`)returnStream.make(Llm.toolCall({index: 0,id: "call_sub",name: "subagent",input: {agent: "general",description: "Screenshot page",prompt: "Take a screenshot of example.com"}}),Llm.finish("tool-calls"),)}returnStream.make(Llm.text("The subagent could not use the browser."))}returnStream.make(Llm.text("Ready."))})yield*Effect.log("step: hello")yield*ui.submit("hello")yield*ui.waitFor("Ready.",{timeout: 60_000}asany)constsessions: any=yield*opencode.session.list({}asany)constlist: any[]=Array.isArray(sessions) ? sessions : (sessions.data??sessions.items??[])constparent=list[0]// Same rules plugin-browser grant() appends when the Desktop browser attaches.yield*opencode.session.update({sessionID: parent.id,permissions: [
...(parent.permissions??[]),{action: "browser",resource: "*",effect: "allow"},{action: "skill",resource: "browser",effect: "allow"},],}asany)yield*Effect.log("step: subagent prompt")yield*ui.submit("Start a subagent that takes a screenshot of example.com")yield*ui.waitFor("could not use the browser",{timeout: 60_000}asany).pipe(Effect.tapError(()=>Effect.gen(function*(){yield*ui.screenshot("timeout");for(constlineofseen)yield*Effect.log(line)})))constchild: any=yield*opencode.session.list({parentID: parent.id}asany).pipe(Effect.map((r: any)=>(Array.isArray(r) ? r : (r.data??r.items??[]))[0]),Effect.orElseSucceed(()=>undefined),)seen.push(`child session ${child?.id} permissions: ${JSON.stringify(child?.permissions)}`)yield*ui.screenshot("result")for(constlineofseen)yield*Effect.log(line)}),)
Run it with opencode-drive: opencode-drive run ./drive.ts. It drives opencode from your PATH; set OC_DEV to the path of an OpenCode checkout to run that from source instead.
I'll take this one. I plan to trace how Session.create copies the parent's permissions into a child session and why the browser attachment grant leaks across that boundary, then strip the session-scoped browser/skill allows from inherited permissions (keeping other inherited permissions intact) so a subagent no longer sees browser.* tools it cannot use. I'll add a regression test around child-session permission inheritance and run the adjacent core session tests plus typecheck before opening a PR.
Activity
opencodejr commentedon Nov 2, 2026
Thanks for the detailed report. I reproduced this on 2.2.0, and it still happens on the latest
dev(ff90ed916).The Desktop app can't run in this sandbox, so I simulated the attach step. The script gives the parent session the same two allow rules the browser plugin adds when the Desktop browser attaches (
browser: *and the Browser skill). It then has the main agent start ageneralsubagent, which callsbrowser.tabs.listin a simulated run.browser.*tools and Browser skill.[browser.disconnected] No desktop browser is connected to this session..., because the attachment exists only for the parent's session ID.This matches your analysis:
Session.createcopiesparent.permissions, and the session's allow rules override the plugin's deny rules for every agent. The recording and screenshot below are from the 2.2.0 run, and the script below reproduces it. A closely related issue is #54044 (browser tools exposed despite an agent-leveldeny browser), but it happens through a different path.recording.mp4
Reproduction script (drive.ts)
Run it with opencode-drive:
opencode-drive run ./drive.ts. It drivesopencodefrom yourPATH; setOC_DEVto the path of an OpenCode checkout to run that from source instead.jimmyallinai commentedon Nov 2, 2026
I'll take this one. I plan to trace how
Session.createcopies the parent's permissions into a child session and why the browser attachment grant leaks across that boundary, then strip the session-scoped browser/skill allows from inherited permissions (keeping other inherited permissions intact) so a subagent no longer seesbrowser.*tools it cannot use. I'll add a regression test around child-session permission inheritance and run the adjacent core session tests plus typecheck before opening a PR.