Show actual SEARCH/REPLACE content in diff summaries #390
+179
−34
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
When diff-based evolution is enabled, the "Previous Attempts" section of prompts shows changes like:
This gives the LLM no visibility into what the actual edits were, making it harder to:
This contributes to the high rate of "apply diff fail" errors (see issue #346) where SEARCH patterns don't exactly match the original code.
Solution
Update
format_diff_summary()to show actual content for multi-line blocks:Single-line changes remain compact:
Add
_format_block_lines()helper with configurable truncation limits.Configuration
New options in
prompt:config section:Files Changed
openevolve/config.py- Add PromptConfig optionsopenevolve/utils/code_utils.py- Update format_diff_summaryopenevolve/iteration.py- Pass config to format_diff_summaryopenevolve/process_parallel.py- Pass config to format_diff_summarytests/test_code_utils.py- Add tests for new behaviorSome files got reformatted, I'll leave those changes there.