fix: suppress stray HEARTBEAT_OK replies
This commit is contained in:
@@ -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();
|
||||
});
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user