-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Affected Component
AI Agents (Researcher/Developer/...)
Describe the bug
When creating a user-defined Qwen provider in Settings > Providers with the name "qwen", the default embedded
provider takes precedence over the user-defined one. The GetProvider() function in providers.go uses a switch
statement that matches all built-in provider names first, including "qwen", before checking the database. This
means user-defined providers with names matching built-in providers are never used.
Steps to Reproduce
- Configure
QWEN_API_KEYin.env - Start PentAGI - the default "qwen" provider is available
- Go to Settings > Providers and create a new Qwen provider named "qwen" with custom model config (e.g., change model to "qwen3.5-plus")
- Create a flow using the "qwen" provider
- The flow still uses the built-in default model (qwen3.5-flash) instead of the custom config from the database
Expected Behavior
User-defined providers should take precedence over default/embedded providers when names match.
Code Location
- File:
pentagi/backend/pkg/providers/providers.go - Function:
GetProvider()at line 677 - Issue: The switch statement at lines 683-704 matches
DefaultProviderNameQwenbefore checking the database at line 707
Current Logic (Bug)
func (pc *providerController) GetProvider(
ctx context.Context,
prvname provider.ProviderName,
userID int64,
) (provider.Provider, error) {
// Lookup default providers first
switch prvname {
case provider.DefaultProviderNameOpenAI:
return pc.Providers.Get(provider.DefaultProviderNameOpenAI)
// ... other cases ...
case provider.DefaultProviderNameQwen: // ← "qwen" matches here
return pc.Providers.Get(provider.DefaultProviderNameQwen) // ← returns built-in, never checks DB
}
// Lookup user defined providers by name and build it
prv, err := pc.db.GetUserProviderByName(...) // ← never reached for "qwen"
}System Configuration
PentAGI Version:1.2.0
docker Version: 27.5.1+dfsg4
Docker Compose version 2.32.4-3
Logs and Artifacts
No response
Screenshots or Recordings
No response
Verification
- I have checked that this issue hasn't been already reported
- I have provided all relevant configuration files (with sensitive data removed)
- I have included relevant logs and error messages
- I am running the latest version of PentAGI
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working