From 21c3d6993bf2a6adae078b397a4d8b5707512fdb Mon Sep 17 00:00:00 2001 From: Vincent Koc Date: Thu, 4 Jun 2026 08:32:58 +0200 Subject: [PATCH] fix(e2e): tighten kitchen sink error log allowlist --- scripts/e2e/kitchen-sink-rpc-walk.mjs | 6 +++--- test/scripts/kitchen-sink-rpc-walk.test.ts | 17 +++++++++++++++++ 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/scripts/e2e/kitchen-sink-rpc-walk.mjs b/scripts/e2e/kitchen-sink-rpc-walk.mjs index d683548684e9..563de9db557a 100644 --- a/scripts/e2e/kitchen-sink-rpc-walk.mjs +++ b/scripts/e2e/kitchen-sink-rpc-walk.mjs @@ -57,9 +57,9 @@ const ERROR_LOG_DENY_PATTERNS = [ /\[(?:error|ERROR)\]/u, ]; const ERROR_LOG_ALLOW_PATTERNS = [ - /0 errors?/iu, - /expected no diagnostics errors?/iu, - /diagnostics errors?:\s*$/iu, + /^\s*0 errors?\s*$/iu, + /^\s*expected no diagnostics errors?\s*$/iu, + /^\s*diagnostics errors?:\s*$/iu, ]; let callGatewayModulePromise; diff --git a/test/scripts/kitchen-sink-rpc-walk.test.ts b/test/scripts/kitchen-sink-rpc-walk.test.ts index 1a21131ef188..d7c8b6b39f18 100644 --- a/test/scripts/kitchen-sink-rpc-walk.test.ts +++ b/test/scripts/kitchen-sink-rpc-walk.test.ts @@ -368,6 +368,23 @@ describe("kitchen-sink RPC gateway readiness logs", () => { } }); + it("does not allowlist dirty error lines that mention zero errors", () => { + const root = mkdtempSync(path.join(tmpdir(), "openclaw-kitchen-rpc-log-zero-error-smuggle-")); + try { + const logPath = path.join(root, "gateway.log"); + writeFileSync(logPath, "[ERROR] 0 errors reported but fatal state remained\n"); + + expect(findErrorLogFindings(logPath)).toEqual([ + { + line: "[ERROR] 0 errors reported but fatal state remained", + lineNumber: 1, + }, + ]); + } finally { + rmSync(root, { recursive: true, force: true }); + } + }); + it("bounds scanner memory for very long log lines", () => { const root = mkdtempSync(path.join(tmpdir(), "openclaw-kitchen-rpc-log-long-line-")); try {