Skip to content

Conversation

@ariane-emory
Copy link
Contributor

Resolves #4959.

This PR adds an experimental.skip_models_fetch setting.

If true, opencode will not automatically fetch an updated models list from models.dev.

The user can still manually trigger fetching an updated models list from models.dev with an opencode models --refresh command if they so choose.

@ariane-emory ariane-emory marked this pull request as ready for review December 2, 2025 22:43
@rekram1-node
Copy link
Collaborator

going to test something ignore

@rekram1-node
Copy link
Collaborator

/review

@ariane-emory ariane-emory marked this pull request as draft December 3, 2025 23:28
@ariane-emory
Copy link
Contributor Author

ariane-emory commented Dec 4, 2025

Doesn't quite work right yet: errors after 1 hour when the refresh should happen. Back to draft status until fixed.

Simply removing this timer event is not an option: this feature must not change any behaviour for users who do not choose to use the new experimental.skip_models_fetch: those users expect a model refresh every hour, so changing that would be a breaking change for them.

Not enabling the timer event in the first place when experimental.skip_models_fetch is true might be viable, but the timer event still has to happen and work properly when experimental.skip_models_fetch is false (or absent): in the false case, behaviour should be exactly as it was prior to this feature being added. Since the settings don't refresh live, if experimental.skip_models_fetch is true after loading the config, we can conclude that we will never need to automatically refresh the models for the lifespan of the program.

@ariane-emory ariane-emory force-pushed the feat/skip-models-fetch-setting-take-6 branch from 3255c8c to 886a467 Compare December 4, 2025 08:54
@ariane-emory
Copy link
Contributor Author

ariane-emory commented Dec 4, 2025

Redid this using a simpler and more concise strategy that avoids the 1 hour error by simply not registering the timer event in the first place when experimental.skip_models_refresh == true. Tested it for a few hours, appears to work correctly. LGTM, un-drafting it.

@ariane-emory ariane-emory marked this pull request as ready for review December 4, 2025 08:57
@ariane-emory ariane-emory marked this pull request as draft December 4, 2025 09:57
@ariane-emory ariane-emory marked this pull request as ready for review December 4, 2025 10:37
@ariane-emory ariane-emory changed the title feat: experimental.skip_models_fetch setting (resolves #4959) [FEATURE]: experimental.skip_models_fetch setting (resolves #4959) Dec 5, 2025
@ariane-emory ariane-emory changed the title [FEATURE]: experimental.skip_models_fetch setting (resolves #4959) feature: experimental.skip_models_fetch setting (resolves #4959) Dec 5, 2025
@ariane-emory ariane-emory deleted the feat/skip-models-fetch-setting-take-6 branch December 6, 2025 05:47
@ariane-emory ariane-emory restored the feat/skip-models-fetch-setting-take-6 branch December 6, 2025 06:36
@ariane-emory ariane-emory reopened this Dec 6, 2025
@ariane-emory ariane-emory force-pushed the feat/skip-models-fetch-setting-take-6 branch 2 times, most recently from d6e99d8 to aab1b75 Compare December 30, 2025 22:43
ariane-emory and others added 26 commits December 30, 2025 17:44
…iane-emory/opencode into feat/skip-models-fetch-setting-take-6
@ariane-emory
Copy link
Contributor Author

An environment variable has been added that allows disabling the automatic models fetch.

Closing this PR as it is no longer needed.

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.

[FEATURE]: Add option to disable models.dev fetch for corporate proxy environments

4 participants