Skip to content

[Task] Audit OpenCode Go free quota isolation per install #737

@Astro-Han

Description

@Astro-Han

Goal

PawWork should not expose users to a shared OpenCode Go / free-model quota pool unless that behavior is explicit, intentional, and safe.

Two separate users reported the same error almost back-to-back:

Free usage exceeded, subscribe to Go https://opencode.ai/go

One screenshot showed a retry delay of about 50223 seconds. That timing correlation is a strong product-risk signal, but it is not yet proof that all PawWork users share one quota pool.

When this task is done, we should know what identity OpenCode Go uses for PawWork requests and either guarantee per-install/per-device isolation or remove any misleading bundled-free expectation.

Scope

In scope:

  • Trace OpenCode Go / free-model request identity from PawWork desktop runtime through the OpenCode provider request.
  • Confirm whether current requests include any per-device or per-install identity. Current local evidence shows PawWork sends x-opencode-project, x-opencode-session, x-opencode-request, and x-opencode-client, but no obvious device/install ID.
  • Confirm whether the observed failure is tied to IP, API key, workspace/account, model-level pressure, region, or another OpenCode Go server-side limiter.
  • Decide the product boundary:
    • PawWork-owned anonymous install token / relay if we promise per-device free usage.
    • Require user-owned OpenCode Go API keys if the provider quota is account/workspace based.
    • Stop treating Go/free models as a reliable default free path if isolation cannot be guaranteed.
  • Add or improve diagnostics so support can see the provider, model, auth source, status code, retry-after value, and normalized error type without exposing secrets.

Out of scope:

  • Changing OpenCode Go paid billing semantics.
  • Building a broad subscription or provider marketplace flow unless it is required to close this specific risk.
  • Treating the two simultaneous reports as confirmed proof before checking the server-side quota dimension.

Relevant files or context

Likely code paths:

  • packages/opencode/src/session/retry.ts
    • Maps FreeUsageLimitError to Free usage exceeded, subscribe to Go https://opencode.ai/go.
    • Uses provider retry-after-ms / retry-after headers to compute the long retry delay.
  • packages/opencode/src/session/llm.ts
    • Adds OpenCode request headers for opencode* providers.
  • packages/opencode/src/provider/provider.ts
    • Loads provider API keys from env and saved auth.
    • Configures provider baseURL / API key for OpenCode Go.
  • packages/opencode/src/auth/index.ts
    • Stores saved provider auth in runtime data.

External references checked during triage:

Verification

  • Reproduce or instrument one OpenCode Go/free-model request from a clean PawWork install and confirm the exact identity fields sent upstream.
  • Compare at least these cases if feasible:
    • Two fresh installs on different devices / networks.
    • Two fresh installs on the same network.
    • Saved user-owned OpenCode Go API key vs no saved key.
  • Verify that support diagnostics can distinguish:
    • No key / anonymous path.
    • Saved key path.
    • Env key path.
    • Provider/server quota vs transient provider overload.
  • If a code change follows, add targeted tests for the normalized error/diagnostic behavior and manually verify the desktop user path.

Execution mode

Agent should investigate and propose a plan first.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1High priorityappApplication behavior and product flowstaskNarrow execution, audit, spike, migration, tracking, or upstream follow-up work

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions