## 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. -->
The #1 Open-Source CRM
Website ·
Documentation ·
Roadmap ·
Discord ·
Figma
Why Twenty
Twenty gives technical teams the building blocks for a custom CRM that meets complex business needs and quickly adapts as the business evolves. Twenty is the CRM you build, ship, and version like the rest of your stack.
Learn more about why we built Twenty
Installation
Cloud
The fastest way to get started. Sign up at twenty.com and spin up a workspace in under a minute, with no infrastructure to manage and always up to date.
Build an app
Scaffold a new app with the Twenty CLI:
npx create-twenty-app my-app
Define objects, fields, and views as code:
import { defineObject, FieldType } from 'twenty-sdk/define';
export default defineObject({
nameSingular: 'deal',
namePlural: 'deals',
labelSingular: 'Deal',
labelPlural: 'Deals',
fields: [
{ name: 'name', label: 'Name', type: FieldType.TEXT },
{ name: 'amount', label: 'Amount', type: FieldType.CURRENCY },
{ name: 'closeDate', label: 'Close Date', type: FieldType.DATE_TIME },
],
});
Then ship it to your workspace:
npx twenty app:publish --private
See the app development guide for objects, views, agents, and logic functions.
Self-hosting
Run Twenty on your own infrastructure with Docker Compose, or contribute locally via the local setup guide.
Everything you need
Twenty gives you the building blocks of a modern CRM (objects, views, workflows, and agents) and lets you extend them as code. Here's a tour of what's in the box.
Want to go deeper? Read the User Guide for product walkthroughs, or the
Documentation for developer reference.
|
|
|
|
|
|
Stack
TypeScript
Nx
NestJS, with BullMQ,
PostgreSQL,
Redis
React, with Jotai, Linaria and Lingui
Thanks
Thanks to these amazing services that we use and recommend for code review (Greptile), catching bugs (Sentry) and translating (Crowdin).
Join the Community
Star the repo ·
Discord ·
Feature requests ·
Releases ·
X ·
LinkedIn ·
Crowdin ·
Contribute





