← Back to Pull requests

Recover an interrupted Turn when the original worker lease has been replaced #9304

Closed
unknown closed this pull request without merging on Nov 23, 2026 14:23 UTC
View on GitHub
unknown unknown commented on Nov 23, 2026 06:33 UTC
Author

Recovery behavior

Retrying a failed writeback with the original Turn ID could return the same receipt identity conflict on every attempt, even though the registered worker could already preview an administrative closeout. The prior-Turn recovery scan excluded the Turn being retried.

The guard now asks the existing settlement owner to inspect the original Turn when its prepared lease may have changed. Earlier debts keep their ordering. The owner checks the original receipt, current canonical lease and absence of settlement effects before offering the existing no-debit preview. The preview and commit retain their existing ownership checks.

Verification

  • The regression failed on both File and SQLite on the base revision. Both providers returned the original lease generation conflict.

  • The new CLI regression covers explicit and inferred Todo binding, previews the closeout, commits it and replays it. It checks the original receipt bytes and verifies that the Todo stays open without a quota debit.

  • At f15d38f8896c, 63 focused tests and all 17 standard premerge checks passed. The first patch exceeded the decision-function complexity limit. This revision isolates the receipt comparison and passes the original limit.

  • Built and installed the Core wheel into an isolated environment. The public console and packaged dispatcher passed on both File and SQLite (four cases), including preview, commit, replay and byte-for-byte admission readback.

  • The existing clock fence also rejected an ambiguous SQLite replacement acquired in the same recorded second as the admission. The lease timestamp had whole-second precision and the receipt had fractional precision. Using a later verifiable lease in the isolated fixture closed the original Turn with no debit; replay preserved the original receipt. Automatic handling of that clock ambiguity remains open.
  • Diff: 234 lines (+175 / -59) across 2 files Reviewer: BigDataDZ Review duration: 469m
    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 · 234 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.327
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #9304"
    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.1% (MEDIUM) · Higher = larger blast radius
    37.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: 14.7% · Safe to merge
    14.7%