- 
                Notifications
    You must be signed in to change notification settings 
- Fork 125
fix: Strip duplicate headers in edit_note replace_section #396
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Fixes #390 When using edit_note with replace_section operation, if the LLM includes the section header in the content parameter (e.g., "## Testing\nNew content"), it would create duplicate headers in the resulting document. This fix detects when new_content starts with the same header that's being replaced and strips it before appending the content. Changes: - Modified replace_section_content() to strip duplicate headers from new_content - Added test test_edit_entity_replace_section_strips_duplicate_header() - Updated docstring to clarify content should not include the header Co-authored-by: Drew Cain <[email protected]>
| Claude finished @phernandez's task —— View job PR Review: fix: Strip duplicate headers in edit_note replace_section  | 

Summary
Fixes #390 - Prevents duplicate section headers when using edit_note with replace_section operation.
When LLMs include the section header in the content parameter (which they shouldn't, but sometimes do), the operation now detects and strips the duplicate header before appending the content.
Changes
replace_section_content()inentity_service.pyto strip duplicate headerstest_edit_entity_replace_section_strips_duplicate_header()Test Plan
Generated with Claude Code