Skip to content

fix(desktop): keep trailing space after persistent agent mentions - #5021

Open
VaibhavJain2609 wants to merge 1 commit into
block:mainfrom
VaibhavJain2609:fix/4979-keep-agents-active-trailing-space
Open

fix(desktop): keep trailing space after persistent agent mentions#5021
VaibhavJain2609 wants to merge 1 commit into
block:mainfrom
VaibhavJain2609:fix/4979-keep-agents-active-trailing-space

Conversation

@VaibhavJain2609

Copy link
Copy Markdown

Summary

  • Fixes "Keep addressed agents active" should insert a space after the agent mentions #4979: TipTap markdown setContent strips trailing whitespace, so post-send "Keep addressed agents active" restores left the caret glued to the mention chip and the next keystroke collapsed it (@Pearl@Pearlh).
  • Re-attach the trailing space with a raw insertText transaction after markdown parse (setEditorMarkdownPreservingTrailingWhitespace), wired into composer setContent / setContentAndFocusEnd.
  • Adds unit coverage for the strip repro + preserve path (including emitUpdate: false / preventUpdate), plus an e2e regression that types after a post-send restore.

Test plan

  • node --import ./test-loader.mjs --experimental-strip-types --test src/features/messages/lib/setEditorMarkdownPreservingTrailingWhitespace.test.mjs (7 passing)
  • pnpm exec tsc --noEmit in desktop/
  • Pre-push desktop unit suite (4394 passing)
  • Enable Keep addressed agents active → message an agent in a thread → after send, confirm a space after the restored mention chip → type without pressing space; chip must stay intact
  • CI desktop smoke: persistent-agent-audience.spec.ts (includes new post-send trailing-space case)

Made with Cursor

TipTap markdown setContent strips trailing whitespace, so post-send
"Keep addressed agents active" restores left the caret glued to the
mention chip and the next keystroke collapsed it. Re-attach the space
via insertText after markdown parse.

Signed-off-by: Vaibhav Jain <vaibhavjain@Vaibhavs-MacBook-Pro.local>
Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"Keep addressed agents active" should insert a space after the agent mentions

1 participant