Repository navigation
fix(autogen-core): report the true skipped message count in head and tail context - #8370
Open
Aniket Kumar (aniketkrs) wants to merge 1 commit into
Open
Aniket Kumar (aniketkrs) wants to merge 1 commit into
Aniket Kumar (aniketkrs) wants to merge 1 commit into
Conversation
This branch has not been deployed
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.
Fixes #8328
User impact: when a transcript is trimmed with HeadAndTailChatCompletionContext, the injected marker reports the wrong number of dropped messages. With head_size 2 and tail_size 2 on an 8 message transcript where both boundary trims fire, the marker prints Skipped 4 messages while 6 were actually dropped. Anyone relying on that count for token budget UIs or debugging gets a misleading number.
Cause: get_messages trims the head and tail lists at the tool call boundaries, but num_skipped is computed from the configured head_size and tail_size, ignoring the messages the trims removed.
Fix: compute num_skipped from the lengths of the actually retained head and tail lists. The not enough messages short circuit is unchanged, and the count can no longer drift from the messages that are really kept.
Before: Skipped 4 on the issue example. After: Skipped 6, matching the messages actually omitted. Branch file re fetched and patch confirmed present.