gabriel / muse public
fix patch auth dev
AI Agent gabriel · 146 days ago · Apr 26, 2026 · Diff

fix(auth): keygen --force preserves registered handle from existing entry

After auth logout + auth keygen --force, the handle field was always reset to an empty string, making subsequent MSign-signed requests fail with 401 because the Authorization header carried no handle.

Root cause: run_keygen wrote a provisional_entry with handle='' instead of reading the handle from the existing identity entry (_existing_entry).

Fix: derive _existing_handle from _existing_entry before building the provisional_entry, preserving the registered username through re-keying.

Also adds test_auth_logout_keygen_integrity.py covering: - I1: keygen --force preserves handle (was RED, now GREEN) - I2: logout → keygen → register restores handle via idempotent register - I3: resolve_signing_identity returns correct handle after full restore cycle

sha256:2a46c7afa043c66a870c3c54f93973dd1cec2c64e2aa6625755b07fde1b74566 sha
+27 ~1 symbols
sha256:e4a00773856a85c53e43604d9f90b438d5e06816ccb249c4108f732ec18df01e snapshot
+27
symbols added
~1
symbol modified
0
dead code introduced
Semantic Changes 28 symbols
+ TestFullRestoreRoundTrip class class TestFullRestoreRoundTrip L218–245
+ test_resolve_signing_identity_after_logout_keygen_register method method test_resolve_signing_identity_after_logout_keygen_register L221–245
+ TestKeygenForcePreservesHandle class class TestKeygenForcePreservesHandle L102–140
+ test_force_keygen_preserves_handle method method test_force_keygen_preserves_handle L105–124
+ test_force_keygen_still_updates_fingerprint method method test_force_keygen_still_updates_fingerprint L126–140
+ TestLogoutKeygenRegisterRestoresHandle class class TestLogoutKeygenRegisterRestoresHandle L147–211
+ _fake_challenge_resp method method _fake_challenge_resp L150–151
+ _fake_verify_resp method method _fake_verify_resp L153–158
+ test_register_after_logout_keygen_writes_handle method method test_register_after_logout_keygen_writes_handle L160–188
+ test_register_idempotent_when_key_already_on_server method method test_register_idempotent_when_key_already_on_server L190–211
+ _FIXED_MNEMONIC variable variable _FIXED_MNEMONIC L32–35
+ _HANDLE variable variable _HANDLE L38–38
+ _HOSTNAME variable variable _HOSTNAME L37–37
+ _HUB variable variable _HUB L36–36
+ _patch_home function function _patch_home L45–53
+ _patch_keychain function function _patch_keychain L56–61
+ _run_keygen function function _run_keygen L64–71
+ _run_logout function function _run_logout L74–76
+ _seed_identity_with_handle function function _seed_identity_with_handle L79–95
+ CliRunner import import CliRunner L26–26
+ annotations import import annotations L19–19
+ id_module import import id_module L28–28
+ kp_module import import kp_module L27–27
+ pathlib import import pathlib L21–21
+ pytest import import pytest L23–23
+ tomllib import import tomllib L24–24
+ runner variable variable runner L30–30
~ muse/cli/commands/auth.py .py 1 symbol modified
← Older Oldest on dev
All commits
Newer → Latest on dev

0 comments

No comments yet. Be the first to start the discussion.

To add a comment, use the Muse CLI: muse hub commit comment sha256:2a46c7afa043c66a870c3c54f93973dd1cec2c64e2aa6625755b07fde1b74566 --body "your comment"