Skip to content

skills: built-in browser skill still advertised and loadable when browser or the skill is denied #65737

Open

Description

@vimtor

Summary

The built-in browser skill stays advertised and loadable when the browser action is denied, and also when the skill itself is denied with { "action": "skill", "resource": "browser", "effect": "deny" }. Agents load it, call the denied in-app browser tools, and then stop: the skill says "never retry a denied permission another way", so they won't fall back to another browser tool that's allowed, such as a browser-automation MCP server.

Environment

  • opencode version: server 0.0.0-dev-1330 (dev), CLI v2.2.0
  • OS: Darwin 27.2.0 arm64
  • Terminal: Unavailable: not set in the agent's environment
  • Shell: /bin/zsh
  • Install/channel: dev
  • Active plugins: several, list omitted; not yet tested without them. Config has "experimental": { "all_flags": true }.

Reproduction

  1. In the global opencode.jsonc, deny the in-app browser and its skill:
    "permissions": [
      { "action": "browser", "resource": "*", "effect": "deny" },
      { "action": "skill", "resource": "browser", "effect": "deny" },
    ]
  2. Confirm the agent's resolved permissions include both rules (GET /api/agent/<id> lists them).
  3. Start a session and look at the available skills list in the system prompt.
  4. Call the skill tool with { "id": "browser" }.

Expected Behavior

  • The browser skill isn't listed and can't be loaded. The Skills docs say a skill deny "hides matching skills from the model and rejects loading".
  • Ideally the built-in browser skill is also hidden whenever the browser action is denied for the agent, since it only describes tools the agent can't use.

Actual Behavior

  • browser is still in the available skills list, with the description "Use the in-app browser… Load it before your first browser tool call."
  • The skill tool loads its full body without error.
  • In practice, when a user asks an agent to use "my browser tools", the agent loads this skill, calls tools.browser.tabs.list, and gets [browser.denied] Browser tools are denied for this agent by configuration; no action ran. Do not retry browser tools. It then refuses to continue. The skill's "never retry a denied permission another way" line, together with "Do not retry browser tools", makes it treat any other browser tool as off limits, even an allowed and connected MCP browser server.

Reproduced consistently: by an unattended agent across two days, and by loading the skill directly in a separate session.

Additional Context

