From bf5ae2686dbc85a25ceaf679b06b2ee07a1c1385 Mon Sep 17 00:00:00 2001 From: "Tommy D. Rossi" Date: Thu, 26 Feb 2026 13:04:18 +0100 Subject: [PATCH] fix: suppress stack traces for timeout and abort errors in CLI/MCP output Timeout and abort error stack traces are internal noise (Promise.race, setTimeout, AbortController internals) that waste context window space for LLM agents and clutter CLI output. Now only error.message is shown to the user for these error types. Full stacks are still logged to the relay server log file for debugging. --- playwriter/src/executor.ts | 3 ++- playwriter/src/mcp.ts | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/playwriter/src/executor.ts b/playwriter/src/executor.ts index b5dd656..f950188 100644 --- a/playwriter/src/executor.ts +++ b/playwriter/src/executor.ts @@ -1138,7 +1138,8 @@ export class PlaywrightExecutor { return { text: finalText, images, isError: false } } catch (error: any) { const errorStack = error.stack || error.message - const isTimeoutError = error instanceof CodeExecutionTimeoutError || error.name === 'TimeoutError' + const isTimeoutError = + error instanceof CodeExecutionTimeoutError || error?.name === 'TimeoutError' || error?.name === 'AbortError' this.logger.error('Error in execute:', errorStack) diff --git a/playwriter/src/mcp.ts b/playwriter/src/mcp.ts index 867e417..e7b1832 100644 --- a/playwriter/src/mcp.ts +++ b/playwriter/src/mcp.ts @@ -218,7 +218,8 @@ server.tool( return { content } } catch (error: any) { const errorStack = error.stack || error.message - const isTimeoutError = error instanceof CodeExecutionTimeoutError || error.name === 'TimeoutError' + const isTimeoutError = + error instanceof CodeExecutionTimeoutError || error?.name === 'TimeoutError' || error?.name === 'AbortError' console.error('Error in execute tool:', errorStack) if (!isTimeoutError) {