045865377c
Post-update safety net for the config half of #64160: Desktop update/repair cycles have rewritten user-set model.provider/model.default/model.base_url/ model.api_key and dropped the moa: section entirely — settings the gateway and unattended cron jobs also consume, so the rewrite silently redirects paid inference machine-wide. Mirrors the restore_cron_jobs_if_emptied pattern (#34600): compare the live config.yaml against the pre-update quick snapshot taken minutes earlier by the same update run and restore ONLY protected keys the user had set that were changed or dropped — never the whole file, so version stamps and new sections the migration legitimately wrote survive. Runs on every update completion path via _check_and_apply_config_migration, plus the same net for every sibling profile against its own same-generation snapshot (#66140 pattern). Exception-swallowing: a safety-net failure never breaks an otherwise-good update. 6 new tests in tests/hermes_cli/test_backup.py cover restore-on-rewrite, no-op-on-untouched, preservation of legitimate migration writes, no-op when the user never set the protected keys, unreadable live config, and missing snapshot id. Fixes #64160 (config half; the active-profile half is the desktop migration commits earlier on this branch).