Repository navigation
Description
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.
catalogFingerprintcoversproviderID,id,name,providerNameand the variant ids. It leaves outfamily,released,deprecatedandprice, which are the inputs ofmarkOpenCodeLegacy.- The catalog watch drops a re-read whose fingerprint equals the previous one (
status.tsL689). Itslatestcatalog therefore stays the one it first read, with the oldfamily. enrichSnapshotoverlays that catalog on each snapshot it publishes, throughwithOpenCode2Catalog, which recomputesmodelsfrom it. A check reads the newfamily, and the published models are then computed from the stale catalog instead.latestis only cleared when the event stream fails (status.tsL776).
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
-
T3 Code desktop with its managed OpenCode 2.4.3 server and OpenAI connected.
openai/gpt-6.2-astraandopenai/gpt-6.2-solhaveisLegacy: truein~/.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). -
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" } } } } } -
Settings → Providers → "Refresh provider status". The snapshot's
checkedAtadvances. Both models still haveisLegacy: true, and@gptstill does not offer them. -
Query T3's managed server:
opencode api --server http://127.0.0.1:<port> get /api/model. It returns the newfamilyfor both models, and replayingmarkOpenCodeLegacyon the response marks neither legacy. The snapshot still hasisLegacy: truefor both. -
Add
"chat-latest": { "name": "Chat Latest (refresh)" }to the samemodelsmap. Within 2 seconds both models haveisLegacy: falsein the snapshot.checkedAthas not changed, so no new check ran. Removing the entry again leaves them correct, and@gptnow 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.
Activity