Files
hermes-agent/tests/tools
Diamond Hands Dig ce7afd48d4 fix(checkpoints): safe restore must find the ledger under the walked project key
record_agent_write keys the agent-write ledger by the marker-walk result of
get_working_dir_for_path(), while safe restore reads the ledger by the exact
hash of the directory named in the restore.  The two keys diverge whenever
the walk lands somewhere other than that directory:

- a markerless project dir under an ancestor that carries a generic project
  marker (e.g. /tmp with a stray package.json) -> the ledger is filed under
  the ancestor's hash and restore reads an empty ledger;
- restoring a repo subdir while the write was recorded at the repo root.

An empty ledger makes restore() silently degrade to a full restore, which
overwrites files the user hand-edited after Hermes' last write — the exact
outcome safe restore exists to prevent.

safe_restore_plan now falls back to the walked key when the exact-key ledger
is empty, so the recorded protection is honored regardless of where the walk
landed.  Verified: 9 previously failing TestSafeRestore tests now pass, plus
a new regression test that seeds an ancestor marker and asserts the user
hand-edit survives the restore.
2026-09-16 21:15:09 +05:30
..