Skip to content

Conversation

@nang-dev
Copy link

@nang-dev nang-dev commented Apr 9, 2025

Context

Implementation

Screenshots

before after

How to Test

Get in Touch

mrubens and others added 25 commits March 21, 2025 15:47
Provide support for escaping section markers so that the model can
add or remove lines like:
	=======
by escaping them in the search or replace string:
	\=======

A state machine tracks apply_diff markers appear in correct sequence:
SEARCH -> SEPARATOR -> REPLACE. Prevents syntax corruption from interleaved or
malformed blocks by validating before processing matches.

If a model tries to interleave diff markers, then the state machine will
return a response to the model like this so it can correct. testing
shows that this works on Claude 3.5, 3.7 and gemini-2.0-flash-thinking:

```xml
    <error_details>
    ERROR: Special marker '=======' found in your diff content at line 7:

    When removing merge conflict markers like '=======' from files, you MUST escape them
    in your SEARCH section by prepending a backslash (\) at the beginning of the line:

    CORRECT FORMAT:

    <<<<<<< SEARCH
    content before
    \=======    <-- Note the backslash here in this example
    content after
    =======
    replacement content
    >>>>>>> REPLACE

    Without escaping, the system confuses your content with diff syntax markers.
    You may use multiple diff blocks in a single diff request, but ANY of ONLY the following separators that occur within SEARCH or REPLACE content must be must be escaped, as follows:
    \<<<<<<< SEARCH
    \=======
    \>>>>>>> REPLACE

    </error_details>
```

Fixes: RooCodeInc#1557
Fixes: RooCodeInc#1408

Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
When previewing system instructions, getDiffStrategy was not receiving the
MULTI_SEARCH_AND_REPLACE flag, causing the instructions to show the wrong diff
strategy description. Now correctly passing the flag to ensure the proper diff
strategy description is shown in system instructions.

Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Prevents attempting to apply diffs where search and replace content are identical,
which would result in no changes being made. Instead, provide a helpful error
message explaining why the operation was rejected.

Fixes: RooCodeInc#1350

Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Require newlines between diff section markers (SEARCH, ======, REPLACE)
to prevent content confusion when searching input contains separator
markers. Error message mentions required marker newlines.

Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Tests valid and invalid marker sequences:
- validates single and multiple complete sequences
- detects out-of-order markers (separator/replace before search)
- detects incorrect sequence termination
- validates state transitions between SEARCH/SEP/REPLACE markers

Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Add tests that validate:
- Original content with unescaped markers
- Search content with escaped markers to match unescaped markers in original content
- Proper validation of escaped search, separator, and replace markers in diff content
- Successful application of diffs with escaped markers in search content

Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
docs: update contributors list [skip ci]

Co-authored-by: mrubens <mrubens@users.noreply.github.com>
…eInc#1915)

When maxReadFileLine setting was set to zero, the code would attempt to read lines with a negative end index
(maxReadFileLine - 1 = -1), causing the readLines function to reject the request.

This change:
- Checks if maxReadFileLine is greater than zero before calling readLines
- Returns an empty string when maxReadFileLine is zero
- Ensures content is only formatted with line numbers when it's not empty

Signed-off-by: Eric Wheeler <roo-code@z.ewheeler.org>
Co-authored-by: Eric Wheeler <roo-code@z.ewheeler.org>
…pts (RooCodeInc#1853)

- Corrected error causing free models listed under openrouter to show pricing information
- Updated pre-push and pre-commit scripts to work in Windows environments when pushing to branch (windows requires npm/npx to include the ".cmd" extension to recognize and compile.
* Fixes for prompts suite unit tests on windows

* unixLike -> toPosix

Fix naming, and re-use code that already provides this function
…lisions

Fix multiple `apply_diff` issues
…c#1862)

Fix maxTokens to 8096 only for compatible Anthropic models

Co-authored-by: Pugazhendhi <pugazhendhi@unboundsecurity.ai>
* Add Requesty OAuth flow

* New 1-click onboarding flow

* Requesty: Use correct default model info

* When called from the onboard flow, created the default profile

Glama OAuth handler changed for consistency.

* Add router images

* Shuffle the routers

* Translate

* Appease knip

---------

Co-authored-by: Daniel Trugman <dtrugman@gmail.com>
* Tweaks to file read auto-truncate

* Change to use a text input

* Changeset
@nang-dev nang-dev merged commit b7896be into main Apr 9, 2025
7 of 10 checks passed
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.

8 participants