openclaw - 💡(How to fix) Fix [Feature]: Context pruning for non-caching providers (Xiaomi MiMo and others) [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#62067Fetched 2026-04-08 03:09:28
View on GitHub
Comments
0
Participants
1
Timeline
1
Reactions
0
Author
Participants
Timeline (top)
labeled ×1

Enable context pruning for providers not in the cache-TTL eligible list, so token consumption doesn't grow unbounded for providers like Xiaomi MiMo.

Root Cause

Context pruning (cache-ttl mode) is gated behind isCacheTtlEligibleProvider(), which only includes anthropic, moonshot, and zai. For Xiaomi MiMo (and any other unlisted provider), pruning is completely disabled — the context grows unbounded with every interaction, tool call, and web search. This results in massive token consumption: simple messages cost 500k+ tokens after a few tool calls because the full history is sent every time.

RAW_BUFFERClick to expand / collapse

Summary

Enable context pruning for providers not in the cache-TTL eligible list, so token consumption doesn't grow unbounded for providers like Xiaomi MiMo.

Problem to solve

Context pruning (cache-ttl mode) is gated behind isCacheTtlEligibleProvider(), which only includes anthropic, moonshot, and zai. For Xiaomi MiMo (and any other unlisted provider), pruning is completely disabled — the context grows unbounded with every interaction, tool call, and web search. This results in massive token consumption: simple messages cost 500k+ tokens after a few tool calls because the full history is sent every time.

Proposed solution

Decouple context pruning from cache-TTL eligibility. Pruning should run for all providers — for non-caching providers it still reduces context size and token consumption, even without the caching benefit. Alternatively, add xiaomi to the eligible providers list as a first step.

Alternatives considered

No response

Impact

Affected: All users using Xiaomi MiMo (Token Plan) Severity: High — makes the provider practically unusable for long sessions or tool-heavy tasks Frequency: Always — every session grows unbounded Consequence: 500k+ tokens consumed per simple message after a few tool calls, costing significant credits

Evidence/examples

OpenClaw 2026.3.13, provider xiaomi (token-plan-ams.xiaomimimo.com), model mimo-v2-pro. Root cause found in source: buildContextPruningFactory() returns early at isCacheTtlEligibleProvider() check. Xiaomi is not in CACHE_TTL_NATIVE_PROVIDERS = ["anthropic", "moonshot", "zai"].

Additional information

No response

extent analysis

TL;DR

Decoupling context pruning from cache-TTL eligibility or adding Xiaomi to the eligible providers list can help mitigate unbounded token consumption for providers like Xiaomi MiMo.

Guidance

  • Review the isCacheTtlEligibleProvider() function to understand how it gates context pruning and consider modifying it to include Xiaomi or decouple pruning from cache-TTL eligibility.
  • Investigate the buildContextPruningFactory() function to see how it returns early when a provider is not in the CACHE_TTL_NATIVE_PROVIDERS list and consider adjusting this logic.
  • Evaluate the impact of adding Xiaomi to the CACHE_TTL_NATIVE_PROVIDERS list as a potential short-term solution.
  • Consider testing the proposed solution with Xiaomi MiMo to verify the reduction in token consumption.
  • Review the CACHE_TTL_NATIVE_PROVIDERS list to determine if other providers should also be included to prevent similar issues.

Example

No code snippet is provided as the issue does not include specific code that can be modified.

Notes

The proposed solution may have implications for other providers not currently in the CACHE_TTL_NATIVE_PROVIDERS list, and careful consideration should be given to how changes may affect these providers.

Recommendation

Apply a workaround by decoupling context pruning from cache-TTL eligibility, as this approach is likely to have a broader positive impact on token consumption for multiple providers, not just Xiaomi MiMo.

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