fix(transport): move duplicate policy check after backoff sleep#846
Closed
mothership-ai[bot] wants to merge 1 commit intomainfrom
Closed
fix(transport): move duplicate policy check after backoff sleep#846mothership-ai[bot] wants to merge 1 commit intomainfrom
mothership-ai[bot] wants to merge 1 commit intomainfrom
Conversation
The duplicate check was running immediately after a timeout, before the backoff sleep. This meant the index often hadn't propagated the newly-created entity yet, causing the check to miss it and the retry to create a duplicate anyway. Also changes error handling in find_existing_policy to return None on failure instead of raising, so a search error doesn't break the retry loop. Fixes GOV-667. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.
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.
Session owner: @ankitpatnaik
Summary
AuthPolicycheck to run afterretry.sleep()instead of before it, giving the index time to propagate the entity that was likely created by the timed-out request. This is the root cause of why duplicates still occur after the PR fix(transport): prevent duplicate AuthPolicy creation on retry after timeout #826 fix — the check fires immediately but the index hasn't caught up yet.find_existing_policy/find_existing_policy_asyncto returnNoneon search failure instead of raising, so a transient search error doesn't break the retry loop.Before (broken):
After (fixed):
Fixes GOV-667 / ZD #119850.
Test plan
tests/unit/test_transport.pypass🤖 Generated with Claude Code