fix(ops): claiming and starting sweep expired leases #296
All Vouch review confidence checks passed
Residual risk 0.18 = Change Risk (0.45) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.45 · 291 lines diff across 3 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.340
Shallow Review Depth
shallow_review_depth
0.289
Ai Authored
ai_authored
0.050
Real PR Conversation Timeline
1 comments
"Review active on #296"
general
weight: 0.35
gurnben
Plan: live finding from
5-sci-onboarding/03(gate G3 — SCI's runner pool, consuming traust-sdk#44)What
OpsService.requeue_expiredexisted but nothing called it in a deployed server: no REST door, no background loop — only tests swept. Found live: SCI's runner pool was killed mid-run on the dev cluster, the order's lease expired 4 minutes prior, and every subsequent claim returned an empty queue because claim only takesstate == QUEUED.Claim now re-queues expired leases in the same transaction as the claim itself — every pool's poll is the reaper. No timer infrastructure, no new endpoint, and a dead runner's order returns to the queue on the next claim from anyone.
Test: a dead runner's expired lease is re-queued and claimed by the next runner (
test_claim_sweeps_a_dead_runners_expired_lease, with the live-finding context in a comment). Full suite: 7897 passed, 0 new failures (the pre-existing tree-sitter route and cosign-ledger failures on this laptop are unchanged).Jira: XWING-2438 (SCI consumer)
---
Update: starting sweeps too (48ade88)
Shaun and Gurney's call after the live finding: requeue on start. The recording lane's start door had the same gap from the other side — a dead scan goroutine strands its order for the whole lease (start keeps the subject's open order and 409s while it is leased; nothing ever claims a recording order, so the claim sweep never sees it).
start()now requeues expired leases in the same transaction, symmetric withclaim(): every door sweeps, and either a claim or a start recovers a dead runner's order.New test:
test_start_takes_over_a_dead_runners_expired_lease.Changed tests (sign-off wanted):
test_start_never_steals_an_active_lease_or_bypasses_approval[leased]seeded its "active" lease from the fixedT0(2026-10-05) while the context's clock is live — the lease was expired all along and the test passed vacuously (start never looked at expiry). It now seeds a genuinely-active expiry computed from now. The strict model-equality needed the microsecond field rounded (the column truncates to milliseconds). No assertion weakened: a genuinely-active lease still 409s and stays untouched.Full suite: 7898 passed (one more than before — the new test); the pre-existing tree-sitter/cosign/tonic failures unchanged.