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
agents: config-defined shell deny on free-model agent fails session with misleading free-tier error #51193
A custom agent defined in ~/.config/opencode/agents/*.md with a config-defined shell: deny permission rule fails to start when assigned a free model
(opencode/mimo-v2.6-flash-free), reporting a misleading free-tier error that
appears unrelated to permissions.
Environment
opencode version: v2.0.16
OS: Windows_NT 10.0.26200.9457 (win32 x64)
Terminal: TERM=xterm-256color (TERM_PROGRAM not set)
Shell: C:\WINDOWS\system32\cmd.exe
Install/channel: latest
Active plugins: none ("plugins": [] in config)
Reproduction
Create ~/.config/opencode/agents/review.md:
---description: Read-only code reviewmode: allmodel: opencode/mimo-v2.6-flash-freesteps: 20permissions:
- action: editresource: "*"effect: deny
- action: shellresource: "*"effect: deny---
You review code without modifying it.
Reload config: opencode api post /api/location/reload
Spawn the agent as a subagent with any prompt (e.g. Reply with exactly: OK).
Expected Behavior
The session starts and the permission rules are enforced (agent cannot edit or
run shell commands).
Actual Behavior
Session creation fails with:
OpenCode's free tier can only be used from within OpenCode
The error is unrelated to the free tier and reproduces 3/3 times. Removing or
relaxing the shell rule fixes it:
Permissions on the agent
Result
none
OK
edit: deny only
OK
edit: deny + shell: deny
fails (3/3)
edit: deny + shell: ask
OK
The same free model works fine on other agents, including builtin explore,
which carries system-level *:deny (including shell) without issue — the
failure appears specific to config-defined shell: deny rules.
Additional Context
Same file with effect: ask for shell works and keeps the read-only guard
(shell requires approval). Workaround applied locally.
Could not verify whether paid models are affected — the Go usage cap was
active during testing.
Hypothesis: an internal free-tier validation path depends on shell
availability, and a denied shell surfaces as this misleading error.
Corroborating this trigger on a primary agent (same class as #50627). Same error, 100% reproducible, and a bisect isolates it to the config-defined deny rule — the model is not involved.
Active plugins: superpowers@git+https://github.com/obra/superpowers.git, opencode-cmd-provider
Failing agent
~/.config/opencode/agents/ask.md:
---description: Web-only agent for knowledge and conversation.mode: primarymodel: opencode/mimo-v2.6-flash-freerequest:
body:
temperature: 0.1permissions:
- action: "*"resource: "*"effect: deny
- action: webfetchresource: "*"effect: ask
- action: websearchresource: "*"effect: ask---
You are a helpful assistant limited to web research. ...
Reproduction
Select the ask agent (primary) with opencode/mimo-v2.6-flash-free.
Send any message.
Every time:
Error from provider (Console): OpenCode's free tier can only be used from within OpenCode
Bisect
Removing only this block from the agent frontmatter fixes it:
- action: "*"resource: "*"effect: deny
mode: primary and request.body.temperature: 0.1 were left unchanged, so the trigger is the config-defined action: "*" deny rule (which includes shell). The same free model works on a config-defined agent with no permissions block, and on builtin agents.
Notes
Trips on action: "*" deny, not only an explicit shell: deny — possibly broader than the repro here.
Ran the code path down for anyone picking this up — two facts from dev source, plus a clearly-labeled guess:
Fact 1: a config-defined rule like {action: "*", effect: deny} makes Permission.disabled() (packages/opencode/src/permission/index.ts) strip every tool from the agent's visible toolset, since Wildcard.match(anyTool, "*") always matches a deny rule whose pattern is *.
Fact 2: the outgoing request body is built from that visible toolset (session/llm/request.ts), so the free-model request would go out with an empty (or near-empty) tools field. Builtin agents with *: deny are unaffected because their ruleset doesn't flow through the same config-agent permission merge — which matches the reports here.
Guess (unverified): the Zen gateway rejecting with "can only be used from within OpenCode" appears to key off request shape rather than the identity headers (x-opencode-client is always sent, defaulting to cli), and an empty tools array is the obvious candidate signature. Confirming or killing that needs the gateway side, which isn't in this repo — so I'm leaving it here rather than guessing at a fix.
Thanks for narrowing this down with the custom-agent permission comparisons. This is the same problem as #51241, where denying shell or read access incorrectly triggers the free-tier error, and we're tracking it there. Please subscribe or add a 👍 there; your agent definition and deny-versus-ask results are worth adding too.
Activity
fix(agents): оставить в shell одну pwd — обход бага free tier Zen
scachemaille commentedon Sep 30, 2026
Corroborating this trigger on a primary agent (same class as #50627). Same error, 100% reproducible, and a bisect isolates it to the config-defined deny rule — the model is not involved.
Environment
superpowers@git+https://github.com/obra/superpowers.git,opencode-cmd-providerFailing agent
~/.config/opencode/agents/ask.md:Reproduction
askagent (primary) withopencode/mimo-v2.6-flash-free.Bisect
Removing only this block from the agent frontmatter fixes it:
mode: primaryandrequest.body.temperature: 0.1were left unchanged, so the trigger is the config-definedaction: "*"deny rule (which includesshell). The same free model works on a config-defined agent with nopermissionsblock, and on builtin agents.Notes
action: "*"deny, not only an explicitshell: deny— possibly broader than the repro here.Related
deny shell *on a custom primary agenttools.read = falsethe comment has been written by AI but all the tests has been done by me a human
ggbdpq commentedon Oct 2, 2026
Ran the code path down for anyone picking this up — two facts from
devsource, plus a clearly-labeled guess:Fact 1: a config-defined rule like
{action: "*", effect: deny}makesPermission.disabled()(packages/opencode/src/permission/index.ts) strip every tool from the agent's visible toolset, sinceWildcard.match(anyTool, "*")always matches a deny rule whose pattern is*.Fact 2: the outgoing request body is built from that visible toolset (
session/llm/request.ts), so the free-model request would go out with an empty (or near-empty)toolsfield. Builtin agents with*: denyare unaffected because their ruleset doesn't flow through the same config-agent permission merge — which matches the reports here.Guess (unverified): the Zen gateway rejecting with "can only be used from within OpenCode" appears to key off request shape rather than the identity headers (
x-opencode-clientis always sent, defaulting tocli), and an emptytoolsarray is the obvious candidate signature. Confirming or killing that needs the gateway side, which isn't in this repo — so I'm leaving it here rather than guessing at a fix.neriousy commentedon Oct 20, 2026
Thanks for narrowing this down with the custom-agent permission comparisons. This is the same problem as #51241, where denying shell or read access incorrectly triggers the free-tier error, and we're tracking it there. Please subscribe or add a 👍 there; your agent definition and deny-versus-ask results are worth adding too.
shellorreadpermissions are denied #51241