Skip to content

bug: control user messages are treated as real user history #19319

@rich-jojo

Description

@rich-jojo

Description

Control turns that OpenCode stores as role: "user" can still be treated as real user input by history readers.

Concrete cases I hit:

  • Revert anchoring: after a normal user message, if OpenCode creates a control user turn (for example a compaction message or a synthetic "Continue if you have next steps..." turn), reverting from that selected message can anchor the revert to the control message instead of the previous real user request.
  • Prompt / model / agent recovery: subtask-only and compaction-only user turns can become the "last user" for logic that restores the current model or agent, even though no human typed a new prompt.
  • Share model sync: share sync can publish model metadata for a compaction control turn, which makes the shared session look like a human turn changed the model when it was only an internal control message.

Expected behavior: only user turns that contain real user input should count as "real user history" for these readers.

Actual behavior: some history readers only check role === "user", so synthetic/control turns are treated as fresh user intent.

Plugins

None

OpenCode version

1.3.2

Steps to reproduce

  1. Start a session and send a normal user message such as hello.
  2. Create a control user turn after it. One concrete way is to trigger compaction so OpenCode creates a user message whose only part is type: "compaction". Another is a synthetic continuation user turn whose text is Continue if you have next steps....
  3. Trigger a path that reads back the latest or previous user turn.
    • Example A: revert from the selected control message.
    • Example B: run logic that restores the current model / agent from the latest user message.
    • Example C: share the session and let incremental sync process the control turn.
  4. Observe that the control turn is treated as if it were real user input.

Screenshot and/or share link

N/A

Operating System

Ubuntu 24.04

Terminal

Ghostty

Metadata

Metadata

Assignees

Labels

coreAnything pertaining to core functionality of the application (opencode server stuff)

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions