#15613: fix(config): align default pipelines across loadConfig and readConfigFileSnapshot
stale
size: XS
Cluster:
Config Management Improvements
## Summary
Three code paths in `src/config/io.ts` apply different subsets of defaults:
| Default function | loadConfig | snapshot (file exists) | snapshot (no file) |
|---|---|---|---|
| applyCompactionDefaults | Yes | **No** | Yes |
| applyContextPruningDefaults | Yes | **No** | Yes |
| applyLoggingDefaults | Yes | Yes | **No** |
This causes the config editor UI to compute incorrect diffs.
## Fix
- Add missing `applyCompactionDefaults` and `applyContextPruningDefaults` to the snapshot file-exists path
- Add missing `applyLoggingDefaults` to the snapshot no-file path
## Test plan
- [x] Existing config IO tests pass
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
Updates `src/config/io.ts` so `readConfigFileSnapshot()` applies the same runtime default pipeline regardless of whether a config file exists (adds `applyCompactionDefaults`/`applyContextPruningDefaults` on the file-exists path, and adds `applyLoggingDefaults` on the no-file path). This aligns snapshot behavior with `loadConfig()`, reducing UI diffs caused by inconsistent default application.
Main behavior change is limited to which defaults are applied in the snapshot config object; parsing/validation/include resolution remains unchanged.
<h3>Confidence Score: 4/5</h3>
- This PR is likely safe to merge, with one behavioral concern around mutation/aliasing in the snapshot pipeline to double-check.
- Changes are narrowly scoped to applying missing default functions in `readConfigFileSnapshot`, matching existing `loadConfig` behavior. The main risk is that snapshot objects are mutated in-place via `normalizeConfigPaths`, which can create reference aliasing if other steps reuse object graphs, potentially impacting diff/patch computation.
- src/config/io.ts
<sub>Last reviewed commit: d604095</sub>
<!-- greptile_other_comments_section -->
<!-- /greptile_comment -->
Most Similar PRs
#16991: fix(config): add missing defaults to config snapshot path
by AI-Reviewer-QS · 2026-02-15
91.4%
#12048: fix: deduplicate config warnings to log once instead of on every re...
by mcaxtr · 2026-02-08
77.4%
#19510: fix(config): preserve configured values on invalid config validatio...
by yash27-lab · 2026-02-17
76.7%
#11873: fix: eliminate TOCTOU race in readExecApprovalsSnapshot
by Yida-Dev · 2026-02-08
76.7%
#4897: fix: config logic issues (#4689, #4654)
by lailoo · 2026-01-30
76.1%
#6139: Config Reload button not clearing unsaved changes indicator
by saurabhssonkar · 2026-02-01
75.7%
#23339: fix: use snapshot.parsed for env ref restoration during migrate
by Mathew-Harvey · 2026-02-22
74.1%
#5823: fix(config): exit cleanly on invalid config instead of high CPU loop
by gavinbmoore · 2026-02-01
73.8%
#15948: fix(logging): prevent recursive logger/config stack overflow
by Glucksberg · 2026-02-14
73.6%
#13838: UI: fix config panel CI failures and modularize rendering
by fresed05 · 2026-02-11
73.1%