mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-10 09:22:45 +00:00
fix: strengthen cron heartbeat multi-payload suppression (#32131) (thanks @adhishthite)
This commit is contained in:
@@ -116,6 +116,27 @@ describe("runCronIsolatedAgentTurn", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("suppresses announce delivery for multi-payload narration ending in HEARTBEAT_OK", async () => {
|
||||
await withTempHome(async (home) => {
|
||||
const { storePath, deps } = await createTelegramDeliveryFixture(home);
|
||||
mockEmbeddedAgentPayloads([
|
||||
{ text: "Checked inbox and calendar. Nothing actionable yet." },
|
||||
{ text: "HEARTBEAT_OK" },
|
||||
]);
|
||||
|
||||
const res = await runTelegramAnnounceTurn({
|
||||
home,
|
||||
storePath,
|
||||
deps,
|
||||
});
|
||||
|
||||
expect(res.status).toBe("ok");
|
||||
expect(res.delivered).toBe(false);
|
||||
expect(deps.sendMessageTelegram).not.toHaveBeenCalled();
|
||||
expect(runSubagentAnnounceFlow).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
it("handles media heartbeat delivery and announce cleanup modes", async () => {
|
||||
await withTempHome(async (home) => {
|
||||
const { storePath, deps } = await createTelegramDeliveryFixture(home);
|
||||
|
||||
@@ -87,8 +87,8 @@ export function pickLastDeliverablePayload(payloads: DeliveryPayload[]) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if all payloads are just heartbeat ack responses (HEARTBEAT_OK).
|
||||
* Returns true if delivery should be skipped because there's no real content.
|
||||
* Check if delivery should be skipped because the agent signaled no user-visible update.
|
||||
* Returns true when any payload is a heartbeat ack token and no payload contains media.
|
||||
*/
|
||||
export function isHeartbeatOnlyResponse(payloads: DeliveryPayload[], ackMaxChars: number) {
|
||||
if (payloads.length === 0) {
|
||||
|
||||
Reference in New Issue
Block a user