You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Make legacy providers.* environment variables load correctly by switching provider parsing to nested envPrefix tags that caarlos0/env actually resolves.
🗣️ Type of Change
🐞 Bug fix (non-breaking change which fixes an issue)
✨ New feature (non-breaking change which adds functionality)
📖 Documentation update
⚡ Code refactoring (no functional changes, no api changes)
🤖 AI Code Generation
🤖 Fully AI-generated (100% AI, 0% Human)
🛠️ Mostly AI-generated (AI draft, Human verified/modified)
👨💻 Mostly Human-written (Human lead, AI assisted or none)
Reasoning: the previous env:"PICOCLAW_PROVIDERS_{{.Name}}_*" tags are not expanded by the env loader, so provider API keys from environment variables were silently ignored. This patch replaces them with supported nested prefixes and adds regression coverage.
🧪 Test Environment
Hardware: PC
OS: Windows 11
Model/Provider: N/A
Channels: N/A
📸 Evidence (Optional)
Click to view Logs/Screenshots
go test ./pkg/config -run 'Test(LoadConfig_ProviderEnvVarsOverrideFileValues|LoadConfig_OpenAIProviderEnvVarsUseNestedPrefix|LoadConfig_WebToolsProxy|LoadConfig_OpenAIWebSearchDefaultsTrueWhenUnset|LoadConfig_OpenAIWebSearchCanBeDisabled)' -count=1
Follow-up update: I pushed a forward-only sync commit so provider values now pick up the nested PICOCLAW_PROVIDERS_* environment prefixes on the current config layout. Local validation on this branch: go test ./pkg/config -run TestLoadConfig_ProviderEnvVarsOverrideFileValues -count=1 and go test ./pkg/config -run TestLoadConfig_OpenAIProviderEnvVarsUseNestedPrefix -count=1 both pass.
Follow-up update: I replaced the tag-based attempt with a forward-only post-parse env override so nested PICOCLAW_PROVIDERS_* values now load without touching the current struct-tag hotspot. Local validation: go test ./pkg/config -run TestLoadConfig_ProviderEnvVarsOverrideFileValues -count=1 and go test ./pkg/config -run TestLoadConfig_OpenAIProviderEnvVarsUseNestedPrefix -count=1 both pass, and a real local merge against current main now succeeds.
I rebuilt this fix on top of the current main and re-ran go test ./pkg/config -count=1 locally. The code path is still valid, but I cannot update this PR branch with the refreshed history because GitHub is rejecting the push without workflow scope once the branch picks up the current .github/workflows/docker-build.yml changes from upstream.
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
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.
📝 Description
Make legacy
providers.*environment variables load correctly by switching provider parsing to nestedenvPrefixtags thatcaarlos0/envactually resolves.🗣️ Type of Change
🤖 AI Code Generation
🔗 Related Issue
Fixes #836
📚 Technical Context (Skip for Docs)
env:"PICOCLAW_PROVIDERS_{{.Name}}_*"tags are not expanded by the env loader, so provider API keys from environment variables were silently ignored. This patch replaces them with supported nested prefixes and adds regression coverage.🧪 Test Environment
📸 Evidence (Optional)
Click to view Logs/Screenshots
go test ./pkg/config -run 'Test(LoadConfig_ProviderEnvVarsOverrideFileValues|LoadConfig_OpenAIProviderEnvVarsUseNestedPrefix|LoadConfig_WebToolsProxy|LoadConfig_OpenAIWebSearchDefaultsTrueWhenUnset|LoadConfig_OpenAIWebSearchCanBeDisabled)' -count=1☑️ Checklist