Skip to content

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

@JUVOJustin

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

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