Skip to content

Address only the longer of two @names in a group, and not a Bot named by an email address - #708

Merged
davidmckayv merged 3 commits into
CopilotKit:mainfrom
Chebaleomkar:fix/group-mention-match
Oct 2, 2026
Merged

davidmckayv merged 3 commits into
CopilotKit:mainfrom
Chebaleomkar:fix/group-mention-match

Conversation

@Chebaleomkar

Copy link
Copy Markdown
Contributor

What this changes

mentionedPeers in server/src/channels/group.ts matched each Bot's @name on its own:

  • With Bots "Ops" and "Ops Lead", @Ops Lead please look returned both, because "Ops" followed by a space passes the lookahead. In send both Bots answered. In relay the unintended Bot got a queued turn, an audit row and a fan-out slot.
  • Nothing was required before the @, so write to jo@sam.com addressed a Bot called Sam.

Now an @ straight after a letter, digit or _ is not a mention, and where two names match at the same @, only the longer one counts. The speaker is still matched, so its own longer name hides a shorter peer's, and it is still never returned.

Where it runs

Server: group conversations, both a person's message (send) and Bot-to-Bot relays.

Boundary and audit

Fewer unintended relays, so fewer unintended mayAddress checks and audit rows. Depth and fan-out checks are unchanged.

Changelog

Entry under Unreleased.

Proof

New test in server/tests/group-conversations.test.ts. It fails on main (3 pass, 1 fail) and passes with the fix (4/4). Server tsc and Biome format and lint are clean.

…l address

mentionedPeers matched each Bot's @name independently, so "@ops Lead"
addressed Ops too, and nothing was required before the @, so
"jo@sam.com" addressed Sam. Require a non-word character before the @
and drop a match that a longer name covers at the same position.
@davidmckayv
davidmckayv merged commit 8595a5d into CopilotKit:main Oct 2, 2026
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.

2 participants