Repository navigation
Conversation
Models declared in opencode.jsonc that the server does not have a release date for are emitted with time.released=0. Mapping 0 to new Date(0) produces the ISO string "1970-01-01", which is a valid Luxon DateTime. The visibility filter in models.tsx only shows models whose release date is within the past 6 months or whose date is invalid/unknown. With a valid 1970-01-01 date the model fell into the "hidden by default" branch and never appeared in the model picker, even though the user had explicitly configured it. Fix: when model.time.released === 0, set release_date to undefined instead. That makes date?.isValid falsy in the visibility guard, which triggers the "return true" escape hatch and keeps the model visible. Also adds a dedicated regression test to normalizeProviderList covering active models with released=0 asserting release_date is undefined. Fixes: anomalyco#49605
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
|
Independently confirmed the bug on a real affected setup (desktop 2.0.14, macOS, custom OpenAI-compatible provider with 11 config-declared models): Verified this branch locally:
One blocker — The optional Two nits while reviewing: |
|
Thank you @yingliang-zhang for the careful review and catching the typecheck blocker. Updated in commit d1dfb41:
|
|
This branch has been upgraded to V2. We're no longer taking PRs for V1. If you think this is still relevant, please port it over and open it for V2. — from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊 |
Issue for this PR
Closes #49605
Type of change
What does this PR do?
The server uses
time.released = 0as a sentinel for models that have no known release date (config-declared models, locally-hosted models, providers not yet in the registry).normalizeProviderList()was converting that 0 intonew Date(0).toISOString().slice(0, 10)which produces"1970-01-01".The visibility filter in
models.tsxhas an escape hatch: if a model's release date is not a valid date (!date?.isValid), it returnstrue(visible). The problem is"1970-01-01"is a perfectly valid Luxon DateTime, so the escape hatch never fires. The model is then checked against the "latest set" (released within the past 6 months) and fails, landing in the hidden branch. Result: any model a user explicitly declares inopencode.jsoncis invisible in the model picker unless they manually override it in settings.The fix is one line: when
model.time.released === 0, setrelease_datetoundefinedinstead of converting the epoch timestamp. That makesdate?.isValidfalsy, the escape hatch fires, and the model is shown. The field type is alreadystring | undefined(optional) in the SDK, so no type changes are needed.How did you verify your code works?
Added a new test case to the existing
normalizeProviderListsuite inutils.test.tsasserting that an active model withtime.released === 0producesrelease_date: undefined. The existing test for the deprecatedgpt-oldmodel already usesreleased: 0and asserts that model is filtered entirely, confirming the deprecated-model path is unchanged. Logic traced throughmodels.tsxvisible()function to confirmundefinedhits the!date?.isValidescape hatch.Screenshots / recordings
Not a UI change - model visibility is a state filter, not a visual component.
Checklist