anomalyco / anomalyco/opencode

Plan mode rewrites prompt history and breaks prefix caching

Open
#43,722 1 comment 0 reactions 1 assignee View on GitHub

@jlongster is already working on this.

Since Aug 20, 2026.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
Avg merge
7h 2m
Merged PRs (30d)
384

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.