Skip to content

[ENHANCEMENT] apply_diff errors: reduce redundant context; keep best-match details only #5795

@KJ7LNW

Description

@KJ7LNW

Type

Enhancement

Problem / Value

apply_diff failures return overly verbose errors that repeat the model’s own search content and include large original file snippets. This wastes context and adds noise, making recovery slower.

Context

  • Version: v3.23.12
  • Provider: Anthropic
  • Model: sonnet-3.5
  • Current error includes:
    • The search content the model just sent (redundant)
    • Large chunks of original file content (noisy and costly)

Proposal

Streamline the error to include only what helps the next attempt:

  • Similarity score and threshold
  • “Best Match Found” snippet showing what was actually located
  • A brief tip to use read_file for full context when needed

Acceptance Criteria

  • Error body excludes repeated search content and large original file dumps
  • Includes similarity metrics and the best-match section
  • Provides a concise guidance note (e.g., consider read_file for full file)
  • Demonstrably reduces tokens used per failure without harming debuggability

Notes

Keep wording consistent with existing tool error styles; prefer brevity and actionable hints over full content dumps.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue - Needs ScopingValid, but needs effort estimate or design input before work can start.bugSomething isn't workingenhancementNew feature or request

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions