mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-30 03:43:39 +00:00
estimateTokens charged 4800 chars per image in the toolResult branch but counted only text in the user branch, so image blocks in recent user turns scored zero. findCutPoint never reached keepRecentTokens and left the cut at the earliest point, so image-heavy sessions compacted to a no-op and looped on context overflow. Fold the per-image accounting into one shared helper used by both branches.