Inspired by Copilot CLI: /rollback keeps user hand-edits by default
Copilot CLI 1.0.78 reworked /rewind to restore only the files the agent changed, 'skipping any file whose contents no longer match what Copilot last wrote'. This ports that protection to Hermes checkpoints: - tools/checkpoint_manager.py: per-project agent-write ledger (sha256 of every landed write_file/patch), safe_restore_plan() classifier, and restore(safe=True) that reverts only agent-authored changes, deletes agent-created files, and preserves user hand-edits. Empty ledger (pre-existing stores) falls back to the classic full restore. - run_agent.py: feed the ledger from _record_file_mutation_result on every landed mutation (zero new hooks; rides the existing verifier). - CLI + gateway /rollback: safe mode is the default; --all/--force restores everything; skipped files are reported with a hint. - 17 locales: new gateway.rollback.kept_user_edits key. - Docs: checkpoints-and-rollback.md updated. - Tests: 7 new cases incl. user-edit preservation, post-agent user tweaks, agent-created file removal, empty-ledger fallback.
This commit is contained in:
@@ -279,6 +279,7 @@ Future messages in this room will use that transcript until `/reset` or another
|
||||
none_found: "找不到 {cwd} 的檢查點"
|
||||
invalid_number: "無效的檢查點編號。請使用 1-{max}。"
|
||||
restored: "✅ 已還原至檢查點 {hash}:{reason}\n已自動儲存回復前的快照。"
|
||||
kept_user_edits: "↷ 已保留您的手動編輯:{files}\n若也要還原這些檔案,請使用 /rollback <N> --all。"
|
||||
restore_failed: "❌ {error}"
|
||||
|
||||
diff:
|
||||
|
||||
Reference in New Issue
Block a user