Bug Description
The splitKnownProviderModel function in pkg/providers/factory.go incorrectly strips the provider prefix from model IDs when the model ID itself contains a known provider alias.
Steps to Reproduce
- Configure a model with a known provider prefix, e.g.:
{ "model": "google/gemini-3.1-flash-lite-preview" }
- The
google prefix is a known provider alias (resolves to google-vertex-ai)
splitKnownProviderModel identifies google as a known provider and strips it
- The returned
modelID becomes gemini-3.1-flash-lite-preview (without google/ prefix)
- This causes the wrong model to be used in downstream requests
Expected Behavior
When the model string already contains an explicit provider prefix (e.g., google/gemini-3.1-flash-lite-preview), the function should either:
- Return the model as-is without modification, OR
- Only strip the prefix if it actually needs to be resolved (i.e., when the model ID does not already contain a
/)
Root Cause
In pkg/providers/factory.go, the splitKnownProviderModel function checks if the first segment is a known provider alias and strips it unconditionally, without checking whether the original model string already had an explicit provider prefix.
Suggested Fix
The function should check whether the model string already contains a / before stripping the prefix. If it does, the model should be returned unchanged.
// Pseudo-code for the fix
func splitKnownProviderModel(model string) (provider, modelID string) {
// If model already contains a provider prefix (has '/'), return as-is
if strings.Contains(model, "/") {
return "", model
}
// ... existing logic
}
Or more precisely, only strip the prefix when the model ID itself starts with a known provider alias and the original string did not already have a /.
Environment
- picoclaw version: latest
- Go version: 1.25+
Bug Description
The
splitKnownProviderModelfunction inpkg/providers/factory.goincorrectly strips the provider prefix from model IDs when the model ID itself contains a known provider alias.Steps to Reproduce
{ "model": "google/gemini-3.1-flash-lite-preview" }googleprefix is a known provider alias (resolves togoogle-vertex-ai)splitKnownProviderModelidentifiesgoogleas a known provider and strips itmodelIDbecomesgemini-3.1-flash-lite-preview(withoutgoogle/prefix)Expected Behavior
When the model string already contains an explicit provider prefix (e.g.,
google/gemini-3.1-flash-lite-preview), the function should either:/)Root Cause
In
pkg/providers/factory.go, thesplitKnownProviderModelfunction checks if the first segment is a known provider alias and strips it unconditionally, without checking whether the original model string already had an explicit provider prefix.Suggested Fix
The function should check whether the model string already contains a
/before stripping the prefix. If it does, the model should be returned unchanged.Or more precisely, only strip the prefix when the model ID itself starts with a known provider alias and the original string did not already have a
/.Environment