Using noReply in tool call #4025

Closed
opened 2026-02-16 17:42:20 -05:00 by yindo · 3 comments
Owner

Originally created by @rmhubbert on GitHub (Dec 31, 2025).

Originally assigned to: @rekram1-node on GitHub.

Description

Setting noReply: true is not preventing the AI from responding to prompts sent via the session.prompt SDK method.

I was expecting the call to session.prompt with noReply: true to insert the payload into the session context without triggering an assistant response. As shown in the screenshot, the assistant is automatically responding.

I've tested with a simple plugin -

import { type Plugin, tool } from "@opencode-ai/plugin";

export const PromptTestPlugin: Plugin = async ({ client }) => {
  return {
    tool: {
      prompt_test: tool({
        description: "Prompt test",
        args: {},
        async execute(_args, ctx) {
          await client.session.prompt({
            path: { id: ctx.sessionID },
            body: {
              noReply: true,
              parts: [
                {
                  type: "text",
                  text: "Hello, world!",
                },
              ],
            },
          });
          return "";
        },
      }),
    },
  };
};

OpenCode version

1.0.218

Steps to reproduce

  1. Install the test plugin shown above.
  2. Start a new Opencode TUI session.
  3. Ask the assistant to call the prompt_test tool.

At this point you should see Hello, world! output as a user message in the TUI. The assistant will then reply, as if the message had been typed directly.

Screenshot and/or share link

Image

Operating System

Arch Linux

Terminal

Ghostty

Originally created by @rmhubbert on GitHub (Dec 31, 2025). Originally assigned to: @rekram1-node on GitHub. ### Description Setting `noReply: true` is not preventing the AI from responding to prompts sent via the session.prompt SDK method. I was expecting the call to session.prompt with `noReply: true` to insert the payload into the session context without triggering an assistant response. As shown in the screenshot, the assistant is automatically responding. I've tested with a simple plugin - ```typescript import { type Plugin, tool } from "@opencode-ai/plugin"; export const PromptTestPlugin: Plugin = async ({ client }) => { return { tool: { prompt_test: tool({ description: "Prompt test", args: {}, async execute(_args, ctx) { await client.session.prompt({ path: { id: ctx.sessionID }, body: { noReply: true, parts: [ { type: "text", text: "Hello, world!", }, ], }, }); return ""; }, }), }, }; }; ``` ### OpenCode version 1.0.218 ### Steps to reproduce 1. Install the test plugin shown above. 2. Start a new Opencode TUI session. 3. Ask the assistant to call the `prompt_test` tool. At this point you should see `Hello, world!` output as a user message in the TUI. The assistant will then reply, as if the message had been typed directly. ### Screenshot and/or share link <img width="1445" height="760" alt="Image" src="https://github.com/user-attachments/assets/335b480b-c0de-4bc2-a238-8a46a83ad915" /> ### Operating System Arch Linux ### Terminal Ghostty
yindo closed this issue 2026-02-16 17:42:20 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Dec 31, 2025):

This issue might be a duplicate of existing issues. Please check:

  • #4475: Plugins using noReply seem to cause model to switch to agent default

Feel free to ignore if this doesn't address your specific case.

@github-actions[bot] commented on GitHub (Dec 31, 2025): This issue might be a duplicate of existing issues. Please check: - #4475: Plugins using noReply seem to cause model to switch to agent default Feel free to ignore if this doesn't address your specific case.
Author
Owner

@rekram1-node commented on GitHub (Dec 31, 2025):

Okay but u made it a tool... the plugin works as intended, a tool is completely different.

Try this instead:

import { type Plugin, tool } from "@opencode-ai/plugin"

export const PromptTestPlugin: Plugin = async ({ client }) => {
  return {
    event: async (event) => {
      if (event.event.type === "session.status" && event.event.properties.status.type === "idle") {
        await client.session.prompt({
          path: { id: event.event.properties.sessionID },
          body: {
            noReply: true,
            parts: [
              {
                type: "text",
                text: "Hello, world!",
              },
            ],
          },
        })
      }
    },
  }
}

When you define it in a tool it doesnt really matter what the body of teh tool says, the agent calls the tool and then it reads the response and replies, if the tool adds a user message to context it doesnt change that.

@rekram1-node commented on GitHub (Dec 31, 2025): Okay but u made it a tool... the plugin works as intended, a tool is completely different. Try this instead: ``` import { type Plugin, tool } from "@opencode-ai/plugin" export const PromptTestPlugin: Plugin = async ({ client }) => { return { event: async (event) => { if (event.event.type === "session.status" && event.event.properties.status.type === "idle") { await client.session.prompt({ path: { id: event.event.properties.sessionID }, body: { noReply: true, parts: [ { type: "text", text: "Hello, world!", }, ], }, }) } }, } } ``` When you define it in a tool it doesnt really matter what the body of teh tool says, the agent calls the tool and then it reads the response and replies, if the tool adds a user message to context it doesnt change that.
Author
Owner

@rmhubbert commented on GitHub (Dec 31, 2025):

Ah, got you. Thanks for the clarification, that makes sense.

@rmhubbert commented on GitHub (Dec 31, 2025): Ah, got you. Thanks for the clarification, that makes sense.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#4025