openclaw - 💡(How to fix) Fix Feature request: fallback model chain for compaction and LCM summaryModel [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#56781Fetched 2026-04-08 01:47:50
View on GitHub
Comments
0
Participants
1
Timeline
0
Reactions
0
Author
Participants

Fix Action

Fix / Workaround

Current workaround

RAW_BUFFERClick to expand / collapse

Problem

Compaction (agents.defaults.compaction.model) and LCM (plugins.entries.lossless-claw.config.summaryModel) each accept a single model. If that model is rate-limited or unavailable, compaction fails silently — sessions grow unbounded until the primary model recovers.

Agent chat has a proper fallback chain (agents.defaults.model.fallbacks), but compaction and LCM do not.

Proposed solution

Add an optional fallbacks array (same semantics as agents.defaults.model.fallbacks) to:

  • agents.defaults.compaction.fallbacks
  • plugins.entries.lossless-claw.config.summaryModelFallbacks (or similar)

When the primary compaction/summary model fails with 429, 500, or timeout (same triggers as agent model failover), OpenClaw should try the next model in the fallback list before giving up.

Use case

Primary: anthropic/claude-sonnet-4-6 (flat-rate MAX plan — free) Fallback: openrouter/anthropic/claude-3.5-haiku (metered — only used on failure)

This lets users keep compaction on a free/cheap primary while having a paid safety net that only fires when needed.

Current workaround

None within OpenClaw. An external reverse proxy could implement the fallback, but that adds operational complexity and another failure point.

Environment

OpenClaw 2026.3.13 (61d171a), macOS arm64

extent analysis

Fix Plan

To implement the fallback chain for compaction and LCM, follow these steps:

  • Add a fallbacks array to agents.defaults.compaction and plugins.entries.lossless-claw.config:
    • agents.defaults.compaction.fallbacks: list of models to try if primary compaction model fails
    • plugins.entries.lossless-claw.config.summaryModelFallbacks: list of models to try if primary summary model fails
  • Update the compaction and LCM logic to try the next model in the fallback list if the primary model fails with 429, 500, or timeout

Example code snippet (in JavaScript):

// Add fallbacks array to compaction and LCM config
const compactionConfig = {
  model: 'anthropic/claude-sonnet-4-6',
  fallbacks: ['openrouter/anthropic/claude-3.5-haiku']
};

const summaryModelConfig = {
  model: 'anthropic/claude-sonnet-4-6',
  fallbacks: ['openrouter/anthropic/claude-3.5-haiku']
};

// Update compaction and LCM logic to try fallback models
async function compactData(model, fallbacks) {
  try {
    // Try primary model
    await compactDataWithModel(model);
  } catch (error) {
    if (error.statusCode === 429 || error.statusCode === 500 || error.timeout) {
      // Try fallback models
      for (const fallbackModel of fallbacks) {
        try {
          await compactDataWithModel(fallbackModel);
          return;
        } catch (error) {
          // Continue to next fallback model
        }
      }
    }
    // If all models fail, throw error
    throw error;
  }
}

Verification

To verify the fix, test the compaction and LCM functionality with the primary model rate-limited or unavailable. The system should try the next model in the fallback list and succeed if one of the fallback models is available.

Extra Tips

  • Make sure to handle errors and timeouts properly when trying fallback models.
  • Consider adding a limit to the number of fallback models to try to prevent infinite loops.
  • Test the fallback chain thoroughly to ensure it works as expected in different scenarios.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix Feature request: fallback model chain for compaction and LCM summaryModel [1 participants]