d626528560
The cursor was set to the pre-splice `exchange_end`. A splice collapses the absorbed span -- an assistant plus its tool results, often four or more messages -- into a single marker, and may also drop a superseded marker further back, so every index after it shifts. The stale cursor therefore overshot, landing inside a *later* exchange's tool group. The next pass's `_find_one_exchange` walked forward from there to the following assistant, so the exchange it had landed inside was never absorbed at all. On tool-bearing conversations micro-compaction was silently doing roughly half the work it should. Traced on a 3-tool-per-exchange transcript: the cursor sat at index 6 when the marker was at 2, and the message count stalled at 32 instead of continuing to 28. Derive the cursor from the marker's actual position in the spliced result instead, which is self-correcting regardless of how much the splice moved. Apply it on the defrag path too, which had the same staleness. Found by a randomized long-horizon harness (480 conversation shapes x 25 passes, varying tool-group sizes and summarizer failure modes) asserting structural and progress invariants after every pass. Existing tests missed it because their fixtures have no tool results, so the absorbed span is one message and nothing shifts. The regression test uses tool groups. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>