Repository navigation
fix: Send Idempotency-Key on the first POST attempt - #567
Open
thompsongl wants to merge 1 commit into
Open
thompsongl wants to merge 1 commit into
thompsongl wants to merge 1 commit into
Conversation
The key was generated only when scheduling a retry, so attempt 1 went out keyless. If that attempt created a resource but its response was lost, the retry carried a fresh key and could create a duplicate, including on Pipes explicit adds, where the API deduplicates by key. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
[Medium impact] The PR appears safe to merge. SummaryPOST requests now receive an
|
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.
Description
Every
POSTnow carries anIdempotency-Keyfrom the first attempt. Before, the SDK only generated one when scheduling a retry, so attempt 1 went out keyless. If that first attempt created something but its response was lost (a timeout, a reset connection), the retry carried a brand-new key and the API had no way to recognize it as the same request.That matters now that the API deduplicates by key on Pipes explicit adds (
create_data_integration_api_key,create_data_integration_client_credential, and thecreate_*_connected_accountimports withconnection_intent: "add"), not justaudit_logs.create_event. With a keyless first attempt, a retried add could create a second connected account holding live credentials. Go, Python, and .NET already key the firstPOST.request_options[:idempotency_key]still wins.PUTandPATCHare unchanged: keyed when you supply one, or on retry.Proof: the updated
test_post_sends_one_idempotency_key_on_the_first_attempt_and_its_retriesfails onmain(only the retry carries a key) and passes here (both attempts carry the same key).Documentation
Does this require changes to the WorkOS Docs? E.g. the API Reference or code snippets need updates.
The README's idempotency section is updated in this PR, including Pipes explicit adds among the endpoints that honor the key. No WorkOS Docs change needed.
🤖 Generated with Claude Code