fix: preserve orphan response content during rearrangement #1564
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
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
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
ktsoator
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 workgo test -race -mod=readonly -count=1 -shuffle=on workgolangci-lint run(v2.3.1) in both modulesgo mod tidy -diffin both modulesThe full suite, including Web tests, passes after syncing main.
No manual E2E or live-model test was run.
Checklist
Additional context
Python's rearranger also removes intermediate events. Go keeps content left by orphan pruning to address #1540.