Skip to content

Fix concurrent cache initialization on Windows - #611

Open
codewithfourtix wants to merge 1 commit into
openai:mainfrom
codewithfourtix:fix-windows-concurrent-cache-writers
Open

codewithfourtix wants to merge 1 commit into
openai:mainfrom
codewithfourtix:fix-windows-concurrent-cache-writers

Conversation

@codewithfourtix

Copy link
Copy Markdown

Concurrent cold-cache readers can raise FileExistsError on Windows when TIKTOKEN_CACHE_DIR is set. Use os.replace to atomically publish the downloaded file even when another reader has just populated the cache.

Adds a deterministic two-writer regression. On Windows, isolated checks against load.py fail before the fix and pass afterward, including a subsequent hash-verified cache read. Full project suite not run.

Related: #607 cleans up failed writes; this change prevents successful concurrent downloads from failing at publication.

Copilot AI balanced review requested due to automatic review settings October 2, 2026 04:23

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants