fix: reply in the Slack DM thread the user wrote in
- chat-sdk-bridge: forward thread.id to the router for DMs so sub-thread context survives into delivery. Previously hardcoded to null, which collapsed every reply to the DM top level. - router: when a DM (is_group=0) is wired as `shared`, don't auto-escalate to per-thread — keep one session for the whole DM and let thread_id flow through to the adapter. - agent-runner poll-loop: defer follow-up messages whose thread_id differs from the active turn's routing. Mixing threads into one streaming turn sent every reply to the first thread because routing is captured at turn start. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
committed by
exe.dev user
parent
79fd142be4
commit
fdece8047e
@@ -175,11 +175,14 @@ export function createChatSdkBridge(config: ChatSdkBridgeConfig): ChannelAdapter
|
||||
await thread.subscribe();
|
||||
});
|
||||
|
||||
// DMs — always forward + subscribe
|
||||
// DMs — always forward + subscribe. Pass thread.id so sub-thread
|
||||
// context carries through to delivery (Slack users can open threads
|
||||
// inside a DM). The router collapses DM sub-threads to one session
|
||||
// (is_group=0 short-circuits the per-thread escalation).
|
||||
chat.onDirectMessage(async (thread, message) => {
|
||||
const channelId = adapter.channelIdFromThreadId(thread.id);
|
||||
log.info('Inbound DM received', { adapter: adapter.name, channelId, sender: (message.author as any)?.fullName ?? (message.author as any)?.userId ?? 'unknown', threadId: thread.id });
|
||||
await setupConfig.onInbound(channelId, null, await messageToInbound(message));
|
||||
await setupConfig.onInbound(channelId, thread.id, await messageToInbound(message));
|
||||
await thread.subscribe();
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user