-
Notifications
You must be signed in to change notification settings - Fork 0
edit_file exact string matching is too brittle #87
Copy link
Copy link
Open
Description
Problem
The edit_file tool in seedling.ts requires an exact string match to replace content. In practice, the LLM may produce edits that don't match due to whitespace differences, indentation changes, or minor formatting variations, causing the edit to fail and potentially stalling the Seedling run. This fragility leads to unnecessary retries or crashes.
What to build
Replace the exact-match logic with a more forgiving approach. Options:
- Line-based replacement: match an entire line (or set of lines) and replace it, ignoring leading/trailing whitespace differences.
- Regex-based replacement: allow the model to specify a pattern (as a regex) to find the target, then replace the matched portion.
- Diff-based editing: use a library like
diffto apply changes more intelligently.
At minimum, trim whitespace on both sides before comparing, and consider normalizing indentation.
Done when
- The
edit_filetool successfully applies edits even when the providedold_stringhas minor whitespace differences from the file content. - Existing tests (if any) still pass, and new tests cover fuzzy matching scenarios.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels