Skip to content

Plan mode rewrites prompt history and breaks prefix caching #43722

Closed as not planned

Description

@Blaizzy

Description

OpenCode 1.18.5 rewrites model-visible history when resuming a plan session.

Captured two consecutive OpenAI-compatible requests:

  • system message: same length, different hash
  • tools: byte-identical
  • previous file-attached user message: 5,373 → 3,833 serialized characters

The immediate follow-up got 0 cached tokens and re-prefilled all 45,222 tokens in 143.3s.

Repro

  1. Run opencode run --pure --agent plan --file foo.py "...".
  2. Resume with opencode run --pure --agent plan --session <id> "...".
  3. Compare the outbound messages payloads.

Expected

Historical messages remain byte-identical. Only the new turn is appended.

macOS, no plugins, custom OpenAI-compatible provider.

Related: #26749, #32202.

Activity

  1. github-actions commented on Aug 20, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of or closely related to existing issues. Please check:

    (#26749 and #32202 are already referenced in your report.)

  2. thdxr commented on Oct 11, 2026

    @thdxr
    Member

    Thanks for the report! OpenCode 2.0 is now out and development is focused on V2, so we're closing issues filed against OpenCode 1. Please upgrade (opencode upgrade --major, details: https://anoma.ly/notes/opencode-2-0), and if this is still relevant on 2.0, reopen this issue or open a new one with your 2.0 version.

    — from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊

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