fix(config): validate hot-reloaded config before applying to live agent#6083
Merged
Conversation
Agent::reload_config never called Config::validate() on the reloaded config, unlike the startup path (bootstrap/mod.rs, tui_remote.rs). An invalid config edited into the running config file (empty/duplicate LLM providers, inverted ACON/fidelity/trajectory thresholds, etc.) was silently applied to the live runtime instead of being rejected. load_config_with_overlay now validates the fully-assembled config (after the plugin overlay merge, so overlay-introduced invalid values are also caught) and returns None on failure, following the same warn-and-keep-previous-state pattern already used for the Config::load and overlay-merge error branches in the same function.
aa08532 to
e174b34
Compare
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
Agent::reload_confignever calledConfig::validate()on the reloaded config — unlike the startup path (src/bootstrap/mod.rs,src/tui_remote.rs), which always validates immediately afterConfig::load(). An invalid config edited into the running config file (empty/duplicate LLM providers, inverted ACON/fidelity/trajectory thresholds, etc.) was silently applied to the live agent runtime on the next hot-reload, bypassing all 7 invariant checks wired intoConfig::validate()by fix(config): wire dead validate() functions and fix migrate idempotency guards #6058.load_config_with_overlaynow callsconfig.validate()on the fully-assembled config (after the plugin overlay merge, so overlay-introduced invalid values are also caught) and returnsNoneon failure, following the same warn-and-keep-previous-state pattern already used for theConfig::loadand overlay-merge error branches in the same function.crates/zeph-core/src/agent/config_reload.rs): invalid config rejected, valid config still applies, and — the strongest guarantee — prior live runtime state is provably untouched after a rejected reload.Closes #6063
Test plan
cargo +nightly fmt --check— cleancargo clippy --profile ci --workspace --all-targets --features "desktop,ide,server,chat,pdf,scheduler,testing" -- -D warnings— clean, 0 warningscargo nextest run --config-file .github/nextest.toml --workspace --features "desktop,ide,server,chat,pdf,scheduler" --lib --bins— 12882 passed, 0 failed, 35 skippedRUSTFLAGS="-D warnings" RUSTDOCFLAGS="--deny rustdoc::broken_intra_doc_links" cargo doc --no-deps --workspace --features "desktop,ide,server,chat,pdf,scheduler"— cleanload_config_with_overlay_returns_none_on_invalid_config,load_config_with_overlay_returns_some_on_valid_config,reload_config_preserves_runtime_state_on_validation_failure)playbooks/config-validate-wiring.md, Scenario 6) andcoverage-status.mdrow added for live-session follow-up verification