fix(cli): fence in-flight retractions across session re-keys and switches #6070
All Vouch review confidence checks passed
Residual risk 0.18 = Change Risk (0.45) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.45 · 439 lines diff across 5 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.364
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #6070"
general
weight: 0.35
liugddx
Split from #5265 per @liugddx's scope review: the retraction/switch fencing for pre-existing plain-text races lives on its own branch, so each half can be reviewed and reverted independently.
What's here
settleRetractions/trackRetractionand the retraction fences keyed on the owning sessionholdSwitchWindowacross session re-keys:/session, side open/close,/rewind, and now/newdetachingpre-guards ongoToSession/openSideConversation/newSessionrunSessionSwitch/runMidTurnSwitch/rewind/openSide/closeSide/newparks behind an in-flight retraction and holds the switch window the way/sessiondoes — the P3 from the #5265 review of4d7764420(586759fc7)The quote-staging half stays in #5265; this branch removes it, so the net diff here is fencing-only (runner + its tests + one
check-tui-copy.mjswhitelist line). Roughly 19 plain-text race tests, none involving quotes. Per the review suggestion, the four "drains a retraction before X" tests and the three "blocks Shift+Left while X" tests are consolidated into two table-driven tests (assertion semantics unchanged).Relationship to #5265
check-tui-copy.mjswhitelist: each PR adds its own line.Verification
4d7764420the suite was 278 with 2 Windows-only SIGTERM fails noted by the reviewer; not reproduced locally — the 17 quote tests moved to #5265, 9 tests consolidated into 2 table-driven ones, +1 new/newtest)biome checkon the changed files clean;check:asf-headerspass;check-tui-copyokdrains a retraction started before /new re-keysruns red before586759fc7(/newexecuted immediately: 1 !== 0) and green afterTwo test assertions were re-graded to plain-text equivalents when the quote half left:
discards a retraction after a mid-turn switchnow asserts the editor does not contain the restored text (instead of a status-line quote count), andserializes a mid-turn switchassertsretractedTexts.at(-1)instead of a quote payload. Happy to tighten either back up.cc @liugddx for the scope re-check.
AI use
Select exactly one:
Tool(s) and scope: GLM-5.3-Flash (ZCode) implemented the retraction/switch fencing changes and their tests under human direction and review. The affected commits carry
Generated-by: GLM-5.3-Flash (ZCode)trailers, and the final squash commit should keep that trailer.Checklist
Does this PR entail a change in behavior?
/session,/new, side open/close,/rewind), so their text is no longer lost or applied to the wrong session.