4dbc5a567e
## Context `parseSlackAssistantRequest` only stripped a bot mention at the very start of the message. A message like "hey @twenty, who owns ACME?" sent the raw `<@U0123ABC>` token into the agent prompt, where the agent sees an opaque id. **Stacked on #23835**: this PR's base is `feat/slack-no-silent-dead-ends`, since both touch `parse-slack-assistant-request.ts`. Merge #23835 first; this PR then retargets to main with only its own changes. ## What this does Only the bot's own mention may be stripped: mentions of other members are part of the request ("ask <@UALICE> about the ACME deal" must keep `<@UALICE>`), so blindly removing every `<@…>` token is wrong and the parser needs the bot's actual user id. - The Slack `event_callback` envelope already carries that id in its `authorizations` field, so `getSlackBotUserIdFromEventBody` reads it straight from the request body. The parser stays pure and synchronous, no `auth.test` call and no KV involved, and this does not collide with the connect-time id cache #23726 is introducing. - `stripSlackBotMention` removes every occurrence of that mention (leading, mid-text, `<@U…|label>` form), in app_mention events and DMs alike. When the mention sits directly before punctuation, the preceding whitespace is consumed too, so "hey @twenty, who owns ACME?" becomes "hey, who owns ACME?" rather than "hey , who owns ACME?". Everything else is covered by the parser's existing whitespace collapsing. - Fallback when `authorizations` is absent: on app_mention events the bot id is derived from the leading mention and other occurrences of that same id are stripped, which matches the old behaviour on the old inputs. Without any way to identify the bot (a DM without `authorizations`), mentions are left untouched rather than guessed at. - A side effect of knowing the real bot id: a message that *starts* with another member's mention no longer has that mention wrongly stripped as if it were the bot's. ## Tests New parser cases: bot mention mid-text, at start plus mid-text, repeated mention via the leading-mention fallback, other-user mentions preserved next to a stripped bot mention, leading other-user mention preserved, DM containing the bot mention, and DM with an unknown bot id keeping mentions intact. `yarn test:unit` (61 tests), `yarn typecheck` and `yarn lint` all pass in the app. --- _Generated by [Claude Code](https://claude.ai/code/session_01QQUfYsp2j4robY6rZFrixZ)_ <!-- This is an auto-generated description by cubic. --> <a href="https://cubic.dev/pr/twentyhq/twenty/pull/23837?utm_source=github" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img alt="Review in cubic" src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a> <!-- End of auto-generated description by cubic. -->