From e04e7492c25b954732a6c2b612cb0f5311207de4 Mon Sep 17 00:00:00 2001 From: kagura-agent Date: Tue, 7 Jul 2026 16:14:47 +0800 Subject: [PATCH 1/2] fix: unwrap ResilientProvider name in noop summarize check (#1020) ResilientProvider renames providers to `resilient(${inner.name})`, so the noop short-circuit check `provider.name === "noop"` never matches the wrapped name `resilient(noop)`. This causes summarize to fall through into real LLM logic against an empty-string provider, producing misleading empty_provider_response / too_many_chunks_skipped errors instead of a clean no_provider skip. Unwrap the resilient(...) prefix before comparing to detect the base provider name correctly. Signed-off-by: kagura-agent Signed-off-by: kagura-agent --- src/functions/summarize.ts | 4 +++- test/summarize.test.ts | 23 +++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/src/functions/summarize.ts b/src/functions/summarize.ts index 4c501ca8c..39cc9d399 100644 --- a/src/functions/summarize.ts +++ b/src/functions/summarize.ts @@ -260,7 +260,9 @@ export function registerSummarizeFunction( return { success: false, error: "no_observations" }; } - if (provider.name === "noop") { + // Unwrap resilient(...) wrapper to get the base provider name (#1020) + const baseProviderName = provider.name.replace(/^resilient\((.+)\)$/, "$1"); + if (baseProviderName === "noop") { logger.info("Summarize skipped — no LLM provider configured", { sessionId, }); diff --git a/test/summarize.test.ts b/test/summarize.test.ts index 4723da878..dda811d60 100644 --- a/test/summarize.test.ts +++ b/test/summarize.test.ts @@ -479,4 +479,27 @@ describe("mem::summarize chunking", () => { expect(result.success).toBe(false); expect(result.error).toBe("parse_failed"); }); + + it("ResilientProvider-wrapped noop provider returns no_provider without calling summarize (#1020)", async () => { + const calls: Array<{ system: string; user: string }> = []; + const wrappedNoop: MemoryProvider = { + name: "resilient(noop)", + compress: async () => "", + summarize: async (system: string, user: string) => { + calls.push({ system, user }); + return ""; + }, + }; + const { handler } = await setupHandler({ + sessionId: "ses_noop", + obsCount: 3, + provider: wrappedNoop, + }); + + const result: any = await handler({ sessionId: "ses_noop" }); + + expect(result.success).toBe(false); + expect(result.error).toBe("no_provider"); + expect(calls).toHaveLength(0); + }); }); From 7db0bb3d1bd9bb52d704ea74761902461dc0e8ab Mon Sep 17 00:00:00 2001 From: kagura-agent Date: Tue, 7 Jul 2026 16:22:55 +0800 Subject: [PATCH 2/2] style: remove redundant comment per CodeRabbit review Signed-off-by: kagura-agent Signed-off-by: kagura-agent --- src/functions/summarize.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/functions/summarize.ts b/src/functions/summarize.ts index 39cc9d399..6bb2cad61 100644 --- a/src/functions/summarize.ts +++ b/src/functions/summarize.ts @@ -260,7 +260,6 @@ export function registerSummarizeFunction( return { success: false, error: "no_observations" }; } - // Unwrap resilient(...) wrapper to get the base provider name (#1020) const baseProviderName = provider.name.replace(/^resilient\((.+)\)$/, "$1"); if (baseProviderName === "noop") { logger.info("Summarize skipped — no LLM provider configured", {