fix(agent): preserve unconsumed tool results during microcompact - #269
Open
jsoncm wants to merge 1 commit into
Open
fix(agent): preserve unconsumed tool results during microcompact#269jsoncm wants to merge 1 commit into
jsoncm wants to merge 1 commit into
Conversation
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.
Summary
Microcompact runs before the next provider request, after the latest assistant tool batch and its user tool results have already been stored in history. Previously, count-based triggering and clearing treated that unconsumed batch as historical context, allowing the next model turn to receive cleared tool output.
This change protects every tool result associated with the latest assistant tool batch. Protected results are excluded from both the count trigger and clearing candidates; older model-consumed results retain the existing cleanup behavior.
Tests
just push -u origin fix/protect-unconsumed-tool-roundcargo fixand workspace Clippycargo fmtScope
This is intentionally limited to preserving unconsumed tool results. It does not change the default-disabled microcompact setting or introduce task-wide tool-call, duration, or batch-budget policies.