anomalyco / anomalyco/opencode

fix(opencode): DCP compress cosmetic on ≥1.18.15 — model-visible context never shrinks

Open
#43,764 0 comments 0 reactions 1 assignee View on GitHub

@nexxeln is already working on this.

Since Aug 21, 2026.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

Description

DCP compress (@tarquinen/opencode-dcp@3.1.15) is cosmetic on opencode ≥1.18.15 — the compress tool executes, blocks are recorded in plugin state, success text is returned, but the model-visible context never shrinks. This causes an infinite nudge loop: DCP nudges every turn because getCurrentTokenUsage > maxContextLimit, the model calls compress, context stays the same, repeat.

Regression

db581e47a ("fix(opencode): order legacy message loop by time (#40990)"), merged into v1.18.15, changed latest() in message-v2.ts from pure monotonic MessageID comparison to isAfter() = time.created first, ID as tie-breaker. This breaks DCP's block-range alignment with what opencode treats as the latest turn — blocks get recorded but the filterCompressedRanges removal step no longer reduces what the model sees.

Verified

Same byte-identical DCP 3.1.15 plugin on two machines:

Machine opencode DCP compress Model-visible context
local 1.18.13 Works Drops 130K→80K, block hierarchy forms
minipc 1.18.18 Cosmetic Stays ~135K despite 21 blocks covering ~100% of messages

Native compaction (compaction: {auto: true}) is inert on both (session_context_epoch rows = 0). The context drop on 1.18.13 is confirmed to be DCP's messages.transform removal, not core compaction.

Steps to reproduce

  1. Install opencode ≥1.18.15
  2. Install @tarquinen/opencode-dcp@3.1.15 with compress.mode: "range"
  3. Start a long session that triggers DCP nudges
  4. Observe: compress tool returns success, blocks recorded in DCP state, but tokens.input on subsequent turns never drops below pre-compress levels

Related issues

  • DCP #572 — compression doesn't shrink (OPEN, no fix)
  • DCP #573 — compress feedback loop burns tokens (OPEN, no fix)
  • opencode #31731 — hooks not firing in v1.17.1 (CLOSED by bot, no fix)

Workaround

Pin opencode to ≤1.18.14: opencode upgrade 1.18.13 -m curl

Environment

  • Plugins: @tarquinen/opencode-dcp@3.1.15
  • OpenCode version: 1.18.18 (broken), 1.18.13 (works)
  • OS: Linux (Debian, x86-64)

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.