Skip to content

Conversation

@devin-ai-integration
Copy link

@devin-ai-integration devin-ai-integration bot commented Sep 15, 2025

Fix Intermittent SSL Connection Issues with Intuit API

Summary

Implemented retry logic with exponential backoff to handle intermittent SSL connection errors when fetching the OpenID Connect discovery document from https://developer.intuit.com/.well-known/openid_configuration/. The solution adds retry capability specifically for SSLError and ConnectionError exceptions while preserving backward compatibility and existing behavior for all other error types.

Key Changes:

  • Core Logic: Modified get_discovery_doc() in intuitlib/utils.py to retry SSL and connection errors up to 3 times with exponential backoff (1s, 2s delays)
  • Error Scope: Only requests.exceptions.SSLError and requests.exceptions.ConnectionError trigger retries - all other exceptions (HTTP errors, timeouts, etc.) maintain existing behavior
  • Test Coverage: Added comprehensive test suite with 25+ edge case tests covering error boundaries, retry exhaustion, mixed scenarios, and timing verification

Review & Testing Checklist for Human

  • Verify retry exception scope - Confirm that only SSL and connection errors should trigger retries (not timeouts, HTTP errors, or other network issues)
  • Test actual SSL failures - Verify the retry logic works correctly with real intermittent SSL connection issues in your environment
  • Validate retry timing - Ensure 1s and 2s retry delays are appropriate for your production systems and won't cause unacceptable latency
  • Check session compatibility - Test that existing code using custom requests.Session objects still works correctly after the changes

Notes

- Add retry logic with exponential backoff to get_discovery_doc() function
- Handle SSLError, SSLEOFError, and ConnectionError exceptions
- Implement 3 retries with backoff factor of 1 (1s, 2s delays)
- Maintain backward compatibility with existing functionality
- Add comprehensive test script to verify retry behavior
- Preserve existing HTTP error handling (no retries for HTTP errors)

Fixes intermittent SSL errors when fetching OpenID Connect discovery
document from https://developer.intuit.com/.well-known/openid_configuration/

Co-Authored-By: abhay.aggarwal@codeium.com <abhay.aggarwal@windsurf.com>
@devin-ai-integration
Copy link
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@abhay-codeium
Copy link
Owner

Add more robust testing

- Added 7 new test methods to tests/test_utils.py covering all retry scenarios
- Test SSL error retry with exponential backoff timing verification
- Test connection error retry and retry exhaustion scenarios
- Test session-based retry logic and mixed error types
- Verify HTTP errors don't trigger retries (preserve existing behavior)
- Test normal operation timing to ensure no artificial delays
- Removed standalone test_ssl_retry.py script (functionality integrated)

Addresses GitHub PR feedback requesting 'more robust testing'

Co-Authored-By: abhay.aggarwal@codeium.com <abhay.aggarwal@windsurf.com>
@abhay-codeium
Copy link
Owner

The test coverage is not enough, please add more edge cases

- Fixed timeout error test to match actual implementation behavior
- Added 25+ new edge case tests covering error types, boundary conditions
- Test non-retryable exceptions, mixed error scenarios, environment variations
- Test response handling edge cases and exact timing verification
- Addresses GitHub PR feedback requesting more robust testing

Co-Authored-By: abhay.aggarwal@codeium.com <abhay.aggarwal@windsurf.com>
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