Repository navigation
fix(undo): Undo all removes folders a chat made for a file it then deleted - #5443
Conversation
…leted A file a chat created and later deleted resolves to "unchanged" across the chat, so Undo all skipped it and left the empty folders made for it behind. Undo all now removes those folders too, and reports any it keeps because they hold other files.
|
Verdict: Request changes This fixes the main case: Undo all now removes empty folders left by a file the chat made and then deleted. But the cleanup handles folders one file at a time, so it can leave an empty folder behind and wrongly tell the user it was kept because it "holds other files".
Real-world evidenceN/A: this is a backend change to snapshot restore with no evidence bundle. The verdict rests on static review plus a local repro script that calls 🔍 Technical details🟡 Folder cleanup runs per span, after
Fix: give the extra dirs to In Strengths
|
A parent folder could be left behind empty and reported as holding other files: the extra pass for made-and-deleted files ran per file after the main pass, so a parent was tried before its made-and-deleted child folder was gone. Those folders now join the same depth-sorted pass.
|
Fixed: Undo all now clears every folder in one deepest-first pass, so a parent emptied by a made-and-deleted subfolder is removed and no longer reported as holding other files. Technical details
|
Undo all left empty folders behind when a chat created a file inside new folders and later deleted it. Across the whole chat that file counts as unchanged, so Undo all skipped it, along with the folders made for it. Undo all now removes those folders as well. It keeps any folder that holds other files and names it, the same way undoing one turn does.
This was the remaining low-severity finding from the bot review of #5283. Its other findings landed with #5326.
Test plan
pytest tests/unit/agents/test_session_snapshots.py tests/unit/agents/test_file_snapshots.py tests/unit/chat/ui/test_changes_router.py: 79 passed. Both new tests fail without the fix.python util/lint.py --black --isort --pylint --flake8is clean.