Skip to content

compaction.auto=false ignored: isOverflow called without cfg parameter #20249

Closed as not planned

Description

@krasnikau-andrei

Bug

compaction.auto: false in opencode.json is ignored. Auto-compaction still triggers.

Root Cause

In packages/opencode/src/session/prompt.ts, isOverflow is called without the cfg parameter:

// prompt.ts line ~549
if (lastFinished && lastFinished.summary !== true && (await SessionCompaction.isOverflow({ tokens: lastFinished.tokens, model }))) {

But isOverflow in compaction.ts expects input.cfg:

export async function isOverflow(input: { tokens: MessageV2.Assistant["tokens"]; model: Provider.Model }) {
    const config = await Config.get()
    if (config.compaction?.auto === false) return false  // <-- cfg not in input

Wait — actually isOverflow calls Config.get() internally, so it should work regardless. Let me re-check...

Environment

  • OpenCode version: 1.3.9
  • OS: Linux
  • Model: groq/llama-3.1-8b-instant (but likely affects all models)

Steps to Reproduce

  1. Add "compaction": { "auto": false } to opencode.json
  2. Start a new session with any model
  3. Send a message — compaction still triggers

Additional Context

The issue is especially visible with Groq models because Groq returns tokens: {input:0, output:0} in streaming responses, causing the compaction loop to never resolve. But compaction.auto: false should prevent this regardless of the model.

Activity

  1. added
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on Mar 31, 2026
  2. github-actions commented on Mar 31, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

coreAnything pertaining to core functionality of the application (opencode server stuff)

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions