diff --git a/packages/core/src/tools/shell.test.ts b/packages/core/src/tools/shell.test.ts index ad93ad873b..5f1bf1f534 100644 --- a/packages/core/src/tools/shell.test.ts +++ b/packages/core/src/tools/shell.test.ts @@ -687,13 +687,13 @@ describe('ShellTool', () => { expect(result.llmContent).not.toContain('Directory:'); }); - it('should not include Exit Code when command succeeds (exit code 0)', async () => { + it('should include Exit Code when command succeeds (exit code 0)', async () => { const invocation = shellTool.build({ command: 'echo hello' }); const promise = invocation.execute(mockAbortSignal); resolveShellExecution({ output: 'hello', exitCode: 0 }); const result = await promise; - expect(result.llmContent).not.toContain(''); + expect(result.llmContent).toContain('0'); }); it('should include Exit Code when command fails (non-zero exit code)', async () => { @@ -776,6 +776,7 @@ describe('ShellTool', () => { // Should only contain subprocess_result and output expect(result.llmContent).toContain(''); expect(result.llmContent).toContain('hello'); + expect(result.llmContent).toContain('0'); }); }); diff --git a/packages/core/src/tools/shell.ts b/packages/core/src/tools/shell.ts index 15ef55be8d..185c176593 100644 --- a/packages/core/src/tools/shell.ts +++ b/packages/core/src/tools/shell.ts @@ -365,7 +365,7 @@ export class ShellToolInvocation extends BaseToolInvocation< parts.push(`${finalError}`); } - if (result.exitCode !== null && result.exitCode !== 0) { + if (result.exitCode !== null) { parts.push(`${result.exitCode}`); }