refactor(mark): consolidate note extraction and strip action wrapper from fallback titles#366
Merged
refactor(mark): consolidate note extraction and strip action wrapper from fallback titles#366
Conversation
Project-level chat sessions prepend an <action>...</action> block to the stored session prompt. When the assistant's note lacks an H1 heading, the fallback title was derived from the first 80 characters of this wrapped prompt, causing raw XML to appear as the note title. Add strip_action_wrapper() to remove the injected block before generating fallback titles for both regular and project notes. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…per tests Extract resolve_note_title_and_body() to deduplicate the identical title/body extraction + fallback-title logic that was copy-pasted between the repo-note and project-note paths in run_post_completion_hooks. Both paths now share a single loop over NoteTarget variants, scanning assistant messages only once. Add 6 unit tests for strip_action_wrapper covering: no wrapper, normal wrapper, leading whitespace, missing closing tag, whitespace-only remainder, and nested action tags. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
resolve_note_title_and_bodyhelperstrip_action_wrapperto remove leading<action>...</action>blocks from session prompts so fallback note titles reflect the user's actual textstrip_action_wrapper🤖 Generated with Claude Code