Summary
gl quickstart and gl init treat any load_keypair_from_dir failure as "no identity" and regenerate: crates/gl/src/quickstart.rs:62-65 ("Identity file exists but is unreadable. Regenerating...") and crates/gl/src/init.rs:69-74, with generate_identity unconditionally fs::write-ing the new PEM over the old file (init.rs:240, :245). gl identity new itself demands confirmation or --force before overwriting (crates/gl/src/identity.rs:114); these two paths bypass that guard.
Impact
A corrupted PEM (non-atomic write, disk fault) or a transient read failure (Windows file lock from AV/backup) silently replaces the agent's keypair with a fresh one. init then registers the NEW DID and creates a new public repo, silently orphaning the old identity: repos, escrow, and trust links become unreachable. Local data loss with real-world triggers.
Remediation
- On an unreadable existing identity, require explicit confirmation (or
--force) before regenerating, and write the old file to a backup path first.
- Make identity writes atomic (temp file + rename).
Proposed labels: kind:bug, crate:gl, subsystem:identity.
Summary
gl quickstartandgl inittreat anyload_keypair_from_dirfailure as "no identity" and regenerate:crates/gl/src/quickstart.rs:62-65("Identity file exists but is unreadable. Regenerating...") andcrates/gl/src/init.rs:69-74, withgenerate_identityunconditionallyfs::write-ing the new PEM over the old file (init.rs:240,:245).gl identity newitself demands confirmation or--forcebefore overwriting (crates/gl/src/identity.rs:114); these two paths bypass that guard.Impact
A corrupted PEM (non-atomic write, disk fault) or a transient read failure (Windows file lock from AV/backup) silently replaces the agent's keypair with a fresh one.
initthen registers the NEW DID and creates a new public repo, silently orphaning the old identity: repos, escrow, and trust links become unreachable. Local data loss with real-world triggers.Remediation
--force) before regenerating, and write the old file to a backup path first.Proposed labels: kind:bug, crate:gl, subsystem:identity.