Repository navigation
fix(windows): close native transfer guards before rollback cleanup - #14
Closed
tudstudent wants to merge 2 commits into
Closed
tudstudent wants to merge 2 commits into
tudstudent wants to merge 2 commits into
Conversation
On Windows every write failed. os.fchmod() is Unix-only, so on Python
<= 3.12 it raised AttributeError just after mkstemp() left the
descriptor open; the cleanup unlink() then hit WinError 32 ("the file
is being used by another process") and that secondary error replaced
the real one, so users saw "cannot write target session ...: <winerror
32>" pointing at a target file that never existed. On Python 3.13,
where os.fchmod exists, writes instead died in _fsync_directory():
Windows cannot os.open() a directory.
- skip os.fchmod() where it is unavailable; Windows keeps the creating
user's ACLs
- skip the directory fsync on Windows; NTFS journaling keeps directory
entries durable without it
- make the temporary-file unlink in the error path best-effort so a
cleanup failure cannot mask the original error being reported
Add regression tests for both failure modes. Verified on Windows with
Python 3.11 and 3.13: a 371-record Codex-to-Claude transfer now
completes, and write, collision refusal, and rollback behave as on
POSIX.
Note: some existing tests remain POSIX-specific (permission-bit
assertions, pty imports, CRLF-sensitive fixture bytes) and cannot pass
on Windows regardless of this change; the Ubuntu CI matrix is
unaffected.
(cherry picked from commit 8ee41da)
|
🔴 Contributor eligibility requirements not met for @tudstudent.
See the contributor eligibility policy. Closing this PR because these requirements were not met. This policy is intended to reduce spam from AI agents; it is not an assessment of the quality of your change. |
This was referenced Oct 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Windows can reject deletion of an open manifest with WinError 32, masking the underlying native import/finalization failure and leaving artifacts behind. This closes owned descriptors before identity-checked cleanup, including failed exports and atomic-write setup, while retaining guarded successful writes.
Includes Enrico's existing PR #8 atomic-write fix with original author attribution and source commit
8ee41da7433374803373ba7f66d6740a89757b0f. The follow-up extends it to native manifest cleanup and the separate directory-fsync path. PR #8 is still open; that retained commit can be dropped if it lands first.Native Windows was not run for this exact branch; Linux denial mocks do not establish Windows ACL privacy or crash durability. The additional development-guide Docker resume recipe could not run because
basic-claude-uv:latestis absent; the pinned credential-free native gate did run. No real chats, credentials, production stores or supplier inference were used. Details:docs/windows-native-cleanup.md.This is one of three independent, main-based follow-ups split from closed #10 following the maintainer review. @xhluca, this isolates the relevant contract and its validation for review; the other two follow-ups cover separate contracts.
The eligibility bot closed #10 because the author had 64 qualifying contributions against the required 100 older than one calendar month. Splitting does not change that eligibility or claim an exemption; this submission may receive the same automation outcome.
Sibling follow-ups: OpenCode v2: #15; Codex child history: #16. Each targets
mainindependently.