From fc9452d860adbdc94853b8142f89424a42472f1b Mon Sep 17 00:00:00 2001 From: catchingknives <35201177+catchingknives@users.noreply.github.com> Date: Mon, 18 May 2026 07:17:52 +0200 Subject: [PATCH] fix(pulse/telegram): drop SDK session resume to prevent empty responses MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit After a handful of messages on a long-lived Pulse process, the Telegram bot starts returning the canned fallback "Sorry, I wasn't able to generate a response. Try again?". Affects any PAI user with the Telegram module enabled long enough to hit it. Root cause: startTelegram carries conversation state on two redundant channels — the last 10 exchanges spliced into the prompt as "Previous conversation: …" (lines 180-188) AND `resume: lastSessionId` passed to the SDK's query() (the removed block). The SDK-side resume saturates after a few turns; once tripped, query() short-circuits in 2-3 s with numTurns:0, cost:0, empty result — and fullText stays empty, triggering the fallback. Real-session evidence (all turns on the same sessionId): 14:43 numTurns=1 cost=$0.42 OK 15:42 numTurns=1 cost=$0.31 OK 15:58 numTurns=0 cost=$0 empty 18:04 numTurns=0 cost=$0 empty 18:07 numTurns=0 cost=$0 empty Fix: drop the `resume` pass. The in-prompt history already carries conversational context (the last 10 exchanges — what users perceive as "memory"), so removing SDK-side resume is a no-op for UX and removes the saturation failure mode. `lastSessionId` capture is kept for log correlation. --- .../v5.0.0/.claude/PAI/PULSE/modules/telegram.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Releases/v5.0.0/.claude/PAI/PULSE/modules/telegram.ts b/Releases/v5.0.0/.claude/PAI/PULSE/modules/telegram.ts index 22b0fea2e..01640c518 100644 --- a/Releases/v5.0.0/.claude/PAI/PULSE/modules/telegram.ts +++ b/Releases/v5.0.0/.claude/PAI/PULSE/modules/telegram.ts @@ -215,11 +215,13 @@ CRITICAL RULES FOR TELEGRAM MODE: }, } - // Resume previous session for context continuity - if (lastSessionId) { - sdkOptions.resume = lastSessionId - } - + // Intentionally NOT passing `resume: lastSessionId`. The in-prompt + // history block above already carries the last-10 exchanges of context; + // passing `resume` on top of that double-books conversation state and + // saturates the SDK session after a few turns — at which point query() + // short-circuits with numTurns:0 / cost:0 / empty result, producing the + // user-visible "Sorry, I wasn't able to generate a response" fallback. + // `lastSessionId` is still tracked below for log correlation only. const conversation = query({ prompt, options: sdkOptions as any }) // Collect response with timeout