← Back to PRs

#13661: fix(auth): skip timeout cooldown for local/self-hosted providers

by omair445 open 2026-02-10 20:32 View on GitHub →
agents size: S
## Summary Local providers like Ollama should not enter cooldown on timeout — they have no rate limits, timeouts are just slow inference. Closes #13336 ## Changes - **`provider-utils.ts`**: Added `isLocalProviderUrl()` helper that detects localhost, 127.0.0.1, private IPs (192.168.x, 10.x, 172.16-31.x), and .local domains - **`run.ts`**: Skip `markAuthProfileFailure()` for timeout on local providers while still allowing profile rotation for retries ## Testing - 16 tests (3 existing + 13 new) covering all local/cloud URL patterns, edge cases, and boundary conditions - All pass 🤖 Generated with Claude (AI-assisted) <!-- greptile_comment --> <h2>Greptile Overview</h2> <h3>Greptile Summary</h3> Prevents local/self-hosted providers (like Ollama) from entering cooldown on timeout errors by detecting local URLs and skipping the `markAuthProfileFailure()` call. Timeouts on local providers indicate slow inference rather than rate limiting, so cooldown penalties are inappropriate. **Key changes:** - Added `isLocalProviderUrl()` helper in `provider-utils.ts` that detects localhost, loopback IPs, private network ranges (10.x, 192.168.x, 172.16-31.x), and `.local` domains - Modified timeout handling in `run.ts` to skip profile failure marking for local providers while still allowing profile rotation for retries - Comprehensive test coverage with 16 tests covering local/cloud patterns, edge cases, and boundary conditions **Minor suggestions:** - The `[::1]` check at line 53 is redundant (URL.hostname strips brackets) - Consider expanding `127.0.0.1` check to cover full `127.0.0.0/8` loopback range <h3>Confidence Score: 4/5</h3> - This PR is safe to merge with minimal risk - The implementation correctly solves the stated problem with a focused, well-tested solution. The logic properly skips cooldown for local timeouts while preserving profile rotation. Test coverage is excellent with 16 tests covering edge cases. Two minor style improvements suggested (redundant IPv6 bracket check and potentially incomplete loopback range detection) but neither affects correctness for typical use cases. - No files require special attention <!-- greptile_other_comments_section --> <!-- /greptile_comment -->

Most Similar PRs