← Back to Pull requests

Refresh quota facts after repairing a prior receipt #9684

Open
unknown opened this pull request with 423 lines diff across 5 files
View on GitHub
unknown unknown commented on Nov 30, 2026 22:44 UTC
Author

Goal and delivered outcome

A malformed prior-Turn receipt can be repaired successfully while the next quota should-run still reports a stale canonical source. The receipt repair updates the rollout log, which invalidates the status witness the guard read before the repair.

After a committed repair, the guard reloads the canonical status and retries once with the original Turn binding. It uses the same refresh path as an ordinary stale canonical read.

Author declaration

  • Written by OpenAI Codex, a GPT-6 model agent.

  • Target branch main at 1af849a8a45aebe62fa447ae6f73accf21a4ed6c.

  • Implemented against receipt-backed settlement progress at the target revision.
  • | Criterion | Disposition | Implementation and verification |
    | --- | --- | --- |
    | Reevaluate a stale admission basis for the original Turn | Implemented | execute_quota_should_run refreshes the status witness after either a stale read or a successful repair and keeps the original decision arguments. |
    | Preserve the original settlement identity through recovery and replay | Implemented | Tests run both prior-receipt shapes with File and SQLite, including replay and quota debit readback. |

    Scope and continuation

    The change is limited to quota admission recovery after a prior receipt repair. The test overlap with #9608 is in the same test module. Native host folding and context-delivery qualification continue separately.

    Validation

  • Tested revision dfb6344e776b9c1ce0079a2aca4ef023ee785e24.

  • Run state finished. Input class synthetic.
  • | Check kind | Result | Evidence |
    | --- | --- | --- |
    | Static | Passed | Ruff for both changed files and the local standard premerge check, including its six direct and 18 selected checks. The gate reported an inherited maintainability advisory in loopx/status.py and loopx/canary/module_metric_baseline.json. |
    | Integration | Passed | 55 targeted tests for the quota guard and prior-receipt recovery on the tested revision. |
    | Real entrypoint and backend | Passed | An isolated wheel ran quota should-run for orphaned and rotated prior receipts against both File and SQLite. All four entered prior-Turn recovery, preserved the original settlement and replay identity, and recorded zero quota debits during admission and replay. Independent review then verified that the recovered Turn settles once and the following guard can admit new work. |
    | Regression parity | Passed | A wheel without the repair failed all four prior-receipt scenarios with a stale canonical source after repair. The fixed wheel completed all four. |

    The backend matrix covers the two changed recovery paths in local providers. Running a native host or deploying the wheel was outside this validation.

    Frontend and visual evidence

    UI impact none. The change is in the CLI admission path.

    Classification

    Bug fix and regression coverage in the control plane. No shared-authority migration or promotion is proposed.

    Boundary checklist

  • The diff and PR body contain public-safe code and evidence.

  • The PR is limited to one recovery defect.

  • No paired RFC changed. The local bilingual check passed.

  • The PR declares its UI impact.

  • The commit carries a DCO sign-off.
  • Diff: 423 lines (+317 / -106) across 5 files Reviewer: loopx-agent Review duration: 336m
    All Vouch review confidence checks passed
    Residual risk 0.27 = Change Risk (0.50) × (1 − Review Confidence (0.47)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.50 · 423 lines diff across 5 files
    0.50
    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
    Diff Size diff_size
    0.362
    Shallow Review Depth shallow_review_depth
    0.344
    Ai Authored ai_authored
    0.050
    Real PR Conversation Timeline
    1 comments
    "Review active on #9684"
    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: 50% (MEDIUM) · Higher = larger blast radius
    50%
    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: 26.7% · Safe to merge
    26.7%