anomalyco / anomalyco/opencode

[Bug] Main terminal cost tracking does not aggregate API costs from spawned parallel agent terminals

Open
#40,114 2 comments 0 reactions 1 assignee View on GitHub

@simonklee is already working on this.

Since Aug 2, 2026.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

Description

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.

Screenshot and/or share link

No response

Operating System

Fedora 45

Terminal

Konsole from KDE

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.