fix: escape mentions and HTML-ish chars in outbound message text#85
Merged
AmethystLiang merged 1 commit intomainfrom Apr 29, 2026
Merged
fix: escape mentions and HTML-ish chars in outbound message text#85AmethystLiang merged 1 commit intomainfrom
AmethystLiang merged 1 commit intomainfrom
Conversation
Slack's chat.postMessage expects user mentions as `<@u123>`, broadcasts as `<!here>`, and literal `&`/`<`/`>` escaped as entities. Callers (including LLMs piping CI output) routinely supply the raw forms, so messages render with bare `@U...` instead of a real ping and with unescaped `<fix>` swallowed by Slack. Normalize outbound text in one place at the send/edit boundary, and teach the rich_text inline parser to emit user/broadcast elements so list-style messages mention correctly too. Co-authored-by: Orca <help@stably.ai>
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
agent-slack message send/editpreviously forwarded user text raw tochat.postMessage, so@U05BRPTKL6Aarrived as literal text (no ping) and bare</>/&were dropped/mangled by Slack.formatOutboundSlackTextto promote bare user IDs (@U…/@W…/@B…) and broadcasts (@here/@channel/@everyone) to real Slack tokens and HTML-escape literal&/</>, leaving already-formed<@…>,<#…>,<!…>, and<https://…>tokens intact.user/broadcastelements so list-style messages mention correctly too.Test plan
bun test(193 pass)bun run typecheckagent-slack message send "#ci-alerts" "@U05BRPTKL6A heads up <fix> & go"renders as a real mention with escaped<fix>&&Made with Orca 🐋