fix: don't consume replyPlan reference eagerly for streaming check

The streaming check was calling replyPlan.nextThreadTs() at setup time
to determine if a thread_ts existed, which consumed the first reference
before the deliver callback ran. Use incomingThreadTs/statusThreadTs
directly for the streaming eligibility check instead.
This commit is contained in:
nathandenherder
2026-02-05 19:03:26 -05:00
parent 06efbd231f
commit 878a13d215

View File

@@ -138,11 +138,13 @@ export async function dispatchPreparedSlackMessage(prepared: PreparedSlackMessag
// Slack native text streaming state
// -----------------------------------------------------------------------
const streamingEnabled = account.config.streaming === true;
const replyThreadTs = replyPlan.nextThreadTs();
// Peek at the thread target without consuming it (for streaming check only).
const streamThreadHint = incomingThreadTs ?? statusThreadTs;
const useStreaming = shouldUseStreaming({
streamingEnabled,
threadTs: replyThreadTs ?? incomingThreadTs ?? statusThreadTs,
threadTs: streamThreadHint,
});
let streamSession: SlackStreamSession | null = null;