You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
⚠️First-time contributor? This PR cannot be merged until you sign the CLA.
The CLA Assistant bot will post a comment below — reply to it with exactly: I have read the CLA Document and I hereby sign the CLA
(Separate from this: all commits must also be signed off with git commit -s — see the Checklist.)
Summary
Prune redundant tool-call round-trip messages for finalized legacy turns
Persist memory cleanup back to database to prevent reloading bloat
Add comprehensive unit and Ollama integration tests
- Prune redundant tool-call round-trip messages for finalized legacy turns
- Persist memory cleanup back to database to prevent reloading bloat
- Add comprehensive unit and Ollama integration tests
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Two moderate test-coverage issues remain: one test prunes the tool-call unit before exercising forceCompact(), and another does not verify that the persisted state reflects the required cleanup.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
A moderate active issue remains because pruning an empty terminal AI response can remove in-memory tool messages without persisting the cleanup or recalculating token pressure, allowing the history to return on the next session load.
No open issues 🎉
1 previously missed issue
In code that hasn't changed since last review
Persist pruning when the terminal answer has no text
This cleanup is not durable for a terminal AiMessage whose text is blank (for example, an image-only response): addMessageToDb() returns immediately for blank getTextContent(), so after this block removes the tool-call messages, the database still contains the old round-trip and _usedTokens/pressure are not recomputed. On the next session load there is no persisted terminal answer to trigger pruning, and the tool history comes back. Persist and call updatePressure() when this pruning removes messages even if the new answer has no text, or otherwise handle this blank-terminal path explicitly.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
A moderate active finding shows the test assertion can pass even when the tool-call pair is incorrectly pruned, so the intended round-trip behavior remains unverified.
No open issues 🎉
1 previously missed issue
In code that hasn't changed since last review
Test assertion passes when both tool-call messages are pruned
This assertion passes in both cases: when the tool-call pair survives (true == true) and when forceCompact() prunes both messages (false == false). Consequently the test does not verify the behavior promised by its name and would not catch the round-trip being removed entirely. Arrange the pair in the protected recent units or assert the intended survival outcome separately, while retaining a separate parity assertion for the non-splitting invariant.
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
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
Related Issue(s)
Type of Change
What Changed & Why
How to Test
./gradlew testScreenshots / Recordings (if applicable)
Checklist
main./gradlew spotlessApplyand./gradlew detektlocally./gradlew testand all tests passgit commit -sAdditional Notes