Description
The sidebar Context section only sums cost from assistant messages in the current session. When subagents are spawned (via the Task tool), their cost is not included in the displayed total. This makes the reported cost misleading during subagent-heavy workflows -- the actual API spend can be significantly higher than what the sidebar shows.
The session.children() API already exists and returns child sessions. The sidebar cost calculation could aggregate costs across the parent and all child sessions.
Current behavior
Sidebar shows cost from messages.reduce((sum, x) => sum + (x.role === "assistant" ? x.cost : 0), 0) which only covers the current session.
Expected behavior
Sidebar should show total cost across the parent session and all child sessions, with an optional breakdown (e.g. $0.47 main + $0.31 subs (3)).
Related
OpenCode version
1.4.3
Operating System
macOS
Terminal
Ghostty
Description
The sidebar Context section only sums
costfrom assistant messages in the current session. When subagents are spawned (via the Task tool), their cost is not included in the displayed total. This makes the reported cost misleading during subagent-heavy workflows -- the actual API spend can be significantly higher than what the sidebar shows.The
session.children()API already exists and returns child sessions. The sidebar cost calculation could aggregate costs across the parent and all child sessions.Current behavior
Sidebar shows cost from
messages.reduce((sum, x) => sum + (x.role === "assistant" ? x.cost : 0), 0)which only covers the current session.Expected behavior
Sidebar should show total cost across the parent session and all child sessions, with an optional breakdown (e.g.
$0.47 main + $0.31 subs (3)).Related
OpenCode version
1.4.3
Operating System
macOS
Terminal
Ghostty