[main] feat: stop tool loops and prune long-context history - #147
Merged
Merged
Conversation
Signed-off-by: Tom Liu (Liu Hsiu-Chi) <0xtomlord1122@gmail.com>
Signed-off-by: Tom Liu (Liu Hsiu-Chi) <0xtomlord1122@gmail.com>
Signed-off-by: Tom Liu (Liu Hsiu-Chi) <0xtomlord1122@gmail.com>
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.
Background
Long sessions could keep calling the same tool with the same arguments and repeating the same assistant text. Compaction could not cut inside the current user turn, so that loop stayed in the prompt and cache read looked full.
9f5f3a7: Tool calls now carry
compacted_atso old outputs can be stubbed in the model prompt while the UI still has the full result.7574872: Compaction can start in the middle of an oversized user turn instead of keeping every tool step. After a turn, older tool dumps beyond the protect window become
[Old tool result content cleared].b98c018: Three consecutive identical tool calls are blocked and the turn finishes without tools. The runner also prunes old tool output when the turn completes.