← Back to Pull requests

node: do not retry a provider that does not attest the required labels #954

Closed
unknown closed this pull request without merging on Nov 26, 2026 22:41 UTC
View on GitHub
unknown unknown commented on Nov 26, 2026 20:02 UTC
Author

Same reasoning as #722, for the label check: when a provider's credential does not attest a label the caller requires, or one of the egress floor, CallMCPTool no longer retries the call.

connectMCPSessionWithRetry stops on ErrAuthRejected and ErrProviderNotGranted, but a failed label check in checkProvider carried neither, so it was retried as if the peer could not be reached. The provider presents the same credential on every attempt, so the call ran three handshakes, waited 1s and 2s, and returned failed after 3 retries: provider ... does not attest every label of ....

This adds ErrLabelsNotSatisfied, which checkProvider wraps around a failed label check, and the retry loop stops on it. An authorizer that stopped at a run limit is not wrapped, so a timeout is still retried and the facts and iterations limits keep their own handling from #842.

Measured in Docker (golang:1.26):

| Test, refused call | Before | After |
|---|---|---|
| TestCallMCPTool_LabelEnforcement (caller requires region=na-us) | 3.40s, failed after 3 retries | 0.38s, one refusal |
| TestCallMCPTool_EgressFloorEnforcement (floor jurisdiction=eu) | 3.42s, failed after 3 retries | 0.36s, one refusal |

Both tests now check errors.Is(err, ErrLabelsNotSatisfied) and that the call was not retried. They fail without the change, and still fail with only the mcp.go line reverted.

Not changed: the HTTP label gate (VerifyProvider) still answers 403, and its messages are unchanged.

Tested in Docker (golang:1.26): go test ./internal/node/..., go test -race -count=5 on the TestCallMCPTool_, TestCheckPeerLabels, TestLabelGate and TestVerifyPeerLabels tests, go vet, and golangci-lint v2.14.0.

Diff: 217 lines (+162 / -55) across 2 files Reviewer: aojea Review duration: 159m
All Vouch review confidence checks passed
Residual risk 0.16 = Change Risk (0.42) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.42 · 217 lines diff across 2 files
0.42
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
0.17
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
60%
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
Diff Size diff_size
0.322
Shallow Review Depth shallow_review_depth
0.289
Ai Authored ai_authored
0.050
Real PR Conversation Timeline
1 comments
"Review active on #954"
general weight: 0.35
Reviewers
Assignees
Unassigned
Labels
risk: low confidence: 60.5% 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: 41.7% (MEDIUM) · Higher = larger blast radius
41.7%
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: 60.5% · Lower = rushed or shallow review
60.5%
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: 16.5% · Safe to merge
16.5%