This repository was archived by the owner on May 15, 2026. It is now read-only.
fix: search entire condensed region for tool_use blocks (ROO-520) - #10755
Closed
daniel-lxs wants to merge 2 commits into
Closed
fix: search entire condensed region for tool_use blocks (ROO-520)#10755daniel-lxs wants to merge 2 commits into
daniel-lxs wants to merge 2 commits into
Conversation
The bounded search window in getKeepMessagesWithToolBlocks was too restrictive after multiple condensations. When tool_use blocks are preserved in earlier summary messages, they can end up outside the N_MESSAGES_TO_KEEP search window, causing orphaned tool_result blocks that trigger 400 errors from the API. Changed the search to cover the entire condensed region (from index 0 to startIndex-1) instead of just the last N_MESSAGES_TO_KEEP messages. Fixes: https://linear.app/roocode/issue/ROO-520
Re-review complete for latest update. No issues found.
Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues. |
ghost
approved these changes
Jan 15, 2026
mrubens
approved these changes
Jan 23, 2026
Collaborator
|
@roomote can you fix the conflicts here? |
Resolved merge conflicts by accepting main's changes. The |
The getKeepMessagesWithToolBlocks function and related code were removed in main, making the ROO-520 fix obsolete. Accepting main changes. Also fixed type error in useMcpToolTool.spec.ts where invalid properties were passed to ToolCallbacks.
Contributor
|
🚀 Preview deployed! Your changes have been deployed to Vercel: Preview URL: https://roo-code-website-dal7uoh3u-roo-code.vercel.app This preview will be updated automatically when you push new commits to this PR. |
ghost
approved these changes
Jan 24, 2026
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Problem
After multiple condensations, tool_use blocks preserved in earlier summary messages can end up outside the bounded search window of
N_MESSAGES_TO_KEEP(3 messages). This causes orphanedtool_resultblocks that trigger 400 errors from the API:Root Cause
The bounded search in
getKeepMessagesWithToolBlockswas too restrictive:After multiple condensations,
tool_useblocks can be in earlier summary messages that are outside this window.Solution
Changed the search to cover the entire condensed region:
Tests
Added two new tests:
should find tool_use even when it is far back in the message history (ROO-520 fix)should find tool_use in previous summary message after multiple condensations (ROO-520)Fixes: https://linear.app/roocode/issue/ROO-520
Important
Expands search range for
tool_useblocks in condensed regions to prevent API errors, with new tests added.getKeepMessagesWithToolBlocksto cover entire condensed region, preventing orphanedtool_resultblocks.tool_use_idintool_resultblocks.should find tool_use even when it is far back in the message history (ROO-520 fix).should find tool_use in previous summary message after multiple condensations (ROO-520).README.mdandpage.tsx.useMcpToolTool.spec.ts.This description was created by
for ed47d6c. You can customize this summary. It will automatically update as commits are pushed.