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.
This commit is contained in:
@@ -1138,7 +1138,8 @@ export class PlaywrightExecutor {
|
|||||||
return { text: finalText, images, isError: false }
|
return { text: finalText, images, isError: false }
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
const errorStack = error.stack || error.message
|
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)
|
this.logger.error('Error in execute:', errorStack)
|
||||||
|
|
||||||
|
|||||||
@@ -218,7 +218,8 @@ server.tool(
|
|||||||
return { content }
|
return { content }
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
const errorStack = error.stack || error.message
|
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)
|
console.error('Error in execute tool:', errorStack)
|
||||||
if (!isTimeoutError) {
|
if (!isTimeoutError) {
|
||||||
|
|||||||
Reference in New Issue
Block a user