From 032e40ff54c2d0645e80e7381741f5cc4697eccc Mon Sep 17 00:00:00 2001 From: Aishanee Shah Date: Wed, 18 Feb 2026 11:40:05 -0500 Subject: [PATCH] Update shell.ts Add exit_code before output or error to signal the model --- packages/core/src/tools/shell.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/core/src/tools/shell.ts b/packages/core/src/tools/shell.ts index c712276187..826370bffc 100644 --- a/packages/core/src/tools/shell.ts +++ b/packages/core/src/tools/shell.ts @@ -355,6 +355,10 @@ export class ShellToolInvocation extends BaseToolInvocation< // Create a formatted error string for display, replacing the wrapper command // with the user-facing command. + if (result.exitCode !== null) { + parts.push(`${result.exitCode}`); + } + const output = result.output || '(empty)'; const parts = [``]; if (result.error) { @@ -365,10 +369,6 @@ export class ShellToolInvocation extends BaseToolInvocation< parts.push(``); } - if (result.exitCode !== null) { - parts.push(`${result.exitCode}`); - } - if (result.signal) { parts.push(`${result.signal}`); }