Skip to content

Commit 30ae81e

Browse files
committed
fix(mattermost): persist threadId in delivery context for all session types
Previously updateLastRoute was only called for DM (kind === direct) sessions. For group/channel sessions with threads, the deliveryContext never stored threadId, so cron/heartbeat wakeups targeting a thread-scoped session had no thread context and delivered replies to the channel root. Remove the kind === direct guard so delivery context is persisted for all session types, including thread-scoped sessions. Fixes #45082 case 2: cron/heartbeat wake replies landing at channel root.
1 parent f7ced43 commit 30ae81e

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

‎extensions/mattermost/src/mattermost/monitor.ts‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1380,7 +1380,10 @@ export async function monitorMattermostProvider(opts: MonitorMattermostOpts = {}
13801380
...mediaPayload,
13811381
});
13821382

1383-
if (kind === "direct") {
1383+
{
1384+
// Persist delivery context for all session types (including threads).
1385+
// Without threadId here, cron/heartbeat wakeups into a thread-scoped session
1386+
// lose thread context and deliver to channel root (issue #45082 case 2).
13841387
const sessionCfg = cfg.session;
13851388
const storePath = core.channel.session.resolveStorePath(sessionCfg?.store, {
13861389
agentId: route.agentId,
@@ -1392,6 +1395,7 @@ export async function monitorMattermostProvider(opts: MonitorMattermostOpts = {}
13921395
channel: "mattermost",
13931396
to,
13941397
accountId: route.accountId,
1398+
threadId: effectiveReplyToId,
13951399
},
13961400
});
13971401
}

0 commit comments

Comments
 (0)