Skip to content

[Bug]: Context Tracking Undercount for Ollama Provider #17799

@dtthanh1971

Description

@dtthanh1971

Summary

Description
Context usage is severely undercounted when using Ollama provider (ollama/minimax-m2.5:cloud, etc.). The displayed context (e.g., "2.7k/205k (1%)") does not reflect actual token usage.

Steps to reproduce

  1. Use Ollama model (e.g., ollama/minimax-m2.5:cloud)
  2. Run multiple prompts/conversations
  3. Check context via session_status or //status
  4. Compare with actual Ollama usage at https://ollama.com/usage

Expected behavior

Context should accumulate correctly and reflect actual token usage, similar to other providers (Zhipu, Google, etc.)

Actual behavior

Context display stays very low (0-3%) even after extensive use
"Tokens: X in / Y out" also appears undercounted
Watchdog triggers compact based on inaccurate context data
Risk: User runs out of quota without knowing (quotas may deplete silently)

OpenClaw version

2026.2.14

Operating system

Model: ollama/minimax-m2.5:cloud OS: WSL2 (Linux)

Install method

No response

Logs, screenshots, and evidence

Impact and severity

No response

Additional information

This affects all Ollama cloud models
Context tracking works correctly for glm-4.7, gpt52, etc.
Need external monitor (ollama.com/usage) to track actual usage

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions