fix(config): warn when `llm.*` settings are silently ignored due to active provider
Description
When a provider is already configured (e.g. via ocr config provider), running ocr config set llm.url <URL> (or any other llm.* key) succeeds silently — but the value is never used at runtime.
This happens because the endpoint resolver (internal/llm/resolver.go:258) checks cfg.Provider first:
if cfg.Provider != "" {
return tryProviderConfig(cfg, modelOverride) // ← provider wins
}
return tryLegacyLlmConfig(cfg, modelOverride) // ← llm.* is only a fallback
Users who previously ran ocr config provider (which sets the provider field) and then try to override the URL via ocr config set llm.url will see the old provider URL used instead, with no indication that their setting was ignored.
Reported in #580 — user configured llm.url pointing to a custom endpoint but ocr llm test still hit the previously-configured dashscope URL.
Scope
- File(s):
cmd/opencodereview/config_cmd.go - Function/area:
runConfigSet(line 68),runConfigUnset(line 96) - Secondary: no changes needed in
internal/llm/resolver.go(resolver priority logic is correct by design)
Acceptance Criteria
- [ ] When
ocr config set llm.*is called whilecfg.Provideris non-empty, print a stderr warning like:[ocr] WARNING: provider "dashscope" is active and takes precedence over llm.* settings. [ocr] Use 'ocr config set providers.dashscope.<field> <value>' to configure the active provider, [ocr] or run 'ocr config unset provider' to disable provider-based config. - [ ] Support
ocr config unset provider— clears theprovider(andmodel) fields so the resolver falls back tollm.*config - [ ] Add/update unit tests for both behaviors
- [ ] Tests pass (
make test) - [ ] Code check passes (
make check)
Context
Discovered via #580. The resolver's priority order is intentional (provider > llm.* > env > shell rc), but the config CLI gives no feedback when a user writes to a lower-priority layer that will be shadowed. This is a UX gap, not a resolver bug.
I would like to take this up