Skip to content

fix(control): prevent MemoryQuickAddNote from swallowing multi-line Markdown headings#4046

Merged
esengine merged 1 commit into
esengine:main-v2from
warvyvr:main-v2
Jun 12, 2026
Merged

fix(control): prevent MemoryQuickAddNote from swallowing multi-line Markdown headings#4046
esengine merged 1 commit into
esengine:main-v2from
warvyvr:main-v2

Conversation

@warvyvr

@warvyvr warvyvr commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

#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

…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
@github-actions github-actions Bot added v2 Go rewrite (1.x) — main-v2 branch, active development agent Core agent loop (internal/agent, internal/control) and removed v2 Go rewrite (1.x) — main-v2 branch, active development labels Jun 11, 2026
@esengine

Copy link
Copy Markdown
Owner

Great catch and a clear writeup — the COSTAR # Context paste silently becoming a memory note (so the agent never ran) is a nasty one, and pinning down why the TUI's [P1] paste-folding hid it is exactly the right analysis. Treating any newline-containing input as a normal prompt is the right call: a #-leading multi-line block is almost always Markdown, not a one-line note, and single-line # note is preserved. Fixing it at the control layer covers every submit() caller. Merging — thanks!

@esengine esengine merged commit 668e7ca into esengine:main-v2 Jun 12, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent Core agent loop (internal/agent, internal/control)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: 使用COSTAR提示词,导致程序直接不运行了

2 participants