Repository navigation
Description
Summary
Description
With the built-in browser plugin enabled and no browser attached, a blanket skill deny leaves the skill tool in the first model request. Calling it returns Permission denied: skill, costing an unnecessary model step.
Steps to reproduce
- Save the script below as
reproduce.pyand run it with Python 3 and OpenCode on PATH. It creates a fresh project and HOME/XDG directories for each case and uses a loopback model with a dummy key. - The script applies
{"action":"skill","resource":"*","effect":"deny"}either inpermissionsor inagents.build.permissions. It sends one prompt viaopencode run --standalone, prints which tools appear on the first model request, and records the result of a test call ifskillwas listed. - The script runs each case again with
"plugins": ["-opencode.browser"]as a control.
python3 reproduce.pyReproduction script: reproduce.py
import json
import os
import pathlib
import shutil
import subprocess
import tempfile
import threading
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
class Model(BaseHTTPRequestHandler):
def log_message(self, *args):
pass
def do_POST(self):
body = json.loads(self.rfile.read(int(self.headers["Content-Length"])))
names = [tool["function"]["name"] for tool in body.get("tools", [])]
self.server.requests.append(names)
delta, reason = {"content": "OK"}, "stop"
if len(self.server.requests) == 1 and "skill" in names:
call = {"index": 0, "id": "call_probe", "type": "function",
"function": {"name": "skill", "arguments": '{"id":"probe"}'}}
delta, reason = {"tool_calls": [call]}, "tool_calls"
self.send_response(200)
self.send_header("Content-Type", "text/event-stream")
self.end_headers()
for payload, finish in [({"role": "assistant", **delta}, None), ({}, reason)]:
chunk = {"id": "probe", "object": "chat.completion.chunk", "model": "m",
"choices": [{"index": 0, "delta": payload, "finish_reason": finish}]}
self.wfile.write(f"data: {json.dumps(chunk)}\n\n".encode())
self.wfile.write(b"data: [DONE]\n\n")
def run(cli, model, scope, browser):
model.requests = []
with tempfile.TemporaryDirectory() as directory:
root = pathlib.Path(directory).resolve()
env = {"PATH": os.defpath, "PWD": str(root), "OPENCODE_DISABLE_MODELS_FETCH": "1"}
for key in ("HOME", "XDG_CONFIG_HOME", "XDG_DATA_HOME", "XDG_STATE_HOME", "XDG_CACHE_HOME", "TMPDIR"):
path = root / key
path.mkdir()
env[key] = str(path)
skill = root / ".opencode/skills/probe"
skill.mkdir(parents=True)
(skill / "SKILL.md").write_text("---\nname: probe\ndescription: Test skill\n---\n\nProbe.\n")
rules = [{"action": "skill", "resource": "*", "effect": "deny"},
{"action": "read", "resource": "*", "effect": "allow"}]
config = {"providers": {"probe": {
"package": "@opencode/ai/providers/openai-compatible",
"settings": {"baseURL": f"http://127.0.0.1:{model.server_port}/v1", "apiKey": "dummy"},
"models": {"m": {}}}}}
config.update({"permissions": rules} if scope == "config"
else {"agents": {"build": {"permissions": rules}}})
if not browser:
config["plugins"] = ["-opencode.browser"]
(root / "opencode.json").write_text(json.dumps(config))
result = subprocess.run([cli, "run", "--standalone", "--auto", "--title", "Probe",
"--agent", "build", "--model", "probe/m", "--format", "json"],
cwd=root, env=env, input="Hello", text=True,
capture_output=True, timeout=30, check=True)
first = model.requests[0]
print(scope, f"browser={browser}", f"skill_listed={'skill' in first}",
f"read_listed={'read' in first}", f"denied={'Permission denied: skill' in result.stdout}")
cli = shutil.which("opencode")
assert cli, "OpenCode executable not found"
with ThreadingHTTPServer(("127.0.0.1", 0), Model) as model:
thread = threading.Thread(target=model.serve_forever)
thread.start()
try:
for scope in ("config", "agent"):
for browser in (True, False):
run(cli, model, scope, browser)
finally:
model.shutdown()
thread.join()Expected behavior
When every skill ID is denied, the model's tools list omits skill, as it does for other tools whose permissions deny every resource.
Actual behavior
In both deny scopes, the first request contains skill and the test call returns Permission denied: skill. Disabling the browser plugin removes skill from both requests. The allowed read tool appears in all four runs.
Evidence
- Expected source: Skills permissions describes hiding denied skills. The registry test shows that tools denied across all resources are filtered from model definitions.
- Failure source: The loopback provider's first request and the standalone CLI's JSON tool error in the reproduction above.
- Evidence provenance: observed
- Local verification: reproduced
- Reproduction completeness: complete
The browser plugin appends a narrower deny for skill: browser. The registry predicate checks only the last rule matching the tool's action, so the narrower deny makes it miss the earlier wildcard deny. Both code paths are present in the release and on dev.
Restoration check
Run the same fixture with the browser plugin enabled. skill should be absent from the first request for both deny scopes, and read should still be present.
Runtime or environment
OpenCode version
2.4.1, current npm release at verification. The code links above are pinned to the inspected dev head.
Operating System
macOS arm64.
Plugins
Built-in opencode.browser and the fixture's OpenAI-compatible provider.
References
- Permission deny-all leaves built-in
skilltool advertised to the model (re-injected with tool_choice=none on later turns); per-agent tools disable does not remove it #65738 — The earlier report was closed pending reproduction details. It observedskillon later requests withtool_choice: "none"; this standalone fixture sees it on the first request. - fix(core): hide tools whose rules deny every resource #47337 — An earlier change addressed the same filtering predicate and was closed by automated cleanup before merge.
Triage assessment
- Impact level: P2
- Assessment status: supported
- Impact basis: The model receives a tool definition and can spend a step calling it even though a blanket deny makes every call fail in the tested standalone session.
- Workaround status: available
- Workaround basis: Disabling the browser plugin removes the unwanted tool in both tested scopes, for users who do not need the plugin.
Activity
opencodejr commentedon Nov 23, 2026
Seen with a simulated model or a mock server, not a real provider; a maintainer should confirm.
Thanks for the detailed report and script. I reproduced this on 2.4.1 using your script with a local mock model (no real provider). With the built-in browser plugin enabled, a
{"action":"skill","resource":"*","effect":"deny"}rule leavesskillin the first request's tools. This happens in both top-levelpermissionsandagents.build.permissions, and the model's call returnsPermission denied: skill. With"plugins": ["-opencode.browser"],skillis not offered.It still happens on the latest
dev(2002026a), run from source. There the first request's tools aregenerate_image, generate_video, question, skill, subagent, executewith the plugin on, and the same list withoutskillwith it off. (readis not a top-level tool ondevbecause Code Mode'sexecuteis listed, so that column of the script doesn't apply there.)The script below is your reproduction, lightly adapted so it can also run against a source checkout.
Reproduction script (reproduce.py)
Run it:
python3 reproduce.pyccclucky commentedon Nov 23, 2026
Root cause confirmed on
dev(9a8a656e):Tool.whollyDisabled(packages/core/src/tool.ts) decides from the last rule matching the tool's action. The browser plugin appends{ action: "skill", resource: "browser", effect: "deny" }after every agent's rules, so for a configskill: *deny the last match is that narrow rule and the tool is advertised again even though the wider rule denies every resource.The fix decides from the last
resource: "*"rule for the action, and keeps the tool hidden unless a later rule allows some resource again. That keeps the existing ordered-wildcard cases (*: *deny then a narrow allow, and the reverse) and covers the narrower-deny case.packages/coretool-registrytests pass (51, including a new case for this shape) andbun typecheckis clean. PR to follow.