Repository navigation
Description
Area
apps/server
Steps to reproduce
- Enable OpenCode 2 (
@opencode/cli2.3.2) as a provider and start a thread. - Ask the agent to open a page, e.g. "open https://example.com and read the heading".
- The agent uses its
browserCode Mode namespace (browser.tabs.open,browser.snapshot, …) and every call fails with[browser.disconnected] No desktop browser is connected to this session. - In the same thread,
preview_openworks and opens a real tab.
Repeat in a Claude thread: no failure, because that namespace does not exist there.
Expected behavior
The agent uses T3's browser (preview_*), the same as in a Claude thread, and a tab opens.
Actual behavior
No tab opens. browser.* can never bind: OpenCode documents that namespace as "the browser attached by the OpenCode desktop app" (https://opencode.ai/docs/tools → Browser). Under T3, OpenCode runs as a headless opencode serve child of the provider adapter, so nothing ever attaches. The error is permanent, not transient — restarting the app, the server, or the thread does not change it.
Worse, the dead namespace is the discoverable one: OpenCode ships a bundled Browser skill whose instructions say to call tools.browser.*, and its tool descriptions are detailed, while T3's working browser arrives as generic t3-code-* MCP tools. Agents reliably pick the broken namespace and report "no browser access" even though preview_* works.
Impact
Major degradation: browser work is unusable in OpenCode threads on web, desktop, and mobile until a human notices preview_* exists.
Version or commit
T3 app 0.0.46-nightly.20261008.2801, server runtime 0.1.12-nightly.20261122.5098, OpenCode 2.3.2.
Environment
Linux (Ubuntu 24.04), T3 server on the same machine, desktop app attached.
Proposed fix
sessionRules() in packages/provider-opencode/src/server/v2/adapter.ts already builds the per-session rule list that writeRules() sends via client.session.update({ permissions: rules }). Appending one rule at the end of that array removes the unusable catalog:
...paths,
...mcpRules(mcpServerName),
rule("browser", "deny"),
];The array is last-match-wins and this entry lands after the rule("*", "allow") emitted for full-access mode, so it applies in every permission mode. sameRules() compares structurally, so a constant tail entry does not churn session updates.
OpenCode's docs state a browser deny with resource * "removes the browser catalog", so this hides the tools instead of only rejecting calls.
Verified on OpenCode 2.3.2 that the rule removes the catalog: a standalone session started with OPENCODE_CONFIG_CONTENT='{"permission":{"browser":"deny"}}' reported no browser.* tools at all, and OpenCode's bundled Browser skill no longer had a namespace to point at.
Notes
- OpenCode 1.x does not expose this namespace (browser tools were not in the 1.x catalog), so the rule is a no-op there; the v2 adapter is the only site that needs it.
- If you would rather keep the tools visible for people who point T3 at an external OpenCode server that does have a desktop host attached, gate the rule on the adapter owning a locally spawned server.
- Related: [Bug]: With agent browser/device access off, the agent still sees every preview_* and device_* tool #17202 (the inverse problem —
preview_*anddevice_*remain visible when agent browser access is off). - Also worth a sentence in
docs/user/providers-opencode.md: in a T3 thread, the browser ispreview_*; OpenCode'sbrowsernamespace belongs to the OpenCode desktop app.
Activity
disolaterX commentedon Nov 22, 2026
Extra data from the same machine, testing the workaround a user would try first:
Setting
{"permission":{"browser":"deny"}}in the OpenCode config does not fix T3 threads infull-accessmode, becausesessionRules()emitsrule("*", "allow")and the session-level rules are applied after the config's, so the wildcard allow wins. Measured on OpenCode 2.3.2, three fresh OpenCode threads started throughcreate_threads:full-accessauto-accept-editspreview_open, page opened)autopreview_open)So a config-level deny is only a partial user workaround, and the modes that T3 defaults to for agent-started threads are exactly where it fails. This reinforces that the rule needs to be appended inside
sessionRules()after the mode-specific entries.disolaterX commentedon Nov 22, 2026
Checked every user-side lever for
full-accessthreads, so nobody repeats the search. All measured on OpenCode 2.3.2 with freshcreate_threadsthreads,runtimeMode: "full-access":permission: { browser: "deny" }policies: [{ action: "tool.use", resource: "browser:*", effect: "deny" }](+browser.*:*)agent: { build: { permission: { browser: "deny" } } }Why:
writeRules()sets session-levelpermissionsviaclient.session.update(), and OpenCode resolves config rules first and session rules after, last match wins.sessionRules()emitsrule("*", "allow")first forfull-access, so it always beats a config-level deny that OpenCode placed earlier in the list. There is no config key or plugin hook that appends a rule after the session's own (the plugintool.definitionhook can only rewrite a description, andpermission.askfires at call time, not at catalog build).With
autoandauto-accept-editsthe same config deny does remove the catalog (0 tools), which is what makes full-access the interesting case: the mode a user is most likely to leave a browser-capable agent in is the one where the workaround silently fails and the agent still reports "no browser".So the adapter-level append is the only fix that covers every mode.
disolaterX commentedon Nov 22, 2026
A supported user-side workaround exists, verified on OpenCode 2.3.2: the browser namespace is the built-in plugin
opencode.browser, and OpenCode's own plugin docs allow disabling an id with a-prefix.{ "$schema": "https://opencode.ai/config.json", "plugins": ["-opencode.browser"] }That removes the 45
browser.*tools and the bundledbrowserskill in every mode, includingfull-access, because a plugin disable is not a permission and nothing the session supplies can re-enable it. Measured: a T3 OpenCode thread withruntimeMode: "full-access"went from 45browser.*tools to 0, withpreview_*untouched.Two details worth knowing when considering the adapter change:
-@opencode/plugin-browserdoes nothing,-opencode.browserworks, and-opencode.*would disable every built-in plugin (read/write/shell/execute included).tool.usepolicies and plugin policies do not reach built-in plugins, and the deprecatedpermission: { browser: "deny" }/tools: { browser: false }keys both normalise to the same{action:"browser",resource:"*",effect:"deny"}rule thatfull-accessoverrides.So there are now two independent fixes: this config one, and the adapter-level append. The config one costs users a line; the adapter one makes it unnecessary for anyone running OpenCode under T3. Your call which belongs in the product.
disolaterX commentedon Nov 22, 2026
Cross-link: PR #36983 ("honor native permission rules in OpenCode 2") addresses the root cause behind this report —
sessionRules()emittingrule("*", "allow")forfull-accessand replacing the session's rule list every turn. If that lands, a native{action:"browser",resource:"*",effect:"deny"}rule survives full-access like any other native deny, and the browser namespace can be suppressed by permission rather than by disabling the plugin.Until then there is a second supported route besides the global config: the OpenCode provider instance's environment variables reach the spawned
opencode serveverbatim (OpenCodeRuntime.ts—inputEnvironment.OPENCODE_CONFIG_CONTENT ?? inherited ?? "{}"), so settingOPENCODE_CONFIG_CONTENT={"plugins":["-opencode.browser"]}on the instance disables the built-in browser plugin for that instance only, without touching the user's global config. It only applies to a T3-spawned server, not an externalserverUrl.juliusmarminge commentedon Nov 22, 2026
A fix for this was proposed in #41004, but when the reported steps were run in the real app the problem did not appear.
What was run on
bc13afaa3c, the commit before this change:On each commit, installed dependencies, started the isolated dev app, paired its web client, added an OpenCode provider instance pointing to the scratch 2.3.2 binary with Server URL blank, added the same synthetic Browser proof project, and started a full-access anthropic/claude-haiku-5-5 thread with: 'Open https://example.com and read me the page heading. Use whatever browser tool you have.' Inspected the completed conversation and expanded tool inputs and outputs. Base called browser.tabs.open and received browser.disconnected, but then recovered using T3 preview, loaded Example Domain, read its contents, and closed its tab. Head's browser namespace search returned no items; it used T3 preview_open and preview_evaluate successfully and closed its tab. Neither run ended with the reported no-browser refusal.
How: Manual real web app comparison: separate worktrees and fresh databases, T3CODE_DEV_SEED=0, preview Chromium at 1280x800 CSS pixels, light theme. Real OpenCode CLI 2.3.2 with Claude Haiku 5.5 through the configured provider account. Synthetic project created through T3 CLI; full-access turns created through T3 CLI and inspected in the paired web clients. Captures crop the conversation to exclude private environment labels. Both apps were stopped and temporary worktrees removed.
Could you share the exact steps, what you see, and the version and platform you are on? The pull request is closed for now; the fix is picked up again once the problem can be shown.