You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug] Main terminal cost tracking does not aggregate API costs from spawned parallel agent terminals #40114
Bug Description
When running sequential tasks in the main terminal and spawning multiple agents to execute tasks in parallel, the main terminal fails to update its total API cost with the expenses incurred by the spawned child agents.
While individual agent terminals correctly track and display their own API costs, the main terminal retains the cost value it had before the agents were spawned. As a result, the actual API spending is higher than what the main terminal displays.
Plugins
caveman
OpenCode version
1.18.11
Steps to reproduce
Run tasks sequentially in the main terminal (e.g., observe a starting cost of $0.39).
Spawn multiple parallel agents from the main terminal.
Let Agent 1 incur a cost of $0.04 and Agent 2 incur a cost of $0.05.
Check the cost display across the terminals.
Expected Behavior
The main terminal should dynamically aggregate the costs from all active/spawned child agents.
Using the example above: Main terminal ($0.39) + Agent 1 ($0.04) + Agent 2 ($0.05) = $0.48 total displayed in the main terminal.
Actual Behavior
The main terminal remains stuck at the pre-spawn cost ($0.39).
Only the individual agent terminals reflect their specific API usage.
Total API consumption is actually $0.48, but the main terminal incorrectly reflects only $0.39.
Generated with an agent from my opencode config, dont have the time to gather the details, but the main point is that:
i got 32 million tokens input, 263k output, for a total price of 39$
opencode saw only a total of 67k tokens for 2.76$, because it was tracking only the main agent
This is a catastrophic failure, this kind of bug that may cost so much money should not exist !!!
Reproduced on opencode 1.17.20 (Linux) with the same symptom as described above: the TUI footer shows only the parent session cost and does not roll up costs from spawned subagents.
Reproduction data (from ~/.local/share/opencode/opencode.db, table session, columns cost, model, parent_id):
Metric
Value
Parent session (TUI footer) cost
$2.92
Parent model
gpt-5.6 sol (openai, variant medium)
Spawned subagents
21 (all gpt-5.6-sol, openai, variant medium)
Subagents cumulative cost
$35.89
Total real cost (parent + children)
$38.81
Under-reporting factor
~13.3×
The 21 subagents were a mix of explore, generation, audit, evidence-repair and semantic-review tasks spawned via the Task tool during a single root session. The parent row's cost stayed frozen at its own value and never reflected any child spend, matching the behavior described in this issue.
Thanks for the report! OpenCode 2.0 is now out and development is focused on V2, so we're closing issues filed against OpenCode 1. Please upgrade (opencode upgrade --major, details: https://anoma.ly/notes/opencode-2-0), and if this is still relevant on 2.0, reopen this issue or open a new one with your 2.0 version.
Activity
github-actions commentedon Aug 2, 2026
This issue might be a duplicate of existing issues. Please check:
klopstock-dviz commentedon Aug 25, 2026
Generated with an agent from my opencode config, dont have the time to gather the details, but the main point is that:
This is a catastrophic failure, this kind of bug that may cost so much money should not exist !!!
Reproduced on opencode 1.17.20 (Linux) with the same symptom as described above: the TUI footer shows only the parent session cost and does not roll up costs from spawned subagents.
Reproduction data (from ~/.local/share/opencode/opencode.db, table session, columns cost, model, parent_id):
The 21 subagents were a mix of explore, generation, audit, evidence-repair and semantic-review tasks spawned via the Task tool during a single root session. The parent row's cost stayed frozen at its own value and never reflected any child spend, matching the behavior described in this issue.
docs: document chipp-ai/opencode fork status and install instructions
thdxr commentedon Oct 11, 2026
Thanks for the report! OpenCode 2.0 is now out and development is focused on V2, so we're closing issues filed against OpenCode 1. Please upgrade (
opencode upgrade --major, details: https://anoma.ly/notes/opencode-2-0), and if this is still relevant on 2.0, reopen this issue or open a new one with your 2.0 version.— from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