GeezerVison is showing github.com — agents: config-defined shell deny on free-model agent fails session with misleading free-tier error · Issue #51193 · anomalyco/opencode
agents: config-defined shell deny on free-model agent fails session with misleading free-tier error #51193DescriptionSummary
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 review
mode: all
model: opencode/mimo-v2.6-flash-free
steps: 20
permissions:
- action: edit
resource: "*"
effect: deny
- action: shell
resource: "*"
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.
Activityscachemaille commented on 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
- opencode version: v2.0.18
- OS: Linux 6.18.54-1-MANJARO (linux x64)
- Terminal: TERM=xterm-256color, COLORTERM=truecolor (TERM_PROGRAM unset)
- Shell: /bin/zsh
- Install/channel: latest
- 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: primary
model: opencode/mimo-v2.6-flash-free
request:
body:
temperature: 0.1
permissions:
- action: "*"
resource: "*"
effect: deny
- action: webfetch
resource: "*"
effect: ask
- action: websearch
resource: "*"
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
Related
the comment has been written by AI but all the tests has been done by me a human ggbdpq commented on Oct 2, 2026 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. neriousy commented on 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.
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|