fix: suppress zero sub-agent stop note

This commit is contained in:
Peter Steinberger
2026-01-16 21:41:55 +00:00
parent a0be85c34c
commit 97a41a6509
4 changed files with 7 additions and 5 deletions

View File

@@ -35,7 +35,7 @@ export function setAbortMemory(key: string, value: boolean): void {
}
export function formatAbortReplyText(stoppedSubagents?: number): string {
if (typeof stoppedSubagents !== "number") {
if (typeof stoppedSubagents !== "number" || stoppedSubagents <= 0) {
return "⚙️ Agent was aborted.";
}
const label = stoppedSubagents === 1 ? "sub-agent" : "sub-agents";

View File

@@ -25,7 +25,9 @@ vi.mock("./route-reply.js", () => ({
vi.mock("./abort.js", () => ({
tryFastAbortFromMessage: mocks.tryFastAbortFromMessage,
formatAbortReplyText: (stoppedSubagents?: number) => {
if (typeof stoppedSubagents !== "number") return "⚙️ Agent was aborted.";
if (typeof stoppedSubagents !== "number" || stoppedSubagents <= 0) {
return "⚙️ Agent was aborted.";
}
const label = stoppedSubagents === 1 ? "sub-agent" : "sub-agents";
return `⚙️ Agent was aborted. Stopped ${stoppedSubagents} ${label}.`;
},