gabriel / muse public
fix patch task/fix-autoshelf-phantom-modifications #1 / 1
AI Agent gabriel · 35 days ago · May 7, 2026 · Diff

fix: autoshelf must not restore committed source-branch files on target

When `muse checkout <target> --autoshelf` was run from a task branch that had committed-but-not-yet-merged changes, those committed files bled into the target working tree as phantom modifications — causing `muse merge` to refuse with 'your local changes would be overwritten'.

Root cause: `_apply_shelf_snapshot` iterated the full working-tree snapshot without distinguishing files that were actually dirty (uncommitted edits) from files that happened to differ from the target branch because they were committed on the source branch.

Fix: load the source branch HEAD manifest from `entry['parent_commit']` and skip any file whose shelf hash matches the source HEAD hash — those were clean when shelved and belong to the merge, not the shelf.

Regression tests added to TestAutoshelfDirtyIsolation: - test_committed_source_file_not_in_working_tree_after_autoshelf - test_dirty_file_is_restored_after_autoshelf - test_working_tree_clean_except_dirty_file_after_autoshelf

sha256:441516031c662910037b4a251788f71cf0b20529f43307b4a672243de50f5eb5 sha
sha256:8cdb03b8650affbcc0e4e2fb6a62cf30262daf67b5163abc8c0b6fbf789a49cc snapshot
← Older Oldest on task/fix-autoshelf-phantom-modifications
All commits
Newer → Latest on task/fix-autoshelf-phantom-modifications

0 comments

No comments yet. Be the first to start the discussion.

To add a comment, use the Muse CLI: muse hub commit comment sha256:441516031c662910037b4a251788f71cf0b20529f43307b4a672243de50f5eb5 --body "your comment"