Skip to content

Bug: SDK Messages cause switch back to default model #4901

Closed

Description

@JUVOJustin

Description

I have created a opencode plugin to give the ai context about ddev and fix command execution: https://github.com/JUVOJustin/opencode-ddev-plugin

The plugin adds context that ddev is used by executing:

await client.session.prompt({
      path: { id: currentSessionId },
      body: {
        parts: [
          {
            type: 'text',
            text: `➡️  DDEV environment is used. Execute commands inside the DDEV container like this: \`ddev exec --dir="${containerWorkingDir}" bash -c <command>\``,
          },
        ],
        noReply: true,
      },
    });

This causes a user message to be written back in the context. After that message the session switches back to using the primary agents model instead of the one choosen manually using /models

Funnily enough, i noticed this during the recording of my screencast for my ddev plugin so it can be seen in action here: https://cap.so/s/xvrarkbtk9yw6qh

OpenCode version

1.0.120

Steps to reproduce

  • Create session
  • Switch model using /models
  • Let the sdk write a message via a custom plugin
  • See the session using the default model of the primary agent again

Screenshot and/or share link

https://opencode.ai/s/XAifDA71

Operating System

macOS 15.7.2

Terminal

macOS Terminal

Activity

  1. added
    opentuiThis relates to changes in v1.0, now that opencode uses opentui
    on Nov 29, 2025
  2. github-actions commented on Nov 29, 2025

    @github-actions
    Contributor

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

    These issues describe the exact same problem where SDK messages (via plugins using noReply: true) cause the session to switch back to the primary agent's default model instead of maintaining the manually selected model.

    Feel free to ignore if your specific case differs from these reports.

  3. self-assigned this
    on Dec 2, 2025
  4. removed
    opentuiThis relates to changes in v1.0, now that opencode uses opentui
    on Dec 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

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