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