← Back to Pull requests

Rewrite urllib3 retry warnings to be understandable #14242

Open
unknown opened this pull request with 228 lines diff across 2 files
View on GitHub
unknown unknown commented on Aug 12, 2026 01:23 UTC
Author

Towards https://github.com/pypa/pip/issues/10421. This is in draft until https://github.com/urllib3/urllib3/pull/5140 is included in a urllib3 release.

The approach taken here is to install a logging filter on the _vendor logging handler which "sniffs" for the appropriate warnings and rewrites them. This rewriting is best effort because urllib3 gives us scant context to work with. Under verbose mode, the original error is appended as a "here's all of the context, sorry that it's unreadable" aid.

This is supported by an upstream PR to urllib3 (https://github.com/urllib3/urllib3/pull/5140) adding a special extra attribute to the retrying warning, providing for a clear identifying marker and extra information needed by pip (i.e. the target host).

Overall, this is quite hacky, but having discussed with the urllib3 maintainers, this is the most mutually acceptable compromise for improving these user-hostile warnings for pip.

Example screenshots (and a question!)

<img width="2878" height="402" alt="image" src="https://github.com/user-attachments/assets/46935673-efd1-4b0e-b318-80e40fa9fbda" />

<img width="2844" height="408" alt="image" src="https://github.com/user-attachments/assets/95ecba91-9ecc-4544-ba75-f9490b008202" />

<img width="2880" height="440" alt="image" src="https://github.com/user-attachments/assets/896e9a16-182a-4197-8a0c-1164d0cbe133" />

... looking at these screenshots, I wonder if would be better to include the URL path that's being retried. While it's clear from context what URLs are being retried in these screeenshots, in other cases, the URL cannot be easily inferred. OTOH, some URLs are truly long (like PyPI's files.pythonhosted.org distribution URLs) and we probably don't want to print said URLs repeatedly. Let me know if you have any opinions.

Diff: 228 lines (+171 / -57) across 2 files Reviewer: ichard26 Review duration: 163910m
All Vouch review confidence checks passed
Residual risk 0.26 = Change Risk (0.44) × (1 − Review Confidence (0.41)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.44 · 228 lines diff across 2 files
0.44
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
0.02
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
40%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Shallow Review Depth shallow_review_depth
0.344
Diff Size diff_size
0.325
Real PR Conversation Timeline
1 comments
"Review active on #14242"
general weight: 0.35
Reviewers
Assignees
Unassigned
Labels
risk: low confidence: 40.9% reviewed
Vouch Risk Breakdown
AI-powered review risk analysis
Change Risk
Change Risk · Model 1 (XGBoost)
Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
Score: 44.0% (MEDIUM) · Higher = larger blast radius
44.0%
Review Confidence
Review Confidence · Models 2 & 3
Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
Score: 40.9% · Lower = rushed or shallow review
40.9%
Residual Risk
Residual Risk · Core Equation
Residual = Change × (1 − Confidence)
Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
Score: 26.0% · Safe to merge
26.0%
Repository