Skip to content

V2 core edit tool: port fuzzy matching strategies from V1 to improve edit reliability #32760

Closed as not planned

Description

@Robin1987China

Description

The V2 core edit tool (packages/core/src/tool/edit.ts) only supports exact string matching. When an LLM produces oldString with slight whitespace, indentation, or escape differences, the edit fails with "Could not find oldString."

The V1 edit tool (packages/opencode/src/tool/edit.ts) has 9 proven fuzzy fallback strategies (line-trimmed, block-anchor, whitespace-normalized, indentation-flexible, escape-normalized, trimmed-boundary, context-aware, multi-occurrence) plus Levenshtein distance and a disproportionate-match safety guard.

A TODO at line 83 of the V2 core edit tool explicitly calls for this port.

Activity

  1. github-actions commented on Jun 18, 2026

    @github-actions
    Contributor

    This issue doesn't fully meet our contributing guidelines.

    What needs to be fixed:

    • This appears to be a feature request (porting V1 fuzzy matching strategies to V2), but it does not use the Feature Request template. The title should start with [FEATURE]: and the issue should include the required verification checkbox confirming you have searched for existing issues.

    Please edit this issue to address the above within 2 hours, or it will be automatically closed.

    If you believe this was flagged incorrectly, please let a maintainer know.

  2. github-actions commented on Jun 18, 2026

    @github-actions
    Contributor

    This issue has been automatically closed because it was not updated to meet our contributing guidelines within the 2-hour window.

    Feel free to open a new issue that follows our issue templates.

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