Skip to content

[BUG] Roo things ' and ' are the same and fails to apply the change #9563

@Lissanro

Description

@Lissanro

Problem (one or two sentences)

I keep getting error like this:

src/components/docs/FAQ.jsx - Diff 1: Search and replace content are identical - no changes would be made

Debug Info:
- Search and replace must be different to make changes
- Use read_file to verify the content you want to change
Image

The model correctly tries to replace ' with ':

From:

token   1379: ' This'
token   8370: ' doesn't'
token   3594: ' change'

To:

token   1379: ' This'
token   8248: ' doesn'
token  15032: '&apos'
token  40876: ';t'
token   3594: ' change'

And yet Roo Code claims they are the same and errors out. The content of the file does not get corrected, so the model keep getting the same eslint error and trying it over and over, and Roo Code keeps mistakenly identifying completely different token sequences as "the same". This suggests comparison happens on processed strings where escaped characters are converted to the their final form, which should not be happening - it is important that exact raw string are used for search and replace.

Context (who is affected and when)

I think everyone is affected who often edits .jsx files and uses eslint checks. There is possibility Roo Code may have broken comparison for other similar escaped characters, not just apostrophe. So far, I ended up replacing it manually but since this bug isn't fixed for a while and I did not find other reports about it, I decided to create one myself.

Reproduction steps

Ask the model to correct syntax error like this in a .jsx file:

This doesn't change

(it should be This doesn't change)

The specific error:

`'` can be escaped with `'`, `‘`, `'`, `’`.eslint[react/no-unescaped-entities](https://github.com/jsx-eslint/eslint-plugin-react/tree/master/docs/rules/no-unescaped-entities.md)

I am using Kimi K2 0905 with XML tool calls (Roo Code default).

Expected result

Replace ' with '

Actual result

Replace ' with ' does not happen and Roo Code stops the model after few tries, even though it produced correct search-replace pattern successful every time

Variations tried (optional)

No response

App Version

3.34.2

API Provider (optional)

OpenAI Compatible

Model Used (optional)

Kimi K2 0905

Roo Code Task Links (optional)

No response

Relevant logs or errors (optional)

token   9413: 'Let'
token   1019: ' me'
token   7546: ' fix'
token    276: ' the'
token 113650: ' ESL'
token    590: 'int'
token  15578: ' warning'
token    673: ' by'
token  89625: ' escaping'
token    276: ' the'
token  62173: ' apost'
token  71142: 'rophe'
token   5292: ':

'
token     27: '<'
token  10601: 'apply'
token  28715: '_diff'
token    719: '>
'
token     27: '<'
token   3992: 'args'
token    719: '>
'
token 156770: '<file'
token    719: '>
'
token    220: ' '
token    555: ' <'
token   4953: 'path'
token     29: '>'
token   6435: 'src'
token  23991: '/components'
token  17616: '/docs'
token     14: '/'
token 150691: 'FAQ'
token 126635: '.jsx'
token    993: '</'
token   4953: 'path'
token    719: '>
'
token    220: ' '
token    555: ' <'
token  22288: 'diff'
token    719: '>
'
token    274: '   '
token    555: ' <'
token   4204: 'content'
token   3318: '><'
token   5688: '!['
token 150326: 'CDATA'
token  24331: '[
'
token  55096: '<<<<'
token 133293: '<<<'
token 112496: ' SEARCH'
token    198: '
'
token   1217: '         '
token  18676: ' Before'
token   2458: ' each'
token   3798: ' game'
token     11: ','
token    398: ' you'
token    691: ' can'
token  54485: ' shuffle'
token    276: ' the'
token  28877: ' tiles'
token    308: ' to'
token   8967: ' random'
token    822: 'ize'
token   1110: ' their'
token  15417: ' positions'
token     13: '.'
token   1379: ' This'
token   8370: ' doesn't'
token   3594: ' change'
token    276: ' the'
token  21562: ' underlying'
token   3798: ' game'
token  48795: ' mechanics'
token    996: ' but'
token   8376: ' gives'
token    398: ' you'
token  11360: ' visual'
token   7804: ' variety'
token    316: ' and'
token   8619: ' helps'
token    472: ' with'
token  10214: ' strategy'
token   9020: ' planning'
token    341: '.
'
token  94428: '=======
'
token   1217: '         '
token  18676: ' Before'
token   2458: ' each'
token   3798: ' game'
token     11: ','
token    398: ' you'
token    691: ' can'
token  54485: ' shuffle'
token    276: ' the'
token  28877: ' tiles'
token    308: ' to'
token   8967: ' random'
token    822: 'ize'
token   1110: ' their'
token  15417: ' positions'
token     13: '.'
token   1379: ' This'
token   8248: ' doesn'
token  15032: '&apos'
token  40876: ';t'
token   3594: ' change'
token    276: ' the'
token  21562: ' underlying'
token   3798: ' game'
token  48795: ' mechanics'
token    996: ' but'
token   8376: ' gives'
token    398: ' you'
token  11360: ' visual'
token   7804: ' variety'
token    316: ' and'
token   8619: ' helps'
token    472: ' with'
token  10214: ' strategy'
token   9020: ' planning'
token    341: '.
'
token  41959: '>>>>'
token  29381: '>>>'
token 112294: ' REPLACE'
token    198: '
'
token   9912: ']]'
token   4192: '></'
token   4204: 'content'
token    719: '>
'
token    220: ' '
token   2078: ' </'
token  22288: 'diff'
token    719: '>
'
token    993: '</'
token   2274: 'file'
token    719: '>
'
token    993: '</'
token   3992: 'args'
token    719: '>
'
token    993: '</'
token  10601: 'apply'
token  28715: '_diff'
token     29: '>'
token 163586: '<|im_end|>'

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue/PR - TriageNew issue. Needs quick review to confirm validity and assign labels.bugSomething isn't working

    Type

    No type

    Projects

    Status

    Triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions