fix(agent-core): account for earlier kept requests in the compaction summary - #2681
Open
tommy0103 wants to merge 1 commit into
Open
fix(agent-core): account for earlier kept requests in the compaction summary#2681tommy0103 wants to merge 1 commit into
tommy0103 wants to merge 1 commit into
Conversation
…summary Auto compaction keeps old user messages verbatim but drops their answers, so a long-completed request (notably a session-opening skill activation) reads as pending work once the summary fails to mention it. The post- compaction turn could then abandon the in-flight request and re-execute the session's earliest message. Teach the compaction instruction to mark each earlier request still visible in the kept messages as done / abandoned / superseded / open, and tell the summary consumer not to restart requests the summary marks as completed.
🦋 Changeset detectedLatest commit: 698b646 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
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.
Related Issue
Resolve #2680
Problem
See linked issue. In short: when auto compaction fires mid-turn in a long multi-task session, the rebuilt context keeps old user messages verbatim but drops their answers. If the summary does not say the earliest kept request (typically the session-opening skill activation) is already finished, the post-compaction step can abandon the in-flight request and re-execute that stale instruction.
What changed
Prompt-level fix on both the production and consumption sides of the compaction summary:
This approach fits Kimi Code because it closes the drift loophole without changing the rebuilt context shape (kept-set selection, head/tail budgets, and the drop of assistant messages all stay as-is); the stricter alternative of narrowing
skill_activationretention was deliberately left out as too invasive for a first fix. Existing compaction tests cover the new text — snapshots and two hardcoded token-count expectations were updated for the longer templates.Checklist
gen-changesetsskill, or this PR needs no changeset.gen-docsskill, or this PR needs no doc update.