Skip to content

[FEATURE]: port V1 fuzzy edit matching to the V2 edit tool #51706

Closed

Description

@mohitjoer
  • I have verified this feature I'm about to request hasn't been suggested before.

The V2 edit tool matches oldString with a single literal indexOf scan, so any inexact match fails outright with "Could not find oldString". When a model reproduces oldString from memory and it is only nearly right — trailing whitespace, an indentation slip, an extra blank line — the edit fails, the model re-reads the file, and the call is retried.

V1 already handles these cases with seven lenient strategies, and a TODO in packages/core/src/tool/edit.ts has been tracking the port.

A PR is up that ports them as pure helpers in packages/core/src/tool/edit-match.ts, consulted only after exact matching returns zero, and that also fixes two open bugs in that logic: #41872 and #45199.

Previously requested in #32760, which was auto-closed for not following the issue template.

Activity

  1. github-actions commented on Sep 27, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions