refactor: introduce modelsdev.ID for provider-qualified model identity#2766
Merged
Conversation
106d0ca to
9386e47
Compare
simonferquel
approved these changes
May 12, 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.
Fixes #2743.
Replaces bare
stringmodel identifiers with a strongly-typedmodelsdev.ID(provider + model name) on the API surface thatthe issue called out as bug-prone, so the compiler refuses
unqualified model strings where a
provider/modelpair isrequired.
What changes
New type —
pkg/modelsdev/id.go:ID{Provider, Model}withNewID,ParseID,ParseIDOrZero,String,IsZero,IsValid.API now takes/returns
modelsdev.IDinstead ofstring:modelsdev.Store.GetModel,runtime.ModelStore.provider.Provider.ID()andbase.Config.ID(), plus allimplementations (anthropic, bedrock, gemini, openai, oaistream,
dmr, vertexai/modelgarden, rulebased, …).
modelinfo.LoadCaps,modelinfo.IsClaude,modelinfo.LookupFamily.oaistream.ConvertMessages/ConvertMultiContent,bedrock.convertMessages,gemini.convertMessagesToGemini,the per-provider
convertDocumenthelpers,bedrock.detectCachingSupport.rulebased.Client.LastSelectedModelID.strategy.EmbeddingConfig.ModelID,strategy.VectorStoreConfig.ModelID, internalmodelStoreinterface,
calculateSemanticUsageCost.Internal adapters:
runtime.getAgentModelID/getEffectiveModelIDreturnmodelsdev.ID; agent-info events convert via.String()atthe boundary.
team.AgentInforeadsProvider/Modelfrom the ID directlyinstead of splitting a string.
runtime.strip_modalitiesparseshooks.Input.ModelIDviamodelsdev.ParseID.Why
Several call sites used to pass a bare model name (e.g.
"claude-sonnet-4-6") where aprovider/modelpair wasexpected. The compiler had no way to flag these mistakes and they
silently fell through to "model not found" lookups. Lifting the
identity to a dedicated type makes the contract explicit and
unforgeable.