read_file with append_loc emits "{n}\u2192 {line}". The space after the
arrow is meant as a separator, but it is indistinguishable from real
indentation. Models strip "{n}\u2192" yet keep the space, so the old_text
passed to edit_file carries a phantom leading space and never matches
(normalize_for_fuzzy_match trims trailing whitespace only, never leading).
Drop the separator space so the arrow abuts content: stripping "{n}\u2192"
now yields the exact line with its real indentation preserved, and the
failure mode cannot occur by construction. Update the description example
to match the new format.
{"function", {
{"name", name},
{"description", "Read the contents of a file. Optionally specify a 1-based line range. "
- "If append_loc is true, each line is prefixed with its line number (e.g. \"1\u2192 ...\")."},
+ "If append_loc is true, each line is prefixed with its line number (e.g. \"1\u2192...\")."},
{"parameters", {
{"type", "object"},
{"properties", {
std::string out_line;
if (append_loc) {
- out_line = std::to_string(lineno) + "\u2192 " + line + "\n";
+ out_line = std::to_string(lineno) + "\u2192" + line + "\n";
} else {
out_line = line + "\n";
}