refactor: remove duplication in model resolution, thinking budget, and message construction#2038
Merged
dgageot merged 1 commit intodocker:mainfrom Mar 10, 2026
Conversation
rumpl
previously approved these changes
Mar 10, 2026
|
❌ PR Review Failed — The review agent encountered an error and could not complete the review. View logs. |
20f85e0 to
8e50290
Compare
…d message construction - NewAgentMessage takes a plain string instead of *agent.Agent since only the name was used. - Replace duplicated isThinkingBudgetDisabled functions in provider.go and teamloader.go with a single ThinkingBudget.IsDisabled() method. - Extract resolveModelRefs to deduplicate createProvidersFromInlineAlloy and createProvidersFromAlloyConfig, then inline the trivial wrappers. - Extract ParseModelRef for the strings.Cut(ref, "/") + ModelConfig construction pattern repeated in six call sites. Assisted-By: docker-agent
8e50290 to
6930817
Compare
aheritier
approved these changes
Mar 10, 2026
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
Four focused deduplication changes that remove ~60 lines of repeated code without changing behavior.
Changes
NewAgentMessage(string)— accepts a plain string instead of*agent.Agentsince only the name was used. Simplifies tests and reduces coupling between session and agent packages.ThinkingBudget.IsDisabled()— replaces two divergent copies ofisThinkingBudgetDisabled(inprovider.goandteamloader.go) with a single method on the type itself.resolveModelRefs— deduplicatescreateProvidersFromInlineAlloyandcreateProvidersFromAlloyConfigwhich had identical loop bodies, then inlines the trivial wrappers at their two call sites.ParseModelRef— extracts thestrings.Cut(ref, "/")+ validation +ModelConfigconstruction pattern that was repeated in six places across teamloader, model_switcher, provider routing, config overrides, evaluation, and YAML unmarshaling.Assisted-By: docker-agent