Skip to content

fix(evolution): restore snapshots without deleting live trees first - #142

Draft
cursor[bot] wants to merge 3 commits into
mainfrom
cursor/critical-bug-investigation-c8d8
Draft

fix(evolution): restore snapshots without deleting live trees first#142
cursor[bot] wants to merge 3 commits into
mainfrom
cursor/critical-bug-investigation-c8d8

Conversation

@cursor

@cursor cursor Bot commented Aug 13, 2026

Copy link
Copy Markdown

Summary

  • Evolution rollback deleted live memory/evolution and _evolved skill trees before copying the snapshot back. A copy failure, crash, or kill after remove_dir_all destroyed current evolution memory and evolved skills even though the snapshot still existed. Auto-rollback (check_auto_rollback) uses this path, so recovery could wipe the data it is supposed to restore.
  • Restore now copies the snapshot tree into a sibling temp directory, then rename-swaps it into place. If the copy fails, the live destination is left intact. A failed final rename attempts to move the backup back.

Task Linkage

  • Task ID: TASK-2026-071
  • Task folder: tasks/TASK-2026-071-evolution-restore-atomic/

Injected Specs

  • spec/architecture-boundaries.md (if architecture/layering changed)
  • spec/security-nonnegotiables.md (if sandbox/security changed)
  • spec/testing-policy.md (required for any code change)
  • spec/docs-sync.md (if behavior/docs/env/commands changed)
  • Additional injected specs followed: spec/verification-integrity.md, spec/task-artifact-language.md, spec/rust-conventions.md.

Validation Evidence

  • Commands executed:
    • rustup update stable && rustup default stablerustc 1.97.1 / cargo 1.97.1
    • cargo fmt --check
    • cargo clippy --all-targets -- -D warnings
    • cargo test -p skilllite-evolution --lib -- extended_snapshot_restores_memory_and_skills restore_extended_snapshot_removes_live_files_absent_from_snapshot replace_dir_from_snapshot_leaves_destination_intact_when_copy_fails
    • cargo test
    • python3 scripts/validate_tasks.py
  • Key results:
    • rustfmt: exit 0
    • clippy: Finished dev profile with -D warnings, exit 0
    • targeted tests: 3 passed; 0 failed including copy-failure integrity and extra-file replacement
    • workspace cargo test: all crate results 0 failed
    • task validation: Task validation passed (71 task directories checked).

Regression Scope

  • Areas likely affected:
    • Auto-rollback (check_auto_rollbackrestore_extended_snapshot)
    • Manual/CLI restore of evolution memory and _evolved skills
  • Explicit non-goals:
    • Prompt-file in-place copy
    • Snapshot create/prune ordering
    • ChatSession workspace chat-root alignment
    • Concurrent sessions.json writes

Docs Sync (EN/ZH)

  • Not needed
  • Updated EN + ZH docs
  • Files:
    • none (internal restore correctness; no command/flag/env change)

Review Checklist

  • Acceptance criteria in tasks/TASK-2026-071-evolution-restore-atomic/TASK.md satisfied (or explicitly deferred)
  • tasks/TASK-2026-071-evolution-restore-atomic/STATUS.md updated with latest progress
  • tasks/TASK-2026-071-evolution-restore-atomic/REVIEW.md includes merge readiness decision
  • tasks/board.md status is up to date
Open in Web View Automation 

cursoragent and others added 3 commits August 13, 2026 11:08
Copy snapshot trees to a sibling temp directory and rename into place
so a failed or interrupted rollback cannot wipe live evolution memory
or _evolved skills.

Co-authored-by: EXboy <EXboys@users.noreply.github.com>
Co-authored-by: EXboy <EXboys@users.noreply.github.com>
Co-authored-by: EXboy <EXboys@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant