Skip to content

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

Closed as not planned

Description

@B67687

Description

DCP compress (@tarquinen/[email protected]) 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/[email protected] 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/[email protected]
  • OpenCode version: 1.18.18 (broken), 1.18.13 (works)
  • OS: Linux (Debian, x86-64)

Activity

  1. 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