fix: scope history injection to pending-only

This commit is contained in:
Peter Steinberger
2026-01-16 23:52:14 +00:00
parent 56ed5cc2d9
commit e31251293b
21 changed files with 278 additions and 175 deletions

View File

@@ -124,7 +124,6 @@ export const dispatchTelegramMessage = async ({
identityName: resolveIdentityName(cfg, route.agentId),
};
let didSendReply = false;
const { queuedFinal } = await dispatchReplyWithBufferedBlockDispatcher({
ctx: ctxPayload,
cfg,
@@ -147,7 +146,6 @@ export const dispatchTelegramMessage = async ({
messageThreadId: resolvedThreadId,
onVoiceRecording: sendRecordVoice,
});
didSendReply = true;
},
onError: (err, info) => {
runtime.error?.(danger(`telegram ${info.kind} reply failed: ${String(err)}`));
@@ -174,7 +172,7 @@ export const dispatchTelegramMessage = async ({
});
draftStream?.stop();
if (!queuedFinal) {
if (isGroup && historyKey && historyLimit > 0 && didSendReply) {
if (isGroup && historyKey && historyLimit > 0) {
clearHistoryEntries({ historyMap: groupHistories, historyKey });
}
return;
@@ -189,7 +187,7 @@ export const dispatchTelegramMessage = async ({
});
});
}
if (isGroup && historyKey && historyLimit > 0 && didSendReply) {
if (isGroup && historyKey && historyLimit > 0) {
clearHistoryEntries({ historyMap: groupHistories, historyKey });
}
};