Skip to content

OpenCode breaks in Zed if asked to use the AskUserQuestion tool #11361

@yeskunall

Description

@yeskunall

Description

We’ve gotten at least one report so far of Zed breaking for a user if they asked a question which prompted the LLM to use the AskUserQuestion tool. As mentioned in my comment on that issue:

However, Zed doesn’t really support interactive inputs (needed for asking questions) as of now, so we effectively do not support that tool. OpenCode -- if they are open to it -- should disable that tool if they detect the request is coming from Zed.

I quickly asked Opus 4.5 to go through both our codebases and it suggested 3 solutions and I only really liked one of them. So for now, here’s the suggestion I liked (because it seems the most straight-forward to me):

Zed already sends some info about itself here, maybe we can use that in initialize?

In other words, IIUC, OpenCode already receives client info from Zed with name: "zed". You’d just have to check it somehow:

// Check if running under a known ACP client that doesn’t support question tool
const disableQuestionTool = clientInfo?.name === "zed"
...(!disableQuestionTool && ["app", "cli", "desktop"].includes(Flag.OPENCODE_CLIENT) ? [QuestionTool] : []),

If this sounds like an OK change, happy to send a PR. If not, do you guys have a better solution? Would really like to see OpenCode working in Zed!

Plugins

N/A

OpenCode version

1.1.42

Steps to reproduce

  1. Open Zed (grabbing Nightly is optimal: curl https://zed.dev/install.sh | ZED_CHANNEL=nightly sh)
  2. Install OpenCode from the ACP registry (open the command palette and do zed: acp registry)
  3. Ask the agent something that would prompt the use of the AskUserQuestion tool
  4. Zed will forever keep spinning (see screenshot below or in the original issue on our repo)

Screenshot and/or share link

Image

zed-industries/zed#48038 (comment)

Operating System

macOS 15.7.3

Terminal

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions