Skip to content

[Bug]: OpenCode models keep stale legacy flags after a family change in OpenCode's catalog, even after Refresh provider status #46664

Done

Description

@yuweiyang9611

Before submitting

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

Area

apps/server (packages/provider-opencode)

What happened

After a model's family changes in OpenCode's catalog, T3 keeps the model's old isLegacy flag. "Refresh provider status" runs a new check but the flag stays. It only updates once some other field of the catalog changes (a model id, name, provider name or variant list).

I hit this while working around #46663: I overrode family for gpt-6.2-astra and gpt-6.2-sol in OpenCode's config so they would stop being marked legacy, and T3 kept marking them legacy.

Diagnosis

From reading the code; the observations under "Steps to reproduce" match it.

  • catalogFingerprint covers providerID, id, name, providerName and the variant ids. It leaves out family, released, deprecated and price, which are the inputs of markOpenCodeLegacy.
  • The catalog watch drops a re-read whose fingerprint equals the previous one (status.ts L689). Its latest catalog therefore stays the one it first read, with the old family.
  • enrichSnapshot overlays that catalog on each snapshot it publishes, through withOpenCode2Catalog, which recomputes models from it. A check reads the new family, and the published models are then computed from the stale catalog instead.
  • latest is only cleared when the event stream fails (status.ts L776).

The watch was added in #41626.

Not tested, but by the same code path: a model that becomes deprecated, changes price or gets a corrected release date in OpenCode's catalog would keep its old legacy state too, and restarting T3 Code should clear it, because a new watch starts with no previous fingerprint.

Adding family, released, deprecated and price to catalogFingerprint would cover it.

Steps to reproduce

  1. T3 Code desktop with its managed OpenCode 2.4.3 server and OpenAI connected. openai/gpt-6.2-astra and openai/gpt-6.2-sol have isLegacy: true in ~/.t3/caches/opencode.json (see [Bug]: OpenCode's GPT-6.2 Astra and Sol are marked legacy because same-price Healthcare variants were released later #46663).

  2. Add this to ~/.config/opencode/opencode.json:

    {
      "providers": {
        "openai": {
          "models": {
            "gpt-6.2-astra": { "family": "gpt-astra-general" },
            "gpt-6.2-sol": { "family": "gpt-sol-general" }
          }
        }
      }
    }
  3. Settings → Providers → "Refresh provider status". The snapshot's checkedAt advances. Both models still have isLegacy: true, and @gpt still does not offer them.

  4. Query T3's managed server: opencode api --server http://127.0.0.1:<port> get /api/model. It returns the new family for both models, and replaying markOpenCodeLegacy on the response marks neither legacy. The snapshot still has isLegacy: true for both.

  5. Add "chat-latest": { "name": "Chat Latest (refresh)" } to the same models map. Within 2 seconds both models have isLegacy: false in the snapshot. checkedAt has not changed, so no new check ran. Removing the entry again leaves them correct, and @gpt now offers both.

Expected behavior

A change to any field that feeds legacy marking republishes the model list, and the result of "Refresh provider status" is not replaced by an older catalog.

Actual behavior

The legacy flags stay as they were when the watch first read the catalog, until an unrelated catalog change alters the fingerprint.

Impact

Minor bug or occasional failure.

Version or commit

T3 Code 0.1.14-nightly.20261201.5530 (772e3d4d694c). The code is unchanged on main @ a5a39fa.

Environment

Windows 11 (10.0.26300), T3 Code desktop (Nightly), OpenCode 2.4.3 (T3's managed server) with OpenAI connected.

Workaround

Change any fingerprinted field once, as in step 5, then undo it. Restarting T3 Code should also work; I did not test that.

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