Skip to content

Fix OpenCode token accounting in evaluation reports.#422

Merged
DhavalRepo18 merged 1 commit into
mainfrom
opencode_agent
Jun 29, 2026
Merged

Fix OpenCode token accounting in evaluation reports.#422
DhavalRepo18 merged 1 commit into
mainfrom
opencode_agent

Conversation

@ChathurangiShyalika

Copy link
Copy Markdown
Collaborator

Changes

  • Parse OpenCode tokens.input, tokens.output, tokens.reasoning, and cache token fields in the OpenCode runner.
  • Add evaluation fallback to read token usage from trajectory.raw_events when normalized turn tokens are zero.
  • Add regression tests for OpenCode token parsing and metrics fallback.

Why

OpenCode was showing Tokens In = 0 and Tokens Out = 0 in aggregate reports even though token usage existed in the raw trajectory events. This made comparisons with OpenClaw inaccurate.

Testing

  • Ran focused OpenCode runner and metrics tests.
  • Verified token extraction no longer returns zero for OpenCode-style events.

Signed-off-by: Chathurangi Shyalika <chathurangishyalika@Chathurangis-MacBook-Pro.local>

@DhavalRepo18 DhavalRepo18 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks Okay

@DhavalRepo18 DhavalRepo18 merged commit cb2cbad into main Jun 29, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants