apply_patch can be applied halfway on Windows, with no undo
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 30/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- rust, typescript
- Domain
- desktop
Research direction
Start in native/sandbox-helper/src/file_ops/windows.rs: the prepare step around lines 126-136 returns early on a missing folder without checking the new file name, and apply around lines 174-194 has no rollback. The loop in file_helper.rs (lines 88-90) and claim in apply_patch.ts (lines 209-213) are also involved. Reproduce the two patches in the issue on Windows to confirm the partial state. Done means both leave a.txt unchanged and create no files, and failures are rolled back using the before bytes.
Written by the indexing model from the issue text.
Description
Found in the 2026-10-09 codebase audit.
Problem
The helper's prepare (native/sandbox-helper/src/file_ops/windows.rs:126-136) returns early when a new file's folder is missing and never checks the name. apply (:174-194, loop in file_helper.rs:88-90) writes one operation at a time and stops at the first error with no rollback. claim (apply_patch.ts:209-213) dedupes new paths on the model's casing. run returns no undo when the helper throws.
Confirmed:
Update File: a.txt+Add File: newdir/what?.txtfails with os error 123, buta.txtis already changed andnewdir/exists.Update File: a.txt+Add File: b.txt+Add File: B.txtfails with os error 80 aftera.txtchanged andb.txtwas created.
Impact
The tool says "a failing patch changes nothing", but the project is half-patched and Undo isn't offered.
Fix
Validate new file names in prepare (Win32-invalid characters, reserved names) even when the folder is missing; key claim on a case-folded path on win32/darwin; roll back applied operations on failure using the before bytes.
Test
Both patches above leave a.txt unchanged and create nothing.
- Dominant language
- TypeScript
- Stars
- 2
- Forks
- 2
- Avg merge
- 5h 28m
- Merged PRs (30d)
- 24
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from PierrunoYT/patch
-
enhancement priority: low severity: low
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
PierrunoYT/patch#305 ·
Maintainers usually reply within 1 day
-
security: isAppPageUrl checks devRendererUrl with startsWith instead of comparing parsed URL originsOpenpriority: low security severity: low
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
PierrunoYT/patch#300 ·
Maintainers usually reply within 1 day
-
Claude Code chats: tool calls made inside Claude Code subagents leave cards that end as "(stopped)"Openbug priority: low severity: low
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
PierrunoYT/patch#289 ·
Maintainers usually reply within 1 day
-
bug priority: medium severity: low
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
PierrunoYT/patch#285 ·
Maintainers usually reply within 1 day
-
priority: medium security severity: low
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
PierrunoYT/patch#283 ·
Maintainers usually reply within 1 day
All issues in PierrunoYT/patch
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
stellar/stellar-dev-skill#151 ·
Maintainers usually reply within 1 day
-
area:arcade game ready-for-agent
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
fderuiter/deruiter.dev#2281 · 1 comment ·
Maintainers usually reply within 1 day
-
scope: data grid type: bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 2 days
-
fix(frontend): correct VITE_IS_DEVELPOMENT typo in shared/app.ts and align dev environment flagsOpen
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
vicharanashala/ajrasakha#1439 ·
Maintainers usually reply within 1 day
-
Add: TV5Monde AsieOpenapproved check:passed streams:add
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day