← Back to Pull requests

fix(workloadclaims): keep the inventory request alive until its body is read #723

Closed
unknown closed this pull request without merging on Sep 30, 2026 16:38 UTC
View on GitHub
unknown unknown commented on Sep 29, 2026 06:07 UTC
Author

Problem

CDS refuses secrets for pods on agent nodes with 403 Forbidden: not authorized for this secret. The CDS log gives the reason:

secret request denied path=/confidential-inference/volumes/dsv4 reason="resolve sandbox containers: workloadclaims: decode inventory response: read tcp 10.52.0.192:48374->172.20.2.230:1019: use of closed network connection"

DigestsClient.get creates the request's timeout context and defer cancel()s it, so the context ends when get returns. FetchSandbox and InventoryKey decode resp.Body after 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

  • get cancels only on its own error paths. On success it wraps resp.Body so Close cancels the context. Both callers already defer 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/workloadclaims is 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.

    Diff: 230 lines (+172 / -58) across 2 files Reviewer: joaosa Review duration: 2071m
    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
    0.37
    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.326
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #723"
    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: 37% (MEDIUM) · Higher = larger blast radius
    37%
    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: 14.6% · Safe to merge
    14.6%