← Back to Pull requests

challenger: don't stop aperture when settlement tracking fails #350

Closed
unknown closed this pull request without merging on Dec 01, 2026 12:59 UTC
View on GitHub
unknown unknown commented on Nov 30, 2026 08:43 UTC
Author

With the admin API on and strict verification off, the challenger tracks lnd's invoices only to record settlements for the admin statistics. Still, aperture did not start without lnd, and a dropped invoice subscription shut it down. So an lnd restart took the proxy down.

Change


In that mode, settlement tracking runs in the background. On an error it logs and tries again after 1s, doubling up to 15s. It never stops aperture.

  • On start it lists all invoices once, records the settled ones, and subscribes from the highest settle index found, so lnd replays what settles after that.

  • After a failure it subscribes again from the settle index up to which it has seen every settlement. lnd's SQL store replays out of settle order, so that index only moves over runs without a gap.
  • Strict verification is unchanged.

    Things to know


  • A wrong lnd host or macaroon no longer fails the start in this mode. It shows as warnings, then errors.

  • While tracking fails, paid tokens stay pending in the admin API.

  • A settlement can be reported more than once. The callback only updates pending rows.

  • If lnd never reports a settle index, every reconnect replays the settlements after it again.

  • On a node where no invoice was ever settled, the first settlement can be missed in a short race, until aperture restarts.
  • Tested


  • Unit tests against a fake lnd that follows lnd's replay rules (bbolt and SQL order, AMP), run many times under -race.

  • Real lnd v0.21.8 on regtest, with the bbolt and the native SQL invoice store: lnd down at start, lnd restarts, payments during the retry wait, and aperture restarts with payments on older list pages. Every paid challenge ended settled.

  • Random hard kills on regtest, 10 minutes per store: lnd was killed 24 times and aperture 13 times while challenges were paid. All 1,403 invoices lnd settled ended settled in aperture, none was settled wrongly, and aperture never stopped on its own.

  • Strict verification behaves as on master: no start without lnd, and a stop when lnd stops.
  • Diff: 254 lines (+190 / -64) across 3 files Reviewer: hieblmi Review duration: 1696m
    All Vouch review confidence checks passed
    Residual risk 0.15 = Change Risk (0.39) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.39 · 254 lines diff across 3 files
    0.39
    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.332
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #350"
    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: 39.1% (MEDIUM) · Higher = larger blast radius
    39.1%
    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: 15.4% · Safe to merge
    15.4%