openclaw - 💡(How to fix) Fix MiniMax sessions: totalTokens stays undefined when model does not return usage data [1 pull requests]

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…

Root Cause

The preflight compaction path in agent-runner-memory.ts already has a fallback (estimatePromptTokensFromSessionTranscript) for when freshPersistedTokens is unavailable. However, the memory-flush path in the same file does not have this fallback.

Fix Action

Fixed

RAW_BUFFERClick to expand / collapse

Describe the bug

When a model provider (e.g., MiniMax) does not return usage data in its API response, the session entry totalTokens stays undefined forever. This breaks the memory-flush path and causes redundant compaction loops.

Root Cause

The preflight compaction path in agent-runner-memory.ts already has a fallback (estimatePromptTokensFromSessionTranscript) for when freshPersistedTokens is unavailable. However, the memory-flush path in the same file does not have this fallback.

Proposed fix

Add the same estimatePromptTokensFromSessionTranscript fallback that the preflight compaction path already uses, into the memory-flush path.

See PR: to follow

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 MiniMax sessions: totalTokens stays undefined when model does not return usage data [1 pull requests]