fix: suppress stray HEARTBEAT_OK replies

This commit is contained in:
Peter Steinberger
2026-01-01 23:53:29 +01:00
parent 7c0379ce05
commit 06e379a239
5 changed files with 68 additions and 5 deletions

View File

@@ -1415,7 +1415,7 @@ describe("web auto-reply", () => {
resetLoadConfigMock();
});
it("skips responsePrefix for HEARTBEAT_OK responses", async () => {
it("does not deliver HEARTBEAT_OK responses", async () => {
setLoadConfigMock(() => ({
routing: {
allowFrom: ["*"],
@@ -1456,8 +1456,7 @@ describe("web auto-reply", () => {
sendMedia: vi.fn(),
});
// HEARTBEAT_OK should NOT have prefix - clawdis needs exact match
expect(reply).toHaveBeenCalledWith(HEARTBEAT_TOKEN);
expect(reply).not.toHaveBeenCalled();
resetLoadConfigMock();
});

View File

@@ -185,6 +185,7 @@ export { stripHeartbeatToken };
function isSilentReply(payload?: ReplyPayload): boolean {
if (!payload) return false;
const text = payload.text?.trim();
if (text?.includes(HEARTBEAT_TOKEN)) return true;
if (!text || text !== SILENT_REPLY_TOKEN) return false;
if (payload.mediaUrl || payload.mediaUrls?.length) return false;
return true;