cli: opencode stats reports no tool calls when all calls are still running

Open Beginner friendly
#64,631 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
70/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
bun, typescript
Domain
cli

Research direction

Start by tracing the opencode stats default card and compare how it counts calls with the detailed and JSON views; the payload does not name source files or tests. Reproduce with a single unfinished tool call and check that the card reports one call while leaving the success rate unavailable, then confirm it still reports no calls before any call and 100.0% success after completion.

Written by the indexing model from the issue text.

Description

area/cli platform/windows type/bug version/v2
Description

When the only tool call in the selected range is still running, the default opencode stats card says no tool calls. The detailed and JSON views correctly count that call. A success rate is not available yet, but that is different from zero calls.

Steps to reproduce
  1. Use a fresh project that has a single pending tool call, for example a question waiting for a reply, and no completed or failed calls in the range.
  2. Before the call finishes, compare opencode stats --project . --days 1, the same command with --tools, and with --json.
  3. The card says no tool calls; the detail view says 0 finished calls · 1 unfinished; JSON reports calls: 1 and unfinished: 1.

Verified with the production Core projector and stats collector in an in-memory database. A loopback fixture replayed their outputs to the unmodified CLI, which printed the same discrepancy in 3/3 runs. Controls: before the call the card correctly reported no calls; after successful completion it reported 100.0% tool success. No live provider or user database was involved.

OpenCode version

V2 dev at 22377659a8ed223f3eebc86660dd1a5bc2b33ca5 (2.3.0).

Operating System

Windows 11 x64, Bun 1.4.4.

Terminal

CLI subprocess with captured stdout; no TUI or third-party plugins.

Dominant language
TypeScript
Stars
227k
Forks
30.7k
Avg merge
4h 35m
Merged PRs (30d)
498

Getting set up

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.

More from anomalyco/opencode

All issues in anomalyco/opencode

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.