Skip to content

fix(config): validate hot-reloaded config before applying to live agent#6083

Merged
bug-ops merged 1 commit into
mainfrom
fix/6063-hot-reload-validate-bypass
Jul 11, 2026
Merged

fix(config): validate hot-reloaded config before applying to live agent#6083
bug-ops merged 1 commit into
mainfrom
fix/6063-hot-reload-validate-bypass

Conversation

@bug-ops

@bug-ops bug-ops commented Jul 11, 2026

Copy link
Copy Markdown
Owner

Summary

  • Agent::reload_config never called Config::validate() on the reloaded config — unlike the startup path (src/bootstrap/mod.rs, src/tui_remote.rs), which always validates immediately after Config::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 into Config::validate() by fix(config): wire dead validate() functions and fix migrate idempotency guards #6058.
  • load_config_with_overlay now calls config.validate() on 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.
  • Added 3 regression tests (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 — clean
  • cargo clippy --profile ci --workspace --all-targets --features "desktop,ide,server,chat,pdf,scheduler,testing" -- -D warnings — clean, 0 warnings
  • cargo nextest run --config-file .github/nextest.toml --workspace --features "desktop,ide,server,chat,pdf,scheduler" --lib --bins — 12882 passed, 0 failed, 35 skipped
  • RUSTFLAGS="-D warnings" RUSTDOCFLAGS="--deny rustdoc::broken_intra_doc_links" cargo doc --no-deps --workspace --features "desktop,ide,server,chat,pdf,scheduler" — clean
  • New unit tests added and passing (load_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)
  • Testing playbook updated (playbooks/config-validate-wiring.md, Scenario 6) and coverage-status.md row added for live-session follow-up verification

@github-actions github-actions Bot added the bug Something isn't working label Jul 11, 2026
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.
@github-actions github-actions Bot added the size/M Medium PR (51-200 lines) label Jul 11, 2026
@bug-ops bug-ops enabled auto-merge (squash) July 11, 2026 19:23
@bug-ops bug-ops force-pushed the fix/6063-hot-reload-validate-bypass branch from aa08532 to e174b34 Compare July 11, 2026 19:23
@github-actions github-actions Bot added documentation Improvements or additions to documentation rust Rust code changes core zeph-core crate labels Jul 11, 2026
@bug-ops bug-ops merged commit 68c131e into main Jul 11, 2026
43 checks passed
@bug-ops bug-ops deleted the fix/6063-hot-reload-validate-bypass branch July 11, 2026 19:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working core zeph-core crate documentation Improvements or additions to documentation rust Rust code changes size/M Medium PR (51-200 lines)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

hot-reload path bypasses Config::validate(), skipping all 7 newly-wired invariant checks

1 participant