Send cronjob result and notify-agent reaction to Telegram

The cronjob notification ran the notify-agent on the result summary and
sent only its reaction to Telegram. When the agent merely acknowledged the
summary (e.g. "👍"), the actual cronjob result never reached Telegram —
the user got a header plus an emoji and no information.

Send the real result as the guaranteed first Telegram message, then run
the notify-agent best-effort and send its reaction as a separate second
message. The agent run is wrapped in try/catch with a canRunNotifyAgent
guard instead of the old return-aborts, so a missing key / OpenAI without
key / unavailable CLI only skips the reaction — the result is already
delivered. The notify-agent still persists its reaction to the web history
automatically (ChatNonStreaming / ChatNonStreamingViaCli).

TelegramService.SendNotification now uses SendLongMessage so long results
are chunked into 4096-char messages instead of being rejected whole.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
MelekiandClaude Opus 4.8 committed 2026-06-19 20:45:00 +02:00
1 parent 6e301b7498
commit e395927a67
2 files changed
+87 -57

No files matched your search

+4 -1
View File
@@ -280,7 +280,10 @@ public class TelegramService
if (bot == null || string.IsNullOrEmpty(bot.BotToken)) return;
var chatId = long.Parse(session.TelegramChatId);
await SendMessage(chatId, bot.BotToken, text);
// SendLongMessage statt SendMessage: lange Ergebnisse (z.B. Cronjob-Antworten) werden in
// 4096-Zeichen-Chunks zerlegt. Sonst lehnt die Telegram-API zu lange Texte komplett ab
// (400 → der User bekäme gar nichts).
await SendLongMessage(chatId, bot.BotToken, text);
}
// ── Telegram Bot API ──