Skip to content

compaction.model config is ignored when cliBackends is enabled #58077

Description

@yoyaku155

Bug Description

The agents.defaults.compaction.model configuration is completely ignored when a session is bound to a cliBackends backend (e.g., claude-cli). The CLI backend performs compaction using the session's primary model instead of the configured compaction model.

Expected Behavior

When compaction.model is set (e.g., to a smaller, cheaper model), ALL compaction operations should use that model — including compactions triggered for sessions bound to CLI backends.

Actual Behavior

  • compaction.model is only read by compactEmbeddedPiSessionDirect (internal compaction path)
  • Sessions bound to cliBackends (e.g., claude-cli) delegate compaction to the CLI backend, which does NOT read compaction.model
  • The CLI backend always uses the session's primary model for compaction

Reproduction

  1. Configure two local LLM servers: a large model (e.g., 122B) and a small model (e.g., 9B)
  2. Set agents.defaults.compaction.model to the small model
  3. Configure agents.defaults.cliBackends.claude-cli
  4. Use Discord or other channel that creates sessions bound to claude-cli
  5. Fill the session until auto-compaction triggers
  6. Observe: the large model handles compaction, the small model receives no requests

Impact

  • Users cannot offload compaction to a cheaper/lighter model when using CLI backends
  • On GPU-constrained setups (e.g., running large local models), this causes unnecessary GPU memory pressure from the main model performing compaction, potentially leading to system instability

Environment

  • OpenClaw version: 2026.3.28
  • OS: macOS (Apple Silicon)
  • CLI backend: Claude Code

Relevant Code Paths

  • compactEmbeddedPiSessionDirect in auth-profiles-*.js: Reads compaction.model
  • delegateCompactionToRuntime in delegate-*.js: Routes to compactEmbeddedPiSessionDirect
  • CLI backend compaction: Does NOT call compactEmbeddedPiSessionDirect, uses own model ✗

Suggested Fix

Either:

  1. Pass compaction.model config to the CLI backend process so it can use the specified model for compaction
  2. Or intercept CLI-backend compaction and route it through compactEmbeddedPiSessionDirect which already handles the model override

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions