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); } });