Skip to content

console: Go usage breakdown shows duplicate model rows #45502

Closed

Description

@opencode-agent

Summary

The OpenCode Go usage breakdown can display two rows for the same model with the same quota, including DeepSeek V4 Flash. Usage recorded before quota-multiplier metadata was added remains separate from newer usage even when both resolve to the same multiplier.

Environment

  • opencode version: Console source at c2eacd72afc4a4984564c393e15ab30011057269 (dev); the customer's deployed revision was not inspected.
  • OS / Terminal / Shell / Active plugins: Not relevant to this hosted Console aggregation bug.
  • Install/channel: Hosted OpenCode Go usage page; deterministic local reproduction using Bun 1.3.14.

Reproduction

  1. Use a Go model in a usage window containing both historical requests without enrichment.costMultiplier and newer requests with that field.
  2. Have the historical fallback resolve to the same multiplier as the newer requests.
  3. Expand the window's usage details on the Go page.

The same failure is reproducible directly through buildLiteUsageBreakdown by passing two sources with identical model IDs and resolved multipliers, one estimated and one recorded.

Expected Behavior

One row per model and resolved quota multiplier, with summed cost and quota contribution. Actual multiplier changes should remain separate because their displayed quotas differ.

Actual Behavior

Two rows have the same model name and quota. The breakdown helper keeps both query groups rather than merging them after the fallback multiplier has been resolved.

Additional Context

queryLiteUsageDetails groups by model and the raw stored multiplier. Historical NULL metadata therefore forms a separate SQL group. Commit afd6f3b064bbb5d49ecd8e2d1037f5deca711d9e introduced recording the multiplier on August 25.

This is a presentation-aggregation issue, not evidence of duplicated requests or charges. Peak/off-peak token prices affect request cost, not this grouping key. Reproduced against the actual breakdown helper; no customer database records were queried.

Requested by: @MrMushrooooom (Jack via Slack)

Activity

  1. pengzh1 commented on Aug 27, 2026

    @pengzh1

    Taking this. Plan: merge the estimated (historical NULL-multiplier) group with the recorded group once the fallback resolves to the same multiplier, inside buildLiteUsageBreakdown so it's covered by a unit test. Genuinely different multipliers stay separate rows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingzenRelates to Zen

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions