Skip to content

[BUG] plan to build switch reminder fires every turn #31763

Closed

Description

Description

When the AI transitions from plan mode to build mode, the "Your operational mode has changed from plan to build" message is injected into every subsequent conversation turn, not just the first turn after the switch.

Root Cause

packages/opencode/src/session/reminders.ts:37:

const wasPlan = input.messages.some(
  (msg) => msg.info.role === "assistant" && msg.info.agent === "plan"
)

.some() checks the ENTIRE conversation history. Once a plan agent message exists anywhere, wasPlan is always true, causing the build-switch message to be injected every turn thereafter.

Steps to reproduce

  1. Start a session in plan mode
  2. Type a message
  3. Switch to build mode (the build-switch message correctly appears)
  4. Type another message in build mode
  5. The build-switch message appears AGAIN (should only show on the first build turn)

OpenCode version

1.17.3

Operating System

Windows 11

Activity

  1. github-actions commented on Jun 10, 2026

    @github-actions
    Contributor

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

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