Skip to content

Conversation

@roomote
Copy link
Contributor

@roomote roomote bot commented Feb 2, 2026

Summary

This PR attempts to address Issue #11087. Feedback and guidance are welcome.

Problem

Some models (like MiniMax-2.1 and Gemini) send line numbers with brackets, such as :start_line:[245] instead of :start_line:245. The current regex parsing was too strict and did not accept these variations, causing the diff to fail with "No sufficiently similar match found".

Solution

Updated the regex in MultiSearchReplaceDiffStrategy to accept optional brackets around line numbers. The regex now supports:

  • :start_line:253
  • :start_line: 253
  • :start_line:[253]
  • :start_line: [253]

Same support added for :end_line:.

Changes

  1. src/core/diff/strategies/multi-search-replace.ts: Updated regex pattern to use \[?(\d+)\]? instead of (\d+) for both start_line and end_line parsing
  2. src/core/diff/strategies/__tests__/multi-search-replace.spec.ts: Added test cases for the new bracket variations

Testing

  • All 64 existing tests pass
  • Added 4 new tests for bracket variations (with/without spaces, start_line and end_line)

Fixes #11087


Important

Update MultiSearchReplaceDiffStrategy to allow optional brackets around line numbers in diffs, with new tests added.

This description was created by Ellipsis for 30c730f. You can customize this summary. It will automatically update as commits are pushed.

…kets

Some models send `:start_line:[245]` instead of `:start_line:245`. This updates
the regex to accept optional brackets around line numbers, improving compatibility
with models like MiniMax-2.1 and Gemini.

Supported formats:
- :start_line:253
- :start_line: 253
- :start_line:[253]
- :start_line: [253]

Fixes #11087
@roomote
Copy link
Contributor Author

roomote bot commented Feb 2, 2026

Rooviewer Clock   See task on Roo Cloud

Review complete. No issues found.

The changes look good - the regex update correctly makes brackets optional around line numbers in :start_line: and :end_line: markers, solving the compatibility issue with models like MiniMax-2.1 and Gemini. Test coverage is comprehensive with 6 new tests added.

Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] gemini-2-flash-preview can't edit files anymore after upgrading from Roo Code 3.38.3 to 3.45.0

1 participant