fix(compaction): avoid repeating retained user instructions#883
Open
luoye520ww wants to merge 1 commit into
Open
fix(compaction): avoid repeating retained user instructions#883luoye520ww wants to merge 1 commit into
luoye520ww wants to merge 1 commit into
Conversation
2 tasks
luoye520ww
force-pushed
the
codex/fix-881-compaction-instruction-dedup
branch
2 times, most recently
from
July 16, 2026 06:47
1469795 to
3ebd157
Compare
luoye520ww
force-pushed
the
codex/fix-881-compaction-instruction-dedup
branch
from
July 16, 2026 09:11
3ebd157 to
0aa9541
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Part of #881. Context compaction could summarize content that the next model request also retained verbatim. That duplicated the latest user instruction; replayed compaction lifecycle events could also append duplicate side-conversation rows.
Root cause
The heuristic summary was built from the full history instead of only the folded head. The model-backed automatic and manual compaction paths could likewise pass retained-tail-derived skill pins through the continuation prompt. Their defensive fallback passed the full history when a compaction item had no
sourceItemIds.Scope
This PR makes compaction source selection strict and idempotent:
sourceItemIdsfor automatic and manual compaction.itemId, preserving the original timestamp.Non-goals
Safety
Typecheck
Passed:
Tests
Passed:
The compaction tests exercise real
HistoryCompactionServiceandTurnServiceflows with a local streaming model fixture for automatic and manual compaction; the renderer test replays lifecycle events through the side-conversation sink.Review performed
PR size
Issue
Part of #881