From 96dbc49067bcfff72db6cda83d9c40a38bcffd0d Mon Sep 17 00:00:00 2001 From: Justin Massa Date: Tue, 20 Jan 2026 08:12:22 -0600 Subject: [PATCH] fix: filter ANSI log lines from agent stdout before sending to GChat MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The agent's debug logs (e.g., 'read anthropic credentials from claude cli keychain') were appearing in GChat messages because run-webhook.ts captures all stdout. Now filters out lines starting with ANSI escape codes before sending the response. 🐙 Clawdette --- src/googlechat/run-webhook.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/googlechat/run-webhook.ts b/src/googlechat/run-webhook.ts index 452ad8ba8..ad4641746 100644 --- a/src/googlechat/run-webhook.ts +++ b/src/googlechat/run-webhook.ts @@ -77,7 +77,14 @@ function runAgent(message: string, sessionId: string, callback: (err: Error | nu console.error(`[googlechat] Agent stderr: ${stderr}`); callback(new Error(`Agent exited with code ${code}: ${stderr}`), ""); } else { - callback(null, stdout.trim()); + // Filter out ANSI-coded log lines that leak from the agent + // These look like: [33m[subsystem][39m [36mmessage[39m + const filtered = stdout + .split('\n') + .filter(line => !line.match(/^\x1b\[\d+m\[/)) // Filter ANSI log lines + .join('\n') + .trim(); + callback(null, filtered); } });