Skip to content

Commit e75a7ca

Browse files
committed
fix(sdk): detach the per-turn message listener when dropping a stale channel interaction
A duplicate or late channel interaction (e.g. a repeated Slack approval click) whose toolCallId matches no pending tool call was dropped without detaching the per-turn session.in listener. That listener marks inbound records CONSUMED, so after the drop the next user message was swallowed into pendingWireMessages (already drained before the wait) and the turn idled until the timeout, ending the run and losing the message. Mirror the action path: detach msgSub and decrement turn (a dropped interaction is not a turn) before falling through to the wait.
1 parent 8dd1698 commit e75a7ca

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

  • packages/trigger-sdk/src/v3

packages/trigger-sdk/src/v3/ai.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7594,6 +7594,11 @@ function chatAgent<
75947594
turn--;
75957595
}
75967596

7597+
if (droppedStaleInteraction) {
7598+
msgSub.off();
7599+
turn--;
7600+
}
7601+
75977602
if (!isAction && !droppedStaleInteraction) {
75987603
// Mint a scoped public access token once per turn, reused for
75997604
// onChatStart, onTurnStart, onTurnComplete, and the turn-complete chunk.

0 commit comments

Comments
 (0)