fix(workloadclaims): keep the inventory request alive until its body is read #723
All Vouch review confidence checks passed
Residual risk 0.15 = Change Risk (0.37) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.37 · 230 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.326
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #723"
general
weight: 0.35
joaosa
Problem
CDS refuses secrets for pods on agent nodes with
403 Forbidden: not authorized for this secret. The CDS log gives the reason:DigestsClient.getcreates the request's timeout context anddefer cancel()s it, so the context ends whengetreturns.FetchSandboxandInventoryKeydecoderesp.Bodyafter that. If the body did not arrive in the same read as the headers, the read runs on a connection the cancelled context already closed.On the CDS node the body arrives with the headers, so it works. Across hosts it usually does not. We hit it on a 3-node baked cluster whose agent CVMs are 134 ms away from the server CVM: the gateway on the server node got its secrets, and both inference workers on the agent node were refused on every attempt until their sidecars gave up.
Change
getcancels only on its own error paths. On success it wrapsresp.BodysoClosecancels the context. Both callers alreadydefer resp.Body.Close(), so the timeout still bounds the whole exchange, including the body.TestFetchSandboxReadsABodyThatArrivesAfterTheHeaders: the inventory flushes the headers and sends the body 200 ms later. It fails on main with the error above and passes with this change.Testing
go vet ./pkg/workloadclaimsis clean. The new test and the other digests tests pass (TMPDIR=/tmp go test ./pkg/workloadclaims). The package's socket and peer-credential tests fail on macOS both before and after this change (path length and peer pid), so they need Linux CI.I will confirm on the cluster above with a local image build that includes this change.