Skip to content

fix(chat): preserve markdown whitespace in plain text#604

Open
RSO wants to merge 2 commits into
vercel:mainfrom
RSO:busy-scorpio
Open

fix(chat): preserve markdown whitespace in plain text#604
RSO wants to merge 2 commits into
vercel:mainfrom
RSO:busy-scorpio

Conversation

@RSO

@RSO RSO commented Jun 10, 2026

Copy link
Copy Markdown

Problem

When I mention a Chat SDK-powered bot on GitHub like this:

@bot
hi there!

The mention doesn't trigger any handling, because the mdastToString helper replaces all newlines with an empty string, so the logs look like this:

[chat-sdk] Checking message patterns { patternCount: 0, patterns: [], messageText: '@bothi there' }
[chat-sdk] No handlers matched message {
  threadId: 'github:RSO/chat:issue:29',
  text: '@bothi there'
}

Summary

  • Preserve structural markdown whitespace when extracting normalized plain text from mdast.
  • Add regression coverage for newline-separated bot mentions in core markdown extraction, GitHub issue/review comments, and Chat mention routing.
  • Add a patch changeset for the behavior fix.

Testing

  • pnpm check
  • pnpm knip
  • pnpm test:workspace
  • pnpm --filter chat test
  • pnpm --filter @chat-adapter/github test
  • pnpm --filter chat typecheck
  • pnpm --filter @chat-adapter/github typecheck

Notes

  • pnpm validate was attempted and reached the full Turbo test graph, but failed on packages/integration-tests/src/replay-discord.test.ts (should skip bot's own messages in subscribed threads). Rerunning pnpm --filter @chat-adapter/integration-tests test -- src/replay-discord.test.ts passed, so this appears unrelated to the markdown whitespace change.
  • .github/CONTRIBUTING.md requires signed commits. This environment has no gpg binary and no SSH signing identities loaded, so the commit in this PR is currently unsigned and may need to be re-signed before merge.
@RSO RSO requested a review from a team as a code owner June 10, 2026 13:54
@vercel

vercel Bot commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

@RSO is attempting to deploy a commit to the Vercel Team on Vercel.

A member of the Team first needs to authorize it.

Comment thread packages/chat/src/markdown.ts Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant