Skip to content

question permission deny blocks same-named custom tool in headless mode #45531

Closed as not planned

Description

@yvonnedevlinrh

Description

A custom tool named question (.opencode/tools/question.ts) never runs in headless mode. It gets blocked by the built-in question permission, which headless mode denies unconditionally: packages/opencode/src/cli/cmd/run.ts injects { permission: "question", action: "deny", pattern: "*" } when not interactive. A user-defined tool that shares the built-in name inherits that deny, so it's silently killed. Naming the tool ask works around it.

Plugins

None

OpenCode version

1.18.16

Steps to reproduce

  1. Add .opencode/tools/question.ts exporting a tool named question (Zod args).
  2. Run: opencode run --format json --pure -- "call the question tool"
  3. The tool is denied and never invoked (no output from the tool).

Screenshot and/or share link

No response

Operating System

Ubuntu 24.04 (aarch64)

Terminal

non-interactive (openshell sandbox exec -- sh -c, --no-tty)

Activity

  1. Piyush5784 commented on Aug 28, 2026

    @Piyush5784

    I looked into the bug, and confirmed it exists.

    If we make a custom tool with the same name as a built-in tool (like naming the file question.ts), it clashes. It just loads both, so now 2 tools exist. In headless mode, both the built-in tool and the custom tool get denied.

    Before the fix, I want to ask: what should happen when we have 2 tools for the same name?

    • Let the custom tool override the built-in
    • Keep the built-in and skip the custom one (maybe with a warning)
    • Refuse to start and tell the user to rename it
    • Make it a config setting so the user decides ahead of time

    I see this is already assigned, but I'd be happy to work on this one...

  2. thdxr commented on Oct 11, 2026

    @thdxr
    Member

    Thanks for the report! OpenCode 2.0 is now out and development is focused on V2, so we're closing issues filed against OpenCode 1. Please upgrade (opencode upgrade --major, details: https://anoma.ly/notes/opencode-2-0), and if this is still relevant on 2.0, reopen this issue or open a new one with your 2.0 version.

    — from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions