Skip to content

Plan mode reminders are not persisted in history, breaking prefix cache stability #26749

@ipogosov

Description

@ipogosov

Description

Plan-mode synthetic reminders are appended to the current user message in memory before the prompt is sent, but the synthetic part is never persisted to message history. On the next turn, the same historical user message is serialized differently for the model: the first time it carries the plan reminder, on later turns it does not.

This makes the model-visible conversation unstable across turns and breaks prompt/prefix caches in OpenAI-compatible backends that require a token-identical prefix (LM Studio, llama.cpp, vLLM, LiteLLM proxies, etc.).

This is the same class of bug as #21518 (queued user messages serialized inconsistently), but for plan-mode reminders specifically. It is distinct from #24121 / #24343, which are about plan reminders leaking into Build mode after a switch — that flow strips reminders, while this issue is that the reminder for the current plan turn is not retained in stored history.

Expected: the user message stored in history is identical to what was sent to the model on the original turn, so the model sees a stable prefix on every following turn.

Actual: the original turn includes the reminder; replays of that historical message on later turns omit it, breaking the cache prefix and changing model-visible context.

Plugins

None

OpenCode version

1.14.46

Steps to reproduce

  1. Start a session in Plan mode (Tab).
  2. Send a user message — OpenCode appends a synthetic plan reminder to that user message before sending it to the model.
  3. Continue the session for at least one more turn.
  4. Inspect the model inputs sent on the second turn vs. the first turn:
    • First turn: the user message contains the synthetic plan reminder.
    • Second turn (same historical user message): the synthetic reminder is gone.
  5. On a backend with prefix caching (LM Studio, llama.cpp, vLLM, etc.), observe a large prompt-cache miss on turn 2 even though the conversation history has not meaningfully changed.

Screenshot and/or share link

No response

Operating System

macOS

Terminal

iTerm2

Metadata

Metadata

Assignees

Labels

No labels
No labels

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