feat(doctor): deeper config validation — walk-up, overlays, unknown keys#237
Merged
emal-avala merged 1 commit intomainfrom Apr 24, 2026
Merged
feat(doctor): deeper config validation — walk-up, overlays, unknown keys#237emal-avala merged 1 commit intomainfrom
emal-avala merged 1 commit intomainfrom
Conversation
Extends `/doctor` with checks that catch the class of "my config silently did nothing" problems: - **Project-config walk-up**: uses the same ancestor walk the loader uses, so a sub-crate session in a monorepo reports the repo-root `settings.toml` instead of silently finding nothing. Also reports `.agent/settings.local.toml` when present as its own row. - **Per-file syntax dry-run**: each of user / project / local files is parsed separately. A broken file is surfaced as a fail row with the parse error, instead of only showing up at the next `/reload`. - **Unknown top-level section detection**: `#[serde(default)]` on the root config makes typos silent (`[permisions]` quietly becomes a nop). Diagnostics now lists any unknown top-level key against an explicit allow-list so those typos get flagged. - **Env-var precedence warning**: when more than one provider API key env var is set, warns which ones are being ignored. The resolver is deterministic but the user may not realize the others have no effect. Tests: - Known sections produce an empty unknown-key list - Typo section (`permisions`) is flagged - Unknowns are returned sorted for stable output - Allow-list guard fails the moment the loader grows a new section that isn't taught here - Non-table TOML root is a no-op (robustness) Full diagnostics suite: 21 pass, 0 fail. Clippy clean.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Extends
/doctorwith deeper config validation. Catches the class of "my config silently did nothing" problems that#[serde(default)]tolerance otherwise hides.New checks
config:project_filevia walk-upconfig:project_local_file.agent/settings.local.tomloverlay detected, reports parse failures[permisions]env:api_key_precedenceKnown allow-list:
api,ui,permissions,features,security,sandbox,mcp_servers,hooks,subagents,allowed_project_dirs.Example session
Before: user has a sub-crate cwd in a monorepo and a typo'd
[permisions]section in the repo-root config —/doctoreither misses the file entirely or silently passes.After:
Why this matters
#[serde(default)]on the root config struct silently drops unknown fields — the right call at load time (forwards-compat with newer tools writing a shared file) but it converts config typos into total-silent no-ops. The allow-list guard test fails the moment the loader grows a new section without an accompanying/doctorentry, so this stays in sync.Tests (5 new)
Full
services::diagnosticssuite: 21 pass, 0 fail. Clippy clean.Test plan
cargo test -p agent-code-lib --lib services::diagnosticscargo clippy --workspace --tests --no-deps -- -D warningscargo fmt --all --check