Fix `bm_fastapi` failing when an HTTP proxy is configured #505
All Vouch review confidence checks passed
Residual risk 0.24 = Change Risk (0.60) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.60 · 237 lines diff across 2 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
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
Diff Size
diff_size
0.327
Shallow Review Depth
shallow_review_depth
0.289
Sensitive Paths
sensitive_paths
0.060
Real PR Conversation Timeline
1 comments
"Review active on #505"
general
weight: 0.35
savannahostrowski
Fixes #504
Problem
The
fastapibenchmark (bm_fastapi) fails when the environment has an HTTPproxy configured — e.g.
HTTP_PROXY/http_proxyset, which is common in CI orcorporate environments — and
127.0.0.1is not listed inNO_PROXY.The benchmark starts a uvicorn server on
127.0.0.1and then talks to it withhttpx.AsyncClient(). Because httpx reads proxy configuration from theenvironment by default, the request to
http://127.0.0.1:<port>/items/0isrouted through the proxy. The proxy cannot reach the benchmark machine's
loopback address, so it returns
503 Service Unavailableand the benchmarkdies:
Fix
Create the client with
trust_env=Falseso it never reads proxy (or.netrc)settings from the environment:
This is correct for this benchmark because it only ever connects to its own
loopback server, so it must never be routed through a proxy. In environments
with no proxy configured,
trust_env=Falsebehaves identically to the default,so benchmark results are unaffected for the common case.
Only
bm_fastapiis affected: the other networking benchmarks(
bm_tornado_http,bm_asyncio_tcp,bm_asyncio_websockets,bm_async_tree)use clients that do not read proxy environment variables.
Testing
Reproduced by running the benchmark with proxy environment variables inherited
and
127.0.0.1absent fromNO_PROXY:Benchmark fastapi failed: Benchmark diedwith the 503 above.