session-cost/spent-value under reported for sessions with 100+ messages #4712

Open
opened 2026-02-16 17:45:08 -05:00 by yindo · 1 comment
Owner

Originally created by @IdrisGit on GitHub (Jan 11, 2026).

Originally assigned to: @rekram1-node on GitHub.

Description

The TUI sidebar displays incorrect spent value for sessions that exceed 100 messages. The cost only accumulates from the last 100 messages stored in memory, not from all messages that exist in the session.

Plugins

No response

OpenCode version

1.1.12

Steps to reproduce

  1. Start a new session with a paid model.
  2. Continue conversation until you have > 100 messages (requires iterative work over several hours/days).
  3. Check the spent value displayed in the sidebar.
  4. Compare with actual cost (using Zen dashboard).

Expected: Sidebar shows accurate total cost from all messages including messages that were reverted.
Actual: Sidebar shows cost only from the last ~100 messages.

Screenshot and/or share link

No response

Operating System

Arch Linux (Omarchy)

Terminal

Ghostty

Originally created by @IdrisGit on GitHub (Jan 11, 2026). Originally assigned to: @rekram1-node on GitHub. ### Description The TUI sidebar displays incorrect spent value for sessions that exceed 100 messages. The cost only accumulates from the last 100 messages stored in memory, not from all messages that exist in the session. ### Plugins _No response_ ### OpenCode version 1.1.12 ### Steps to reproduce 1. Start a new session with a paid model. 2. Continue conversation until you have > 100 messages (requires iterative work over several hours/days). 3. Check the spent value displayed in the sidebar. 5. Compare with actual cost (using Zen dashboard). Expected: Sidebar shows accurate total cost from all messages including messages that were reverted. Actual: Sidebar shows cost only from the last ~100 messages. ### Screenshot and/or share link _No response_ ### Operating System Arch Linux (Omarchy) ### Terminal Ghostty
yindo added the bugzen labels 2026-02-16 17:45:08 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Jan 11, 2026):

This issue might be a duplicate of existing issues. Please check:

  • #6989: [TUI] $ spent in context decreases after request - Similar issue with spent value calculations being incorrect
  • #7387: Multi Model Cost Calculations are Bugged - Cost calculation issues when using multiple models in a session
  • #7175: The token cost generated by session titles, message summary titles, and body summaries has not been accounted for - Related cost accounting issue
  • #2891: Cost in storage/session is always 0 - Related cost tracking issue

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Jan 11, 2026): This issue might be a duplicate of existing issues. Please check: - #6989: [TUI] $ spent in context decreases after request - Similar issue with spent value calculations being incorrect - #7387: Multi Model Cost Calculations are Bugged - Cost calculation issues when using multiple models in a session - #7175: The token cost generated by session titles, message summary titles, and body summaries has not been accounted for - Related cost accounting issue - #2891: Cost in storage/session is always 0 - Related cost tracking issue Feel free to ignore if none of these address your specific case.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#4712