feat(compaction): fold to a token-capped tail, not recent turns - #1227
TheGreatAxios merged 3 commits into
Conversation
TheGreatAxios
left a comment
There was a problem hiding this comment.
Review
Incomplete, not shippable. The verbatim last-N floor is gone and the CL-9006 latch is not weakened, but the live fold is still spine + unexcerpted anchors + tail, the tail cap has holes, still-over folds are silent, and the pairing suite is red.
Blocking
-
Unexcerpted anchors blow the 60% trigger.
applystill emits[summaryTurn, ...anchorTurns, ...tailTurns].edit_file/write_filescore 10 and drag full bodies (excerpting is tail-only). A fixture of 8 fat edit pairs landed at ~160k tokens vs a 76.8k trigger. -
Non-convergence is not reported.
foldNonConvergedis a getter only; the director never reads it. After a still-over fold the consecutive cap is spent and the session sits over 60% with no operator notice. -
Pairing suite is red (
compactor-pairing.test.ts, 8 fails). WhenselectTailkeeps every turn, the earlysummarizedTurns.length === 0return skipsstubSupersededReads. -
Images are free against the tail cap.
excerptedTurnCharsignoresimageblocks, so a huge newest screenshot can keeptailTokenEstimate≤ 2500 while occupancy stays over 60%.
Should-fix
preserveWholeUserMessages is declared and never read by selectTail.
What holds
COMPACTOR_KEEP_RECENT_TURNS/keepRecentTurnsdeleted; default tail budget 2500 tokens.- Pair atomicity for well-formed call/result sequences still holds.
- Fat handoff blob + thin spine pointer remain.
TheGreatAxios
left a comment
There was a problem hiding this comment.
Review (second pass, 25ab7a67)
Shippable. All four prior blockers are closed. Independent tester: 172 pass / 0 fail; typecheck exit 0. CL-9006 latch is not weakened.
- Live fold is spine + token-capped tail. Fat
edit_file/write_filebodies go to the handoff; occupancy fixture < 76800. - Still-over folds emit
custom.compaction.fold_nonconverged(TUI systemNotice / exec warn). stubSupersededReadsstill runs when the tail swallows the transcript. Pairing suite green.- Images count via
estimateContentBlockTokens.
Hygiene for later (not blocking): dead-ish preserveWholeUserMessages / maxAnchorTurns leftovers; screenshot budget test can be made stricter.
25ab7a6 to
d098a62
Compare
Unexcerpted edit_file pairs were riding the live fold as score-10 anchors and holding occupancy over the 60% trigger. The live set is now the thin spine plus a token-capped tail: file-edit bodies go in the fat handoff, images count against the tail budget, superseded reads still stub when the tail is the whole transcript, and a still- over fold notifies the operator without weakening the occupancy latch. # Conflicts: # src/session/compactor.ts
Tiny fixtures sat inside the 2500-token live tail and no-oped. The paging e2e echoed the summarizer prompt, so verify truncated the repair and aborted the fold. Point the auth store test at the testkit mock helper.
9434566 to
7b0f0f6
Compare
Summary
Verification
Part of CL-9489