Skip to content

[Bug]: openclaw 2026.3.24: compaction.model override ignored in overflow recovery path — causes cascade of HTTP 400 failures #56649

Description

@bobgitmcgrath

Bug type

Behavior bug (incorrect output/state without crash)

Beta release blocker

No

Summary

Bug Description

When agents.defaults.compaction.model is configured to route compaction summarisation through a different model than the session default, the override is ignored for mid-turn overflow recovery compactions. This causes:

  • Overflow recovery tries to re-summarise using the session model (e.g. MiniMax)
  • MiniMax returns HTTP 400 "context window exceeds limit" (rate limited)
  • Compaction fails → retry → timeout
  • Context does not compress → fills up faster → cascades

Environment

  • OpenClaw version: 2026.3.24 (cff6dc9)
  • Session default model: ollama/minimax-m2.7:cloud
  • Compaction override: anthropic/claude-opus-4-6 (set in agents.defaults.compaction.model)

Steps to Reproduce

  1. Set session default model to a provider that can rate-limit (e.g. MiniMax via Ollama cloud-sync)
  2. Configure agents.defaults.compaction.model to anthropic/claude-opus-4-6
  3. Use the session normally — context will fill
  4. When context limit is hit mid-turn, overflow recovery fires
  5. Expected: Overflow recovery uses anthropic/claude-opus-4-6
  6. Actual: Overflow recovery uses session default minimax-m2.7:cloud → 400 → fail

Root Cause

Two distinct compaction code paths:

Path 1 — LCM Compaction (✅ working)
compactSafeguardExtension → uses compactionModelOverride from config → correctly resolves to override model.

Path 2 — Overflow Recovery (❌ bug)
runAgentEmbedded lines ~175662–175698, inside the main agent loop. When an HTTP 400 fires mid-turn, it builds overflowCompactionRuntimeContext using the session's provider/modelId variables — compactionModelOverride is never consulted.

Evidence from logs:

  • Ollama logs show 18 HTTP 400s today from minimax-m2.7:cloud
  • OpenClaw embedded error logs show "model":"minimax-m2.7:cloud", "provider":"ollable"
  • LCM compactions correctly log "Compaction summarization model: anthropic/claude-opus-4-6 (override)" and succeed

Config In Place

{
  "agents": {
    "defaults": {
      "compaction": {
        "model": "anthropic/claude-opus-4-6"
      }
    }
  }
}

### Steps to reproduce

1. Set session default model to a provider that can rate-limit (e.g. MiniMax via Ollama cloud-sync)
2. Configure agents.defaults.compaction.model to a different model (e.g. anthropic/claude-opus-4-6)
3. Use the session normally until context fills
4. When context limit is hit mid-turn, overflow recovery fires
5. Observe: overflow uses session default model (MiniMax) instead of the override → HTTP 400 → compaction fails
6. Expected: overflow recovery should use the configured compaction.model override

### Expected behavior

When context limit is hit mid-turn and overflow recovery fires, the configured compaction.model override (e.g. anthropic/claude-opus-4-6) should be used for the summarisation attempt, not the session's default model. Compaction succeeds and context is compressed.

### Actual behavior

Overflow recovery uses the session default model (e.g. minimax-m2.7:cloud) instead of the configured compaction.model override. MiniMax returns HTTP 400 "context window exceeds limit" (rate limited). Compaction fails, retry fires within 60s window, hits rate limit again, times out after ~60s. Context does not compress and the failure cascades.

### OpenClaw version

2026.3.24

### Operating system

Ubuntu 24.04.4 LTS

### Install method

_No response_

### Model

minimax/opus

### Provider / routing chain

ollama-minimax/direct-anthropic

### Additional provider/model setup details

_No response_

### Logs, screenshots, and evidence

```shell

Impact and severity

No response

Additional information

Suggested fix:

In dist/pi-embedded-BaSvmUpW.js, the overflowCompactionRuntimeContext builder (~line 175662-175698) should check for and use compactionModelOverride when constructing the provider/modelId fields, the same way the LCM compaction path does at line 167832.

The fix should ensure that when agents.defaults.compaction.model is configured, both:
(a) scheduled/LCM compactions, and
(b) mid-turn overflow recovery compactions
use the override model rather than the session default.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingbug:behaviorIncorrect behavior without a crash

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions