fix(lp2p): derive System.Conns from max_peers in custom limits mode #6074
All Vouch review confidence checks passed
Residual risk 0.15 = Change Risk (0.35) × (1 − Review Confidence (0.57)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.35 · 171 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.308
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #6074"
general
weight: 0.35
swift1337
Problem
In
ResourceManagerFromConfig, custom mode:The comment says
max peers, the code multiplies bymax_peer_streams.max_peersis not used at all for this limit, so the system connection cap scales with a setting that has nothing to do with connections. Concretely, withmax_peers = 10:max_peer_streams = 5→ 40 conns,max_peer_streams = 500→ 4000 conns.This was part of #5957, which went stale; in that thread @swift1337 suggested
max_peers × small constant (2–4)as the right shape, since peers normally share one multiplexed QUIC connection. Credit to @JayT106 for the original report.Change
limits.System.Conns = max_peers 4(constantsystemConnsPerPeer; 4 = one active connection plus headroom for a reconnect while the old one drains)TestResourceManager/customnow asserts the system conn limit equalsmax_peers 4and does not move whenmax_peer_streamsis multiplied by 10 (onmain: expected 40, actual 400)max_peersis already required to be > 0 in custom mode byLibP2PLimits.ValidateBasic, so the limit can't collapse to zero.Checklist