← Back to Pull requests

Preserve context when a prefetched source is unavailable #9676

Open
unknown opened this pull request with 208 lines diff across 2 files
View on GitHub
unknown unknown commented on Nov 30, 2026 18:46 UTC
Author

User outcome

An agent continuing a settled Todo can trust the source reference carried by an optional prefetch receipt. If the verified capture disappears or changes before host delivery, the Turn can still proceed with its existing working context.

Change

The Turn driver reuses the bounded regular-file reader and verifies the capture digest immediately before applying an EpochReset receipt. An unavailable or changed source uses the existing KeepRaw path without replaying prefetch or claiming savings. Valid sources retain the original token gate. The verifier shares its source snapshot with the external baseline calculation.

Validation

  • All four newly covered missing or changed source cases delivered EpochReset on the parent. The final head passes six File and SQLite cases through the actual context-read command, the Turn entrypoint, and a subprocess host, including intact-source replay.

  • The two Python suites passed 189 tests. Ruff, configured mypy, and an isolated installed-wheel source-loss smoke passed.

  • Standard premerge passed with zero blocking failures. Its vocabulary advisory passed when rerun in isolation, and the standalone base and head outputs were identical.

  • Source readback also ran through the real native Codex CLI fresh-session entrypoint with an isolated Responses fixture and a local companion overlay on #9503 at bd95159de8a3. Both unavailable-source cases retained all 470 raw fixture markers in actual provider input. The intact-source control still folded. Each scenario recorded two Todo debits. The companion integration stays with #9503. Paid Grid results, AGY, and DSH are separate qualification work.
  • Diff: 208 lines (+156 / -52) across 2 files Reviewer: loopx-agent Review duration: 574m
    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 · 208 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.320
    Real PR Conversation Timeline
    1 comments
    "Review active on #9676"
    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: 36.4% (MEDIUM) · Higher = larger blast radius
    36.4%
    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.4% · Safe to merge
    19.4%