Skip to content

fix: treat released=0 as unknown date so config-declared models stay visible - #49616

Open
0xalydev wants to merge 1 commit into
anomalyco:devfrom
0xalydev:fix/config-model-release-date-visibility
Open

0xalydev wants to merge 1 commit into
anomalyco:devfrom
0xalydev:fix/config-model-release-date-visibility

Conversation

@0xalydev

@0xalydev 0xalydev commented Sep 17, 2026

Copy link
Copy Markdown

Issue for this PR

Closes #49605

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

The server uses time.released = 0 as 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 into new Date(0).toISOString().slice(0, 10) which produces "1970-01-01".

The visibility filter in models.tsx has an escape hatch: if a model's release date is not a valid date (!date?.isValid), it returns true (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 in opencode.jsonc is invisible in the model picker unless they manually override it in settings.

The fix is one line: when model.time.released === 0, set release_date to undefined instead of converting the epoch timestamp. That makes date?.isValid falsy, the escape hatch fires, and the model is shown. The field type is already string | 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 normalizeProviderList suite in utils.test.ts asserting that an active model with time.released === 0 produces release_date: undefined. The existing test for the deprecated gpt-old model already uses released: 0 and asserts that model is filtered entirely, confirming the deprecated-model path is unchanged. Logic traced through models.tsx visible() function to confirm undefined hits the !date?.isValid escape hatch.

Screenshots / recordings

Not a UI change - model visibility is a state filter, not a visual component.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

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
@github-actions github-actions Bot added needs:compliance This means the issue will auto-close after 2 hours. and removed needs:compliance This means the issue will auto-close after 2 hours. labels Sep 17, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

web: config-declared models are hidden by default — released:0 is coerced to "1970-01-01" and fails the client visibility window

1 participant