Skip to content

agent: shell deny on a child agent breaks model calls with free-tier auth error #53908

Closed as duplicate

Description

@MohamedElseify

Summary

A custom subagent whose permissions deny shell fails every model call with an authentication error about the free tier, instead of running with shell commands simply unavailable. The identical agent with edit denied instead of shell works fine — so the deny rule itself appears to break the auth path.

Environment

  • opencode version: v2.0.24
  • OS: Linux 7.0.0-38-generic (linux x86_64)
  • Terminal: ghostty (TERM=xterm-256color, TERM_PROGRAM=ghostty, COLORTERM=truecolor)
  • Shell: /bin/bash
  • Install/channel: latest release
  • Active plugins: custom-tools (repo-local .opencode/plugins/custom-tools.ts)

Reproduction

  1. Create ~/.config/opencode/agents/probe-shell-deny.md:

    ---
    description: "Probe agent - shell deny only"
    mode: subagent
    permissions:
      - action: shell
        resource: "*"
        effect: deny
    ---
    
    Reply with exactly: PROBE-SHELL-DENY-OK
  2. From any parent agent, launch it as a subagent (e.g. from build): "Launch the probe-shell-deny subagent and report its verbatim reply".

  3. The child session is created successfully; the model call inside it fails.

Expected Behavior

The child session runs and replies; actual shell commands are denied when it attempts them.

Actual Behavior

Every model call in the child fails:

AI.Error.Authentication: OpenCode's free tier can only be used from within OpenCode

Server log:

level=ERROR message="Failed to drain Session"
cause="AI.Error: OpenCode's free tier can only be used from within OpenCode ...
  [cause]: AI.Error.Authentication: OpenCode's free tier can only be used from within OpenCode"
role=server sessionID=<child-session-id>

Additional Context

  • Controls from the same parent session, same model (opencode/big-pickle on every child session record):
    • shell deny → fails (4/4 across two agents)
    • edit deny only → works
    • no permissions block → works
    • builtin explore → works
  • The child session is always created; failure happens at the first model step, which suggests the free-tier auth path exercises an internal shell/tool operation that the child's deny rule silently blocks, surfacing as an auth error rather than a permission error.
  • Consistent, not intermittent.
  • Workaround: deny edit only (docs say edit covers edit/write/patch tools) and enforce "no shell commands" via the system prompt.

Activity

  1. opencode-agent commented on Oct 8, 2026

    @opencode-agent
    Contributor

    Thanks for the careful control experiments! I think this is a duplicate of #50627. It's the same shell deny rule on a custom agent causing the same free-tier error on v2, and changing the rule to ask or allow makes it work. People there narrowed it down: the free-tier check rejects requests whose tool list doesn't include the shell tool, and a deny rule removes that tool from the list. That would explain why edit deny works and shell deny doesn't.

    Possible duplicates and related issues, ordered from most to least likely:

    Until it's fixed, a workaround reported in #50627 is to set shell to ask instead of deny. The tool then stays in the tool list and each command still needs approval.

    The bot will close this issue as a duplicate in 1 day unless you reply explaining how your problem is different.

  2. MohamedElseify commented on Oct 8, 2026

    @MohamedElseify
    Author

    Confirmed — this is a duplicate of #50627, thank you for the root-cause pointer.

    Our control matrix on v2.0.24 corroborates the tool-list explanation exactly:

    • shell deny → 4/4 auth failures (two different custom agents)
    • edit deny only → works
    • no permissions block → works
    • builtin explore → works

    All children on the same model, same parent session, and it reproduced after a service restart. One small additional data point: it also happens with mode: all agents spawned as subagents, not only mode: subagent.

    We've adopted the ask workaround from #50627 on our read-only agents and can confirm it holds on v2.0.24: with shell: effect: ask the child launches and replies normally, while every command still needs approval. Agreeing to close as duplicate.

  3. opencode-agent commented on Oct 9, 2026

    @opencode-agent
    Contributor

    Closing this as a duplicate of #50627. We waited a day for a reply explaining how this differs, and there wasn't one. #50627 reports the same problem on v2: a shell deny rule on a custom agent makes free-tier model calls fail with "OpenCode's free tier can only be used from within OpenCode". Please follow that issue for updates, and add your v2.0.24 subagent results there if they help. Until it's fixed, the workaround reported there is to set shell to ask instead of deny. If your problem turns out to be different, reply here and we can reopen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions