fix(checkout): Phase 6 — CHECKOUT_HEAD survives through write_head_branch
A process killed between _checkout_snapshot (which cleared CHECKOUT_HEAD on success) and write_head_branch left the working tree at the target branch but HEAD at the old branch, with no CHECKOUT_HEAD marker for muse status to detect the interrupted state.
Fix: add clear_marker=False parameter to _checkout_snapshot. Callers that follow with write_head_branch / write_head_commit now keep the marker alive through that write, then unlink it immediately after.
CHECKOUT_HEAD lifecycle after fix: 1. write CHECKOUT_HEAD (before first file mutation) 2. mutate working tree 3. write HEAD (write_head_branch / write_head_commit) 4. unlink CHECKOUT_HEAD
Kills at any point between 1 and 4 leave the marker — status always detects.
6-test suite in test_phase6_checkout_interruption.py: marker absent after clean checkout, marker present during write_head_branch, status detects planted marker, status shows target, clean after removal, re-checkout (with --force) clears the marker.
0 comments
muse hub commit comment sha256:1568be18f671411b1d0a12b92634d9901467ad4cafac27bb5fcfa4b6e73ebbb9 --body "your comment"
No comments yet. Be the first to start the discussion.