#12048: fix: deduplicate config warnings to log once instead of on every reload
size: S
trusted-contributor
experienced-contributor
Cluster:
Hooks and UI Fixes
## Summary
Fixes #12005
- Config warnings (e.g., "plugin disabled but config is present") were logged on **every** `loadConfig()` call, producing thousands of duplicate entries in the error log over time
- Added a module-level `loggedConfigWarnings` Set that tracks already-logged warning content, mirroring the existing `loggedInvalidConfigs` dedup pattern for error messages
- Warnings are keyed by `configPath:details` so changed warnings (e.g., different plugin disabled) still get logged
## Test plan
- [x] New test: repeated `loadConfig()` calls produce exactly 1 warning log (fails before fix, passes after)
- [x] New test: changed config produces a new warning log (ensures dedup doesn't over-suppress)
- [x] Full CI gate: `pnpm build && pnpm check && pnpm test` — all 249 tests pass
- [x] Codex review: clean, no issues found
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
This PR updates config loading to avoid repeatedly logging the same config warning on every `loadConfig()` call, and adds/adjusts tests to verify warnings are logged once per warning-content change.
The changes fit into the existing config validation/logging flow in `src/config/io.ts`, extending the prior invalid-config dedup behavior to warning-level logs so long-running processes don’t spam logs during frequent reloads.
<h3>Confidence Score: 5/5</h3>
- This PR is safe to merge with minimal risk.
- The change is narrow (log deduplication), includes targeted tests for both repeated and changed-warning scenarios, and avoids unbounded memory growth by using a single last-warning key.
- No files require special attention.
<!-- greptile_other_comments_section -->
<!-- /greptile_comment -->
Most Similar PRs
#15948: fix(logging): prevent recursive logger/config stack overflow
by Glucksberg · 2026-02-14
79.3%
#20499: test(plugins): add bundled+config duplicate discovery regression
by dcol91863 · 2026-02-19
78.6%
#15613: fix(config): align default pipelines across loadConfig and readConf...
by AI-Reviewer-QS · 2026-02-13
77.4%
#20822: fix(config): deduplicate config warnings to prevent log spam
by marcodelpin · 2026-02-19
77.3%
#16991: fix(config): add missing defaults to config snapshot path
by AI-Reviewer-QS · 2026-02-15
77.0%
#18966: fix(config): downgrade unknown bundled plugin references to warnings
by moxunjinmu · 2026-02-17
75.1%
#13838: UI: fix config panel CI failures and modularize rendering
by fresed05 · 2026-02-11
75.1%
#19510: fix(config): preserve configured values on invalid config validatio...
by yash27-lab · 2026-02-17
75.1%
#13849: fix(configure): preserve custom config keys across wizard sections
by mcaxtr · 2026-02-11
75.0%
#11549: lint: add no-console rule and migrate 5 files to structured logger
by vaibhavtupe · 2026-02-08
75.0%