fix(control): prevent MemoryQuickAddNote from swallowing multi-line Markdown headings#4046
Merged
Conversation
…arkdown headings esengine#4008: pasting a COSTAR-style prompt starting with "# Context" (or any Markdown H1 heading) on the Windows Wails desktop GUI caused the agent to never start — the entire multi-line input was silently saved as a memory note instead of being sent to the agent loop. Root cause: MemoryQuickAddNote only checked for a "# " prefix. When the desktop calls ctrl.Submit() → submit(), the full multi-line input goes through MemoryQuickAddNote first. A prompt beginning with "# Context" matched the quick-add pattern, so submit() returned early after saving a memory note — the agent never ran. Why the TUI is unaffected: the terminal UI folds pasted multi-line content into a "[P1]" label before the quick-add check runs, so the "# " prefix is never visible to MemoryQuickAddNote. The expanded text goes through ctrl.SendWithRaw(), which bypasses submit() entirely. Fix: reject multi-line input in MemoryQuickAddNote. Any input containing a newline is now treated as a normal prompt, not a quick-add note. Single-line "# note" still works as before. Test: added 3 multi-line cases (COSTAR-style with blank line, simple two-line, indented multi-line) all expecting ok=false; single-line "# Heading" preserves ok=true backward compatibility. Fixes esengine#4008
Owner
|
Great catch and a clear writeup — the COSTAR |
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.
#4008: pasting a COSTAR-style prompt starting with "# Context" (or any Markdown H1 heading) on the Windows Wails desktop GUI caused the agent to never start — the entire multi-line input was silently saved as a memory note instead of being sent to the agent loop.
Root cause: MemoryQuickAddNote only checked for a "# " prefix. When the desktop calls ctrl.Submit() → submit(), the full multi-line input goes through MemoryQuickAddNote first. A prompt beginning with "# Context" matched the quick-add pattern, so submit() returned early after saving a memory note — the agent never ran.
Why the TUI is unaffected: the terminal UI folds pasted multi-line content into a "[P1]" label before the quick-add check runs, so the "# " prefix is never visible to MemoryQuickAddNote. The expanded text goes through ctrl.SendWithRaw(), which bypasses submit() entirely.
Fix: reject multi-line input in MemoryQuickAddNote. Any input containing a newline is now treated as a normal prompt, not a quick-add note. Single-line "# note" still works as before.
Test: added 3 multi-line cases (COSTAR-style with blank line, simple two-line, indented multi-line) all expecting ok=false; single-line "# Heading" preserves ok=true backward compatibility.
Fixes #4008