fix(auth): make provider config writes atomic - #16504
Closed
Yukipukii1 wants to merge 1 commit into
Closed
Conversation
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
This fixes two non-atomic
config.yamlwrites in the auth provider flow.Previously, Hermes wrote
config.yamldirectly in:_update_config_for_provider()_reset_config_provider()That meant an interrupted write during provider switch or logout could leave
config.yamlpartially written or corrupted.This patch switches both paths to
atomic_yaml_write(...), aligning them withthe repo’s existing config persistence hardening.
Changes
atomic_yaml_writeinhermes_cli/auth.pyfor provider update writesatomic_yaml_writeinhermes_cli/auth.pyfor provider reset/logout writesWhy this matters
Provider selection and logout are user-facing config mutation paths. If either
write is interrupted, Hermes can end up with a broken
config.yaml, which is abad failure mode for a small persistence path that already has an atomic helper.
Testing
Ran: