Skip to content

[Bug]: OpenCode Go usage appears once per linked environment for the same Console workspace #44416

Done

Description

@Ceneka

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

Not sure

Steps to reproduce

  1. On two machines, sign in to the same OpenCode Go subscription (OpenCode 2 / opencode 2.4.2, same Console workspace).
  2. Link both machines as environments in T3 Code.
  3. Open Usage → Limits with both environments included (no environment filter).

Expected behavior

One OpenCode account per Console workspace, as with providers that report an email. Session, Weekly, and Monthly should each have one bar, and the pooled percentage and ↻ reset forecast should count the subscription once.

Actual behavior

Each environment contributes its own OpenCode row. Every Go window (Session, Weekly, Monthly) renders two bars side by side with the same reset time and nearly identical percentages, e.g. 97% and 96% in Session from two reads seconds apart, 18% and 18% Weekly, 11% and 11% Monthly. The large pooled percentage on the left and the ↻ forecast are computed from both reports, so the same subscription is counted twice and the numbers are slightly off.

This looks like the same "before" state shown in #37429.

Impact

Cosmetic issue (misleading usage reporting; no work is blocked).

Version or commit

T3 Code 0.1.13 (desktop, Linux x64). The linked environment is reachable; its exact build was not recorded.

Environment

  • Local: NixOS 26.05, Linux 6.18.57 x86_64, T3 Code desktop 0.1.13
  • Linked environment: ifive
  • Provider: OpenCode, opencode CLI 2.4.2 (OpenCode 2), same OpenCode Go Console workspace signed in on both machines

Logs or stack traces

No error is reported. The OpenCode 2 usage report has no identity for collectLimitAccounts to merge on:

  • packages/provider-opencode/src/server/v2/usageLimits.ts decodes workspace.id from /api/experimental/usage/limits but drops it, and returns no credentialFingerprint (explicitly asserted in OpenCode2Client.test.ts).
  • collectLimitAccounts in packages/shared/src/usageLimits.ts keys a native provider by email or credentialFingerprint. With neither, nativeRowKey falls back to ${environmentId}:${provider.instanceId}, so two environments can never merge into one row.
  • The legacy Go reader (packages/provider-opencode/src/server/usageLimits.ts) does set a fingerprint derived from the API key, so only the OpenCode 2 workspace reader has this gap.
  • The duplicate becomes visible once the linked environment also reports OpenCode 2 usage, which v0.1.13 enabled with "show usage limits from remote OpenCode 2 servers" (fix(opencode): show usage limits from remote OpenCode 2 servers #43368).

Workaround

Filter Usage to one environment, or unlink the second environment. Neither is a real fix.

Related

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions