refactor(config): replace get_default_provider/get_provider_model with unified get_session_config#3000
Merged
tusharmath merged 4 commits intomainfrom Apr 14, 2026
Merged
Conversation
…h unified get_session_config
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.
Summary
Replace the dual
get_default_provider/get_provider_modelAPI with a single unifiedget_session_configmethod that returns aModelConfig(provider + model pair) orNone.Context
The previous
AppConfigServicetrait exposed two separate methods —get_default_provider()returningResult<ProviderId>andget_provider_model(Option<&ProviderId>)returningResult<ModelId>— that callers always had to invoke together and chain manually. This split made call-sites verbose, error-prone, and hard to reason about. Since provider and model are always configured atomically viaSetSessionConfig, there is no reason to read them separately.Changes
get_default_providerandget_provider_modelfromAppConfigServiceand replaced them withget_session_config() -> Option<ModelConfig>ForgeAppConfigServiceimplementation: the new method readsForgeConfig::sessiononce and returnsSome(ModelConfig)orNone, eliminating the intermediateprovider_idlookup stepforge_api,forge_app(agent, agent_provider_resolver, command_generator, data_gen), andforge_main(ui, vscode) to use the new methodvscode.rstest helpers by removing the mutex-guardedEnvGuardboilerplate and replacing it with a lighter inlineunsafeenv-var setup/teardownModelConfigobject instead of provider and model separatelyTesting
cargo insta test --accept