fix(agent): keep prior digests verbatim across compaction; document the limit#4082
Merged
Conversation
…he limit A compaction digest was eligible to be re-summarized by the next fold, so a fact it had captured could be dropped to summary-of-summary drift. Keep prior digests verbatim alongside the kept user turns and summarize only the new foldable work; digests accumulate (small) instead of collapsing into one lossy rolling summary. Document the guarantee in SPEC 3.6: a fact stated in a normal turn, and a fact a digest captured, survive any number of folds; a fact buried inside a single oversized message stays best-effort — there is no reliable way to auto-detect an arbitrary fact in bulk, so durable facts belong in their own turn.
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.
Follow-up to #4048/#4052. Two parts: a robustness fix and an honest doc of the limit.
Keep prior digests verbatim
A compaction digest was eligible to be re-summarized by the next fold (
partitionFoldonly kept user turns; digests went into the foldable set, and the summary was built from the whole region). So a fact a digest had already captured could be dropped to summary-of-summary drift on the next fold.Now
partitionFoldkeeps prior digests verbatim too, and the new digest summarizes only the foldable work (summarize(fold), not the whole region). Digests accumulate (each small) instead of collapsing into one lossy rolling summary, so a fact that reached a digest once is not lost to re-folding.TestCompactKeepsPriorDigestscovers it (verified it fails without the change).Document the limit (SPEC 3.6)
We chased "facts the user said get forgotten" to ground. The guarantees, now written down:
There is no reliable way to auto-detect an arbitrary fact in bulk (keyword matching is fragile intent-detection; the summarizer drops needles; full-verbatim doesn't fit the window with multiple large pastes), so the doc tells users to state durable facts in their own turn. The raw oversized content is archived and recoverable either way.
go test ./internal/agent/...green.