← Back to Pull requests

fix: preserve orphan response content during rearrangement #1564

Closed
unknown closed this pull request without merging on Sep 28, 2026 13:44 UTC
View on GitHub
unknown unknown commented on Sep 11, 2026 00:53 UTC
Author

Linked issue

Closes #1540.

History rearrangement drops content already preserved by orphan-response pruning. Track the events that still have content after pruning and keep them when a later matched response triggers rearrangement.

This is an exception for content left by orphan pruning. Ordinary intermediate user and model text keeps its existing filtering behavior.

Behavior change

Text and images left after removing an orphaned response now reach the model. The latest completed call/response pair stays last, so the issue's example becomes [text:note] [call:a] [resp:a].

Testing Plan

Four regression cases cover combined parts, separate parts, content around unrelated tools, and model-role remnants. All four fail with the fix removed.

The separate-part case uses distinct text to verify that ordinary text is filtered and orphan remnants are retained. Inverting the retention condition fails this case.

Passed locally:

  • go build -mod=readonly work

  • go test -race -mod=readonly -count=1 -shuffle=on work

  • golangci-lint run (v2.3.1) in both modules

  • go mod tidy -diff in both modules
  • The full suite, including Web tests, passes after syncing main.

    No manual E2E or live-model test was run.

    Checklist

  • Read CONTRIBUTING.md.

  • Reviewed the full diff.

  • Documented the retention rule.

  • Confirmed the regression tests fail without the fix.

  • All tests pass locally.

  • Manually tested end-to-end.
  • Additional context

    Python's rearranger also removes intermediate events. Go keeps content left by orphan pruning to address #1540.

    Diff: 219 lines (+164 / -55) across 2 files Reviewer: ktsoator Review duration: 25251m
    All Vouch review confidence checks passed
    Residual risk 0.16 = Change Risk (0.37) × (1 − Review Confidence (0.57)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.37 · 219 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%
    56%
    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.323
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #1564"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 56.8% 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.7% (MEDIUM) · Higher = larger blast radius
    36.7%
    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: 56.8% · Lower = rushed or shallow review
    56.8%
    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.9% · Safe to merge
    15.9%
    Repository