Repository navigation
Retry Drive's 409 Conflict when tests clean up - #461
Draft
shcheklein wants to merge 2 commits into
Draft
shcheklein wants to merge 2 commits into
shcheklein wants to merge 2 commits into
Conversation
Drive sometimes answers 409 Conflict to a delete right after the file changed, which failed the cleanup of three live tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
shcheklein
commented
Dec 3, 2026
shcheklein
commented
Dec 3, 2026
shcheklein
left a comment
Member
Author
There was a problem hiding this comment.
[AI generated — Copilot]
5-pass review summary: sensible fix for Drive's transient 409 Conflict during test teardown. Worth narrowing the 409 check to reason == "conflict" to avoid multi-minute CI stalls on permanent 409 errors.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are recorded for the targeted test-helper retry and diagnostic changes.
No open issues 🎉
What changed in this PR
Reduces intermittent live-test cleanup failures by extending the test retry helper. Production filesystem behavior is unchanged.
Changes:
- Retries HTTP 409 only when Drive reports the reason as
conflict. - Includes the original API error in retry failures and preserves exception chaining.
| File | Description |
|---|---|
pydrive2/test/test_util.py |
Adds targeted conflict retries and clearer failure diagnostics. |
Review effort: Balanced
This branch has not been deployed
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.
Live CI failed three times today at the end of a test, after the test itself passed:
The cleanup from #447 deletes each test's files. Drive sometimes answers that delete with
409 Conflictwhen the file has just changed: the three cases followed a content update (test_Files_Update_File,test_Files_Update_File_Keeps_Filename) and a conversion to a Google Doc (test_GFile_Conversion_Remove_BOM). They failed on #453 and #460, which do not touch these tests.The tests' retry helper,
pydrive_retry, now retries a 409 whose reason isconflict, as it retries rate limits and server errors. Other 409s, such asfileIdInUse, still fail at once. When the retries run out, the error now carries Drive's answer.Test-only change. The filesystem does not retry a 409 Conflict on delete either. That is a separate question, because nothing so far shows a user hitting it.
🤖 Generated with Claude Code