Activity

  1. opencodejr commented on Nov 23, 2026

    @opencodejr
    Contributor

    Seen with a simulated model or a mock server, not a real provider; a maintainer should confirm.

    Thanks for the detailed report. I reproduced this on 2.2.0, and it still happens on the latest dev (571619bc).

    What I did: I used your config (the two deny rules plus experimental.all_flags), with a simulated model and an imitated desktop attachment.

    • Rules check: GET /api/agent/build lists both deny rules.
    • Attaching: I imitated the desktop app attaching its browser by calling the experimental.browser/attach plugin RPC for the session.
    • Session rules: after that, the session's permissions are [{"action":"browser","resource":"*","effect":"allow"},{"action":"skill","resource":"browser","effect":"allow"}].
    • Result: on the next prompt, the system prompt sent to the model includes the browser skill's description, and a skill call with { "id": "browser" } returns its full body.
    • Control run: without the attachment, the skill is neither listed nor loadable.

    So the explicit skill: browser deny is overridden only in attached sessions. That goes against the Skills docs, which say deny "Hides matching skills from the model and rejects loading". In the plugin source, the browser permission hook re-applies the agent's own denies only to browser calls, not to skill: browser, which fits what I saw.

    On your second point: a source comment in the browser plugin says an attachment lists the browser tools and their skill to every agent of an attached session, including one whose own rules deny the browser. Showing the skill when only browser is denied therefore looks intended for now, so changing that would be a design change.

    I did not look into the stale GET /api/agent/<id> rules after removing the deny.

    The script below reproduces it (NO_ATTACH=1 runs the control), and the screenshot and recording show the skill loading without error in the attached session.

    recording.mp4

    Screenshot

    Reproduction script (drive.ts)
    // Repro for anomalyco/opencode#65737: the built-in `browser` skill is still listed and loadable
    // in a session with an attached desktop browser, although config denies `browser` and `skill: browser`.
    // The desktop attachment is simulated by calling the plugin RPC `experimental.browser/attach` over HTTP.
    import { Effect, Stream } from "effect"
    import { Llm, OpenCodeDriver } from "opencode-drive"
    import { readdirSync, readFileSync } from "node:fs"
    import { join } from "node:path"
    
    export default OpenCodeDriver.use(
      {
        ...(process.env.OC_DEV ? { opencode: { dev: process.env.OC_DEV } } : {}),
        tui: { recording: true },
        config: {
          experimental: { all_flags: true },
          permissions: [
            { action: "browser", resource: "*", effect: "deny" },
            { action: "skill", resource: "browser", effect: "deny" },
          ],
        } as any,
      },
      ({ ui, llm, artifacts }) =>
        Effect.gen(function* () {
          const state = join(artifacts, "home", ".local", "state", "opencode")
          const file = readdirSync(state).find((n) => /^service.*\.json$/.test(n))!
          const svc = JSON.parse(readFileSync(join(state, file), "utf8"))
          const url: string = svc.url ?? svc.endpoint?.url
          const auth = svc.password ? { username: "opencode", password: svc.password } : undefined
          const headers: Record<string, string> = {
            "content-type": "application/json",
            "x-opencode-directory": encodeURIComponent(join(artifacts, "files")),
            ...(auth ? { authorization: "Basic " + btoa(`${auth.username}:${auth.password}`) } : {}),
          }
          const api = (path: string, init?: RequestInit) =>
            Effect.promise(() => fetch(url + path, { ...init, headers }).then(async (r) => `${r.status} ${await r.text()}`))
    
          let index = 0
          yield* llm.serve((request: unknown) => {
            const body = JSON.stringify(request)
            index++
            
            if (!body.includes("use my browser tools")) return Stream.make(Llm.text("Session started."))
            if (!body.includes("call_skill")) {
              console.log("SYSTEM PROMPT LISTS browser SKILL:", body.includes("Use the in-app browser"))
              return Stream.make(
                Llm.toolCall({ index: 0, id: "call_skill", name: "skill", input: { id: "browser" } }),
                Llm.finish("tool-calls"),
              )
            }
            console.log("SKILL TOOL RESULT CONTAINS BODY:", body.includes("# In-app browser"))
            return Stream.make(Llm.text("Skill result received."))
          })
    
          yield* ui.submit("hello")
          yield* ui.waitFor("Session started.")
          const raw = yield* api("/api/session")
          console.log("sessions:", raw.slice(0, 600))
          const sessions = JSON.parse(raw.replace(/^\d+ /, ""))
          const list = sessions.data ?? sessions.items ?? sessions
          const sessionID = list[0].id
          console.log("agent:", (yield* api("/api/agent/build")).slice(0, 1500))
          // Simulate the desktop app attaching its browser to this session (long-lived call; not awaited).
          // Set NO_ATTACH=1 for the control run: without an attachment the skill is hidden as documented.
          if (!process.env.NO_ATTACH) fetch(url + "/api/rpc/experimental.browser/attach", {
            method: "POST",
            headers,
            body: JSON.stringify({ input: { sessionID, connectionID: "repro-desktop", version: 4 } }),
          }).then(async (r) => console.log("attach ended:", r.status, await r.text()))
            .catch(() => {}) // the long-lived attach call is cut when the run shuts down
          yield* Effect.sleep("3 seconds")
          console.log("session:", (yield* api(`/api/session/${sessionID}`)).slice(0, 1500))
          yield* ui.submit("use my browser tools")
          yield* ui.waitFor("Skill result received.", { timeout: 30000 } as any)
          yield* Effect.sleep("1 second")
          yield* ui.screenshot("skill-loaded")
        }),
    )

    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.

  2. added
    status/repro-simulated
    on Nov 23, 2026
  3. ccclucky commented on Nov 23, 2026

    @ccclucky

    Thanks for the detailed report. The mechanism is in packages/plugin-browser/src/connection.ts: the attachment's skill: browser grant is a session rule that core evaluates after every agent rule, and the plugin's permission.evaluate hook re-applies configured denies only to browser calls. So in an attached session an explicit skill: browser deny is overridden and skill({ id: "browser" }) loads.

    I have a fix ready that extends that hook: when the evaluated action is skill on the browser skill's id, the agent's configured rules are re-applied the same way, so a denied skill's load is refused instead of relying on the grant. Denies of other skills, and a browser-only deny, are unaffected, and listing keeps following the attachment's documented "lists both to every agent" behavior.

    Verified locally: packages/plugin-browser tests pass (189), including eight new permission.evaluate cases; reverting the hook change fails the three new deny cases; bun typecheck and tsc are clean. I will open a PR shortly.

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

    status/repro-simulated

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions