From d1c2fc4bc80398ba166fd44796c002b1f329ca37 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Wed, 21 Jan 2026 03:32:11 +0000 Subject: [PATCH] fix: hide empty status rows --- src/auto-reply/reply/commands-status.ts | 4 +--- src/auto-reply/reply/commands.test.ts | 14 ++++++++++++++ src/auto-reply/status.test.ts | 16 ++++++++++++++++ src/auto-reply/status.ts | 1 + 4 files changed, 32 insertions(+), 3 deletions(-) diff --git a/src/auto-reply/reply/commands-status.ts b/src/auto-reply/reply/commands-status.ts index c75aedddf..f7a5a5fab 100644 --- a/src/auto-reply/reply/commands-status.ts +++ b/src/auto-reply/reply/commands-status.ts @@ -184,9 +184,7 @@ export async function buildStatusReply(params: { const requesterKey = resolveInternalSessionKey({ key: sessionKey, alias, mainKey }); const runs = listSubagentRunsForRequester(requesterKey); const verboseEnabled = resolvedVerboseLevel && resolvedVerboseLevel !== "off"; - if (runs.length === 0) { - if (verboseEnabled) subagentsLine = "🤖 Subagents: none"; - } else { + if (runs.length > 0) { const active = runs.filter((entry) => !entry.endedAt); const done = runs.length - active.length; if (verboseEnabled) { diff --git a/src/auto-reply/reply/commands.test.ts b/src/auto-reply/reply/commands.test.ts index 2f98c6abb..fa104de03 100644 --- a/src/auto-reply/reply/commands.test.ts +++ b/src/auto-reply/reply/commands.test.ts @@ -215,6 +215,20 @@ describe("handleCommands subagents", () => { expect(result.reply?.text).toContain("Subagents: none"); }); + it("omits subagent status line when none exist", async () => { + resetSubagentRegistryForTests(); + const cfg = { + commands: { text: true }, + channels: { whatsapp: { allowFrom: ["*"] } }, + session: { mainKey: "main", scope: "per-sender" }, + } as ClawdbotConfig; + const params = buildParams("/status", cfg); + params.resolvedVerboseLevel = "on"; + const result = await handleCommands(params); + expect(result.shouldContinue).toBe(false); + expect(result.reply?.text).not.toContain("Subagents:"); + }); + it("returns help for unknown subagents action", async () => { resetSubagentRegistryForTests(); const cfg = { diff --git a/src/auto-reply/status.test.ts b/src/auto-reply/status.test.ts index 6e1088707..ea7a96726 100644 --- a/src/auto-reply/status.test.ts +++ b/src/auto-reply/status.test.ts @@ -143,6 +143,22 @@ describe("buildStatusMessage", () => { expect(normalized).toContain("Media: image ok (openai/gpt-5.2) · audio skipped (maxBytes)"); }); + it("omits media line when all decisions are none", () => { + const text = buildStatusMessage({ + agent: { model: "anthropic/claude-opus-4-5" }, + sessionEntry: { sessionId: "media-none", updatedAt: 0 }, + sessionKey: "agent:main:main", + queue: { mode: "none" }, + mediaDecisions: [ + { capability: "image", outcome: "no-attachment", attachments: [] }, + { capability: "audio", outcome: "no-attachment", attachments: [] }, + { capability: "video", outcome: "no-attachment", attachments: [] }, + ], + }); + + expect(normalizeTestText(text)).not.toContain("Media:"); + }); + it("does not show elevated label when session explicitly disables it", () => { const text = buildStatusMessage({ agent: { model: "anthropic/claude-opus-4-5", elevatedDefault: "on" }, diff --git a/src/auto-reply/status.ts b/src/auto-reply/status.ts index fcaa29a8b..0230007fb 100644 --- a/src/auto-reply/status.ts +++ b/src/auto-reply/status.ts @@ -203,6 +203,7 @@ const formatMediaUnderstandingLine = (decisions?: MediaUnderstandingDecision[]) }) .filter(Boolean); if (parts.length === 0) return null; + if (parts.every((part) => part.endsWith(" none"))) return null; return `📎 Media: ${parts.join(" · ")}`; };