Skip to content

[FEATURE]: Feature Request / Bug: Per-agent compaction control breaks local model workflows #34510

Closed as not planned

Description

@nitdraig

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

Feature Request / Bug: Per-agent compaction control breaks local model workflows

OpenCode version: 1.17.11
OS: Windows 11


Problem

Auto-compaction cannot be disabled per-agent. The compaction: { "enabled": false } field in agent config is currently ignored — compaction still triggers globally regardless of agent-level settings.

This creates an infinite loop when using local models (LM Studio / Ollama) as agents:

  1. Local model responds and finishes naturally (finish === "stop")
  2. Auto-compaction triggers
  3. OpenCode injects a synthetic "Continue..." message
  4. Local model responds again
  5. Loop repeats indefinitely

This is especially problematic because local models have small context windows (8K–14K tokens). The global system prompt + instructions already consume most of the available context, leaving almost no room before compaction fires.


Current workaround

Setting compaction: { "auto": false } globally disables auto-compaction for all agents, including cloud agents that benefit from it. This is a regression for cloud workflows.


Expected behavior

compaction: { "enabled": false } in an agent config should prevent auto-compaction from triggering for that specific agent session, consistent with how other per-agent overrides already work (model, tools, steps, temperature, permission).


Proposed config

"agent": {
  "coder-local": {
    "model": "lmstudio/qwen/qwen3.5-9b",
    "compaction": { "enabled": false }
  },
  "lexis-one": {
    "model": "opencode-go/kimi-k2.6"
    // compaction uses global default
  }
}

Related issues


Why this matters

Local model support is one of OpenCode's key differentiators. Without per-agent compaction control, local models are effectively unusable in multi-turn sessions, which defeats the purpose of having local agent configurations.

Activity

  1. github-actions commented on Jun 29, 2026

    @github-actions
    Contributor

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

    If these existing issues cover your use case, please consider adding your context there instead.

  2. github-actions commented on Aug 29, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

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