diff --git a/packages/core/src/services/shellExecutionService.test.ts b/packages/core/src/services/shellExecutionService.test.ts index 37ece77da29..87aecd9a6f0 100644 --- a/packages/core/src/services/shellExecutionService.test.ts +++ b/packages/core/src/services/shellExecutionService.test.ts @@ -444,6 +444,32 @@ describe('ShellExecutionService', () => { ); }); + it('suppresses parser diagnostics for malformed PTY output', async () => { + const consoleErrorSpy = vi + .spyOn(console, 'error') + .mockImplementation(() => {}); + + try { + const { result } = await simulateExecution( + 'malformed-output', + (pty) => { + pty.onData.mock.calls[0][0]('\u001b\xb0'); + pty.onData.mock.calls[0][0]('recovered'); + pty.onExit.mock.calls[0][0]({ exitCode: 0, signal: null }); + }, + ); + + expect( + consoleErrorSpy.mock.calls.some((args) => + args.some((arg) => String(arg).includes('Parsing error')), + ), + ).toBe(false); + expect(result.output).toContain('recovered'); + } finally { + consoleErrorSpy.mockRestore(); + } + }); + it('should correctly decode multi-byte characters split across chunks', async () => { const { result } = await simulateExecution('echo "你好"', (pty) => { const multiByteChar = '你好'; diff --git a/packages/core/src/services/shellExecutionService.ts b/packages/core/src/services/shellExecutionService.ts index 9a573c6b474..d2858b64bd5 100644 --- a/packages/core/src/services/shellExecutionService.ts +++ b/packages/core/src/services/shellExecutionService.ts @@ -395,6 +395,8 @@ const replayTerminalOutput = async ( rows, scrollback: 10000, convertEol: true, + // This headless terminal only captures output, so suppress parser diagnostics. + logLevel: 'off', }); try { @@ -1486,6 +1488,8 @@ export class ShellExecutionService { cols, rows, scrollback: MAX_LIVE_TERMINAL_SCROLLBACK_LINES, + // This headless terminal only captures output, so suppress parser diagnostics. + logLevel: 'off', }); headlessTerminal.scrollToTop();