Skip to content

fix: auto-restore pairing data from pre-update snapshot after hermes update#27702

Open
sgfdhgfnjgmhgmnfd657-sys wants to merge 1 commit into
NousResearch:mainfrom
sgfdhgfnjgmhgmnfd657-sys:fix/auto-restore-pairing-after-update
Open

fix: auto-restore pairing data from pre-update snapshot after hermes update#27702
sgfdhgfnjgmhgmnfd657-sys wants to merge 1 commit into
NousResearch:mainfrom
sgfdhgfnjgmhgmnfd657-sys:fix/auto-restore-pairing-after-update

Conversation

@sgfdhgfnjgmhgmnfd657-sys

Copy link
Copy Markdown

Problem

After hermes update, the gateway restart clears platform pairing authorization (Issue #15733). All paired messaging users become "Unauthorized" until the operator manually runs /snapshot restore.

The pre-update quick snapshot already backs up the pairing JSONs (pairing/, platforms/pairing/, feishu_comment_pairing.json), but the update flow (_cmd_update_impl) never restores them before the gateway restarts.

Fix

Insert an auto-restore step after ✓ Update complete! (post git pull + pip install) and before the gateway restart / curator notices. It:

  1. Finds the most recent pre-update quick snapshot
  2. Copies pairing JSON files back to their live ~/.hermes/ locations
  3. Reports how many files were restored

The restore is defense-in-depth: even if the JSONs survive the git pull + venv rebuild, this ensures they are always in the expected state when the newly started gateway validates authorization.

Testing

  • Verified: pairing data is present in pre-update snapshots
  • Verified: _QUICK_STATE_FILES includes "pairing", "platforms/pairing" and "feishu_comment_pairing.json"
  • Syntax-checked with ast.parse
  • Applied and tested on a local instance (user confirmed fix resolved the issue)

Closes #15733

After `hermes update`, the gateway restart clears all platform pairing
authorization (Issue NousResearch#15733). The pre-update quick snapshot backs up the
pairing JSON files, but the update flow never restores them before the
gateway restarts.

This commit adds an auto-restore step after git pull + pip install complete,
restoring `pairing/`, `platforms/pairing/` and `feishu_comment_pairing.json`
from the pre-update snapshot before the gateway is restarted.

The restore is defense-in-depth: even if the pairing JSONs survive the
virtualenv rebuild or code change, this ensures they are always in the
expected location that the newly started gateway code reads.

Fixes: NousResearch#15733
@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/cli CLI entry point, hermes_cli/, setup wizard labels May 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/cli CLI entry point, hermes_cli/, setup wizard P2 Medium — degraded but workaround exists type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

hermes update does not migrate state.db pairing data

2 participants