fix(config): warn when active provider shadows llm settings - #588
Conversation
|
🔍 OpenCodeReview found 2 issue(s) in this PR.
[bug · medium] 📄
|
lizhengfeng101
left a comment
There was a problem hiding this comment.
Nice PR — two small issues:
-
legacyLLMShadowWarning: thestrings.ToLoweron the key causes false-positive warningsThe config system is case-sensitive, so
LLM.urlorLlm.modelwon't actually set a valid config field. Butstrings.HasPrefix(strings.ToLower(key), "llm.")still matches them and emits the shadow warning, which is misleading. Should just bestrings.HasPrefix(key, "llm.")without the ToLower. -
flags.go:282: the unset usage error message lost helpful examplesThe original error text listed examples for both
custom_providers.<name>andmcp_servers.<name>. The new version only showsocr config unset provideras an example, making it harder for users to discover the other unset targets. Consider keeping at least one example per supported key type.
Done |
Description
Warns users when they configure
llm.*settings while an active provider takes precedence over them.Adds
ocr config unset provider, which clears the active provider and top-level model so OCR can fall back to legacyllm.*configuration. Saved provider entries and credentials remain intact for later reuse.Type of Change
How Has This Been Tested?
make testpasses locallyManual testing (describe below)
Ran focused configuration and resolver tests:
go test ./cmd/opencodereview ./internal/llmRan the full race-enabled suite:
make testRan formatting, dependency, and vet checks:
Added test coverage for warnings on shadowed
llm.*settings and forocr config unset provider.Checklist
go fmt,go vet)Related Issues
Closes #583