Skip to content

[Bug]: 0.1.10 drops OpenCode Go usage for API-key accounts: the server endpoint returns data: null and the Go-key reader never runs #36516

Closed

Description

@serendipity-sws

What happened

After updating to 0.1.10-nightly.20261113.4656, Usage → Limits shows no OpenCode Go row for local OpenCode instances that are authenticated with a Go API key only. On 0.1.9-nightly.20261110.4478 the same instances showed their Go session, weekly and monthly windows.

A remote environment whose OpenCode is signed in to a Console workspace still shows its row. With two Go accounts on this machine (two OpenCode provider instances, each with its own XDG_DATA_HOME), neither appears.

Diagnosis

  • The new path. In 0.1.10, the OpenCode provider's checkUsageLimits prefers the V2 server reading for a v2 runtime: openCode2Server.withConnection((c) => c.usageLimits(cwd)). It falls back to readOpenCodeGoUsageLimits (the Go-key reader) only when that returns undefined.
  • When it returns undefined. readServerUsageLimits does so only for HTTP 404, 405, or a 200 with an HTML body.
  • What a key-only instance gets. With no Console workspace signed in, OpenCode 2.3.0's GET /api/experimental/usage/limits answers 200 with {"data": null}. That becomes makeUnavailableUsageLimits({ reason: "unsupported", message: "No OpenCode Console workspace is signed in." }), which is not undefined, so the Go-key reader never runs and the account shows nothing.
  • The Go key works. GET https://opencode.ai/zen/go/v1/usage with Authorization: Bearer <go key> returns 200 with rolling, weekly and monthly for both accounts. That is the call readOpenCodeGoUsageLimits makes.
  • Likely origin. This looks like a side effect of the V2 server path that addressed [Bug]: Usage → Limits never reports OpenCode Go for OpenCode 2 Console logins #14983 (Console logins not reported). This report is the inverse: key-only accounts.

Suggested fix: treat data: null as "the server cannot read this account". Either:

  • return undefined from readServerUsageLimits when body.data === null; or
  • fall back to legacyUsageLimits in checkUsageLimits when the server result is unsupported.

Key-only accounts then keep the Go-key reader, and Console logins keep the server path.

Steps to reproduce

  1. Authenticate OpenCode 2.3.0 with an OpenCode Go API key only, with no Console workspace. Either:
    • auth.json → "opencode-go": { "type": "api", "key": ... }; or
    • an opencode.db credential row with integration_id = 'opencode-go' and type: "key".
  2. Add it as an OpenCode provider instance in T3 Code 0.1.10.
  3. Open Usage → Limits: there is no OpenCode Go row for that instance.
  4. Query the instance's OpenCode server directly:
    curl -u opencode:<server password> "http://127.0.0.1:<port>/api/experimental/usage/limits?location%5Bdirectory%5D=<project dir>"
    It returns {"data":null}.
  5. On 0.1.9 the same instance shows its Go windows.

Version

0.1.10-nightly.20261113.4656 (a regression from 0.1.9-nightly.20261110.4478)

Environment

Linux (WSL2), OpenCode 2.3.0, two OpenCode provider instances with separate XDG_DATA_HOME (two Go accounts, API keys only).

Evidence

# each local OpenCode server, as T3 calls it
GET /api/experimental/usage/limits?location[directory]=…   -> 200 {"data":null}
# the Go key, as readOpenCodeGoUsageLimits calls it
GET https://opencode.ai/zen/go/v1/usage  (Bearer <go key>)  -> 200 {"usage":{"rolling":{...},"weekly":{...},"monthly":{...}}}
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