← Back to Pull requests

node: keep trusted keys the control plane still lists (#916) #917

Open
unknown opened this pull request with 181 lines diff across 2 files
View on GitHub
unknown unknown commented on Nov 18, 2026 20:02 UTC
Author

A trusted key's age counted from when the node first received it, and a /keys sync kept that time. Pruning keeps only the newest key past the grace period, so a key the control plane still lists in its rotation grace period was dropped a day after the node first saw it, even when it signed the node's own identity. The next start then failed the role check ("biscuit: invalid signature") on a valid identity, and if the control plane could not be reached at that moment, both recoveries failed too.

  • mergeTrustedKeys: every key a /keys answer lists counts as vouched for at that sync, so pruning only drops keys the control plane stopped listing, or ones the node could not confirm for longer than the grace period.

  • pruneTrustedKeys: keeps every key with the latest time, since a /keys answer vouches for all its keys at once and its order says nothing about which is current, and never drops the key that signed the node's current identity.

  • NewAgentMeshNode: the configured key re-added next to persisted keys gets a fixed old time (the zero time is not stored and read back as now), so it cannot outrank the control plane's newer keys after a restart.

  • Start returns StaleIdentityError when the stored identity fails the role check and neither recovery renews it. It unwraps to the role, refresh and recovery errors, so callers can tell a refusal (RefreshError with its status) from a control plane that never answered.
  • Fixes: #916

    Diff: 181 lines (+135 / -46) across 2 files Reviewer: aojea Review duration: 5750m
    All Vouch review confidence checks passed
    Residual risk 0.19 = Change Risk (0.36) × (1 − Review Confidence (0.47)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.36 · 181 lines diff across 2 files
    0.36
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    46%
    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
    Shallow Review Depth shallow_review_depth
    0.344
    Diff Size diff_size
    0.311
    Real PR Conversation Timeline
    1 comments
    "Review active on #917"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 46.7% 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: 35.6% (MEDIUM) · Higher = larger blast radius
    35.6%
    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: 46.7% · Lower = rushed or shallow review
    46.7%
    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: 19.0% · Safe to merge
    19.0%