feature: experimental.skip_models_fetch setting (resolves #4959)
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.
going to test something ignore
/review
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.
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.
Corrupted by a bad merge, will fix.
Fixed/uncorrupted.
An environment variable has been added that allows disabling the automatic models fetch.
Closing this PR as it is no longer needed.
An environment variable has been added that allows disabling the automatic models fetch.
Closing this PR as it is no longer needed.
Hi! Can you tell me which ENV you added to disable it? I can't find it anywhere.