Roo-Code/src/core/diff
Povilas Kanapickas 065c5ab222
fix: Improve error message when apply_diff structure is invalid (#2260)
Currently all errors in apply_diff diff structure are assumed to be
related to merge conflicts. This is unfortunate because it is way more
likely that LLM simply made an error structuring the diff. The LLM is
then directed to fix escaping in the diff from which it doesn't recover.

It is safe to assume that missing or extra "<<<<<<< SEARCH" or ">>>>>>>
REPLACE" strings are likely bad diff structure, because while "<<<<<<<"
and ">>>>>>>" are common merge conflict markers, no tools add "SEARCH"
and "REPLACE" strings after them. This is likely output of the LLM
itself.

LLM not recovering has been observed in Claude 3.5 Sonnet and Claude 3.7
Sonnet models.

To address the issue, error message now mentions merge conflict markers
and their escaping only if it's clear that errors may come from this
source. In the rest of cases the error message repeats the expected diff
structure back to the LLM.
2025-04-03 16:43:57 -04:00
..
strategies fix: Improve error message when apply_diff structure is invalid (#2260) 2025-04-03 16:43:57 -04:00
DiffStrategy.ts Remove code for old diff strategies (#2262) 2025-04-03 11:09:02 -04:00
insert-groups.ts Checkpoint on insert and search/replace tools 2025-01-28 21:05:44 +07:00
types.ts Add diffStrategy name to telemetry 2025-03-12 13:46:46 -04:00