Skip to content

TUI: refresh token counts after agent runs complete - #1079

Merged
steipete merged 1 commit into
openclaw:mainfrom
d-ploutarchos:fix/tui-token-refresh
Jan 17, 2026
Merged

steipete merged 1 commit into
openclaw:mainfrom
d-ploutarchos:fix/tui-token-refresh

Conversation

@d-ploutarchos

Copy link
Copy Markdown

Summary

  • Fixes the TUI footer showing tokens 0/200k (0%) even when sessions have significant token usage
  • Adds refreshSessionInfo() call after agent runs complete to update the footer with accurate token counts

Problem

The TUI never refreshed session info after agent runs, so token counts stayed at their initial values (often 0). This prevented users from seeing context buildup and getting warnings before hitting the 200K context limit.

Changes

  • src/tui/tui-event-handlers.ts: Added refreshSessionInfo to context and call it when evt.state === "final"
  • src/tui/tui.ts: Pass refreshSessionInfo to createEventHandlers()

Test plan

  • Build passes (pnpm build)
  • All 3,204 tests pass (pnpm test)
  • Manual: Start TUI, send messages, verify token counter updates in footer after each response

Closes #1078

🤖 Generated with Claude Code

@steipete steipete self-assigned this Jan 17, 2026
@steipete
steipete merged commit 55622ba into openclaw:main Jan 17, 2026
@steipete

Copy link
Copy Markdown
Contributor

Landed via temp rebase onto main.

  • Gate: pnpm lint && pnpm build && pnpm test
  • Land commit: 504f2b0
  • Merge commit: 55622ba

Thanks @d-ploutarchos!

dustin-olenslager pushed a commit to dustin-olenslager/ironclaw-supreme that referenced this pull request Mar 24, 2026
lovewanwan pushed a commit to lovewanwan/openclaw that referenced this pull request Apr 28, 2026
…resh

TUI: refresh token counts after agent runs complete
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 9, 2026
…resh

TUI: refresh token counts after agent runs complete
jameslcowan pushed a commit to jameslcowan/openclaw that referenced this pull request Jun 2, 2026
zeekay pushed a commit to Dream-AI-4444/clawdbot that referenced this pull request Sep 11, 2026
…resh

TUI: refresh token counts after agent runs complete
zooqueen pushed a commit to zooqueen/openclaw that referenced this pull request Sep 11, 2026
lhfer pushed a commit to lhfer/openclaw that referenced this pull request Oct 11, 2026
…resh

TUI: refresh token counts after agent runs complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TUI: Token counter shows 0/200k - not refreshing after agent runs

2 participants