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
Contributor
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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