Skip to content

Commit d121cd1

Browse files
exe.dev userclaude
andcommitted
fix(router): pass isGroup from adapter through to messaging group creation
The router hardcoded is_group=0 when auto-creating messaging groups, causing channel mentions to be misclassified as DMs. The Chat SDK bridge knows which handler fired (onDirectMessage vs onNewMention) so thread the signal through InboundMessage → InboundEvent → router. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 61ca43d commit d121cd1

3 files changed

Lines changed: 6 additions & 1 deletion

File tree

src/channels/adapter.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ export interface InboundEvent {
5656
* See InboundMessage.isMention for the full explanation.
5757
*/
5858
isMention?: boolean;
59+
/** True when the source is a group/channel thread, false for DMs. */
60+
isGroup?: boolean;
5961
};
6062
replyTo?: DeliveryAddress;
6163
}
@@ -81,6 +83,8 @@ export interface InboundMessage {
8183
* router falls back to text-match against agent_group_name.
8284
*/
8385
isMention?: boolean;
86+
/** True when the source is a group/channel thread, false for DMs. */
87+
isGroup?: boolean;
8488
}
8589

8690
/** A file attachment to deliver alongside a message. */

src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ async function main(): Promise<void> {
8585
content: JSON.stringify(message.content),
8686
timestamp: message.timestamp,
8787
isMention: message.isMention,
88+
isGroup: message.isGroup,
8889
},
8990
}).catch((err) => {
9091
log.error('Failed to route inbound message', { channelType: adapter.channelType, err });

src/router.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ export async function routeInbound(event: InboundEvent): Promise<void> {
170170
channel_type: event.channelType,
171171
platform_id: event.platformId,
172172
name: null,
173-
is_group: 0,
173+
is_group: event.message.isGroup ? 1 : 0,
174174
unknown_sender_policy: 'request_approval',
175175
denied_at: null,
176176
created_at: new Date().toISOString(),

0 commit comments

Comments
 (0)