← Back to Pull requests

fix(mcp): fence stale writes and require native collections #242

Closed
unknown closed this pull request without merging on Sep 15, 2026 08:53 UTC
View on GitHub
unknown unknown commented on Sep 14, 2026 10:47 UTC
Author

A superseded MCP history response could still write its page before completion noticed that ownership changed. Scoped replies had no shared thread generation, allowing an older response to replace a newer parent and insert stale children. Native responses with missing/null collections could also certify empty completion.

Fence history requests and history-derived writes by the current checkpoint revision, and acquire shared generations for selected scoped reply roots before requesting them. Transactional write checks reject superseded results while preserving earlier valid commits, newer work and unselected backlog. Require native collection arrays before accepting a page; explicit empty arrays remain valid.

This consolidates #242, #243 and #244 and preserves Vincent Koc’s implementations and contributor credit. Ordinary retained replies keep their independent ownership. Explicit Since scopes select returned roots, while failed selected work remains available for ordinary retry. Native paging limits and the documented text-bootstrap recovery policy remain unchanged.

Validation:

  • Failing-before synthetic Sync regressions reproduce stale history persistence and a scoped reply overwriting a newer root plus inserting a stale child.

  • Ten missing/null native collection cases fail before the fix across channels, strict channels, users, history and replies.

  • Expanded synthetic MCP/CLI and real SQLite tests cover request supersession, cancellation, rollback, history/reply generations, source isolation, retention, native array contracts and bootstrap recovery.

  • Final main integration races pass for stale responses, required collections and the independently landed native channel-evidence behavior.

  • Full local static checks, all 15 race-test packages, compiled smoke, snapshot packaging and all eight artifact checksums passed. Independent Codex autoreview is scoped-clean through P2; exact-head CI is required before merge.
  • No live Slack or provider completeness claim. Docs and Unreleased notes describe the ownership and response contracts.

    Diff: 259 lines (+194 / -65) across 3 files Reviewer: steipete Review duration: 1325m
    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 · 259 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.333
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #242"
    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.2% (MEDIUM) · Higher = larger blast radius
    39.2%
    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.5% · Safe to merge
    15.5%