From 7953150db9fe5f5d7ef3f3834e27a8341076a778 Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Wed, 20 May 2026 21:01:47 +0000 Subject: [PATCH] fix(notifier): gate missing-config warnings on AO_QUIET_STARTUP Warnings were removed unconditionally, so misconfigured notifiers silently became no-ops for all callers. Now warnings only suppress during ao start (AO_QUIET_STARTUP=1); SDK consumers, tests, and other CLI commands still receive diagnostic feedback. Co-Authored-By: Claude Sonnet 4.6 --- packages/plugins/notifier-slack/src/index.test.ts | 10 +++++++++- packages/plugins/notifier-slack/src/index.ts | 6 +++++- packages/plugins/notifier-webhook/src/index.test.ts | 10 +++++++++- packages/plugins/notifier-webhook/src/index.ts | 6 +++++- 4 files changed, 28 insertions(+), 4 deletions(-) diff --git a/packages/plugins/notifier-slack/src/index.test.ts b/packages/plugins/notifier-slack/src/index.test.ts index e319b609b..6e61eefda 100644 --- a/packages/plugins/notifier-slack/src/index.test.ts +++ b/packages/plugins/notifier-slack/src/index.test.ts @@ -59,10 +59,18 @@ describe("notifier-slack", () => { expect(notifier.name).toBe("slack"); }); - it("is silent when no webhookUrl configured (no-op notifier)", () => { + it("warns when no webhookUrl configured", () => { + const warnSpy = vi.spyOn(console, "warn").mockImplementation(() => {}); + create(); + expect(warnSpy).toHaveBeenCalledWith(expect.stringContaining("No webhookUrl configured")); + }); + + it("is silent when no webhookUrl configured and AO_QUIET_STARTUP is set", () => { + process.env.AO_QUIET_STARTUP = "1"; const warnSpy = vi.spyOn(console, "warn").mockImplementation(() => {}); create(); expect(warnSpy).not.toHaveBeenCalled(); + delete process.env.AO_QUIET_STARTUP; }); it("throws on invalid URL scheme", () => { diff --git a/packages/plugins/notifier-slack/src/index.ts b/packages/plugins/notifier-slack/src/index.ts index b6ca5d7b2..b09d6da60 100644 --- a/packages/plugins/notifier-slack/src/index.ts +++ b/packages/plugins/notifier-slack/src/index.ts @@ -357,7 +357,11 @@ export function create(config?: Record): Notifier { const defaultChannel = config?.channel as string | undefined; const username = (config?.username as string) ?? "Agent Orchestrator"; - if (webhookUrl) { + if (!webhookUrl) { + if (!process.env.AO_QUIET_STARTUP) { + console.warn("[notifier-slack] No webhookUrl configured — notifications will be no-ops"); + } + } else { validateUrl(webhookUrl, "notifier-slack"); } diff --git a/packages/plugins/notifier-webhook/src/index.test.ts b/packages/plugins/notifier-webhook/src/index.test.ts index 92e7d51b1..2d7920309 100644 --- a/packages/plugins/notifier-webhook/src/index.test.ts +++ b/packages/plugins/notifier-webhook/src/index.test.ts @@ -39,10 +39,18 @@ describe("notifier-webhook", () => { expect(notifier.name).toBe("webhook"); }); - it("is silent when no url configured (no-op notifier)", () => { + it("warns when no url configured", () => { + const warnSpy = vi.spyOn(console, "warn").mockImplementation(() => {}); + create(); + expect(warnSpy).toHaveBeenCalledWith(expect.stringContaining("No url configured")); + }); + + it("is silent when no url configured and AO_QUIET_STARTUP is set", () => { + process.env.AO_QUIET_STARTUP = "1"; const warnSpy = vi.spyOn(console, "warn").mockImplementation(() => {}); create(); expect(warnSpy).not.toHaveBeenCalled(); + delete process.env.AO_QUIET_STARTUP; }); it("throws on invalid URL scheme", () => { diff --git a/packages/plugins/notifier-webhook/src/index.ts b/packages/plugins/notifier-webhook/src/index.ts index eb2724513..d1f1b4a84 100644 --- a/packages/plugins/notifier-webhook/src/index.ts +++ b/packages/plugins/notifier-webhook/src/index.ts @@ -107,7 +107,11 @@ export function create(config?: Record): Notifier { } const { retries, retryDelayMs } = normalizeRetryConfig(config); - if (url) { + if (!url) { + if (!process.env.AO_QUIET_STARTUP) { + console.warn("[notifier-webhook] No url configured — notifications will be no-ops"); + } + } else { validateUrl(url, "notifier-webhook"); }