fix: apply 429 backoff to organization connection writes to prevent rate-limit failures - #1464
Draft
harshithRai wants to merge 3 commits into
Draft
fix: apply 429 backoff to organization connection writes to prevent rate-limit failures#1464harshithRai wants to merge 3 commits into
harshithRai wants to merge 3 commits into
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1464 +/- ##
==========================================
+ Coverage 80.49% 80.63% +0.13%
==========================================
Files 163 163
Lines 7741 7750 +9
Branches 1719 1719
==========================================
+ Hits 6231 6249 +18
+ Misses 810 801 -9
Partials 700 700 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
🔧 Changes
Organization connection writes were bypassing the CLI's rate-limit protections. The base handler routes all create/update/delete calls through the request pool wrapped in 429 exponential-backoff retry, but
OrganizationsHandlermanages nested connection writes itself via rawPromise.all, so those calls had no CLI-level backoff. On tenants with many organizations × connections this produces an unthrottled burst that trips Auth0'sorganization_connections_writegroup rate limit and fails the import.This change wraps the organization connection writes in the same exponential-backoff retry used by the base handler:
src/tools/auth0/handlers/default.tsretryWithExponentialBackoffand theRetryOptionsinterface for reuse by other handlers.getRetryConfig()method on the base handler (respectsAUTH0_MAX_RETRIES/AUTH0_RETRY_INITIAL_DELAY_MS/AUTH0_RETRY_MAX_DELAY_MSand the existing warn logging).processChangesnow calls it — no behavior change there.src/tools/auth0/handlers/organizations.tsretryWithExponentialBackoff(..., this.getRetryConfig()), keeping the existingPromise.allstructure.These calls now get proper 429 backoff with
Retry-Aftersupport.Promise.allis retained deliberately — no calls were added to the shared request pool, avoiding the pool-exhaustion deadlock that a nested-pool approach would introduce.This is a near-term mitigation (recover from the limit via backoff), not full burst throttling. A follow-up to add a dedicated throttling pool for connection writes is tracked separately.
📚 References
🔬 Testing
Unit Tests
test/tools/auth0/handlers/organizations.tests.js,test/tools/auth0/handlers/default.tests.ts).Manual testing (real tenant)
Deployed against a dev tenant to exercise all three connection write paths through the new backoff wrapper, then re-exported to confirm the writes landed:
Note: the dev tenant is too small to actually trip the
organization_connections_writegroup limit, so the 429-retry behavior itself is covered by the unit test above rather than the manual run.📝 Checklist