From 87ee6a52fae121f4c445852f58a6ab54b6be12a5 Mon Sep 17 00:00:00 2001 From: Brooklyn Nicholson Date: Sun, 26 Jul 2026 02:23:25 -0500 Subject: [PATCH] fix(desktop): count output_preview as command output MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The nonzero-exit guard already knew a failing exit code with real output usually isn't a failure worth painting red. It only looked at output / stdout / stderr, but background-process polls report their text under output_preview — so a poll of any process that exited nonzero rendered destructive-red with no error to show, even when the output was routine npm chatter. Half the red process rows in a real session history were this case. --- .../src/components/assistant-ui/tool/fallback-model/index.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/desktop/src/components/assistant-ui/tool/fallback-model/index.ts b/apps/desktop/src/components/assistant-ui/tool/fallback-model/index.ts index a718358efee3..5c6fd8c9b034 100644 --- a/apps/desktop/src/components/assistant-ui/tool/fallback-model/index.ts +++ b/apps/desktop/src/components/assistant-ui/tool/fallback-model/index.ts @@ -676,10 +676,12 @@ function toolErrorText(part: ToolPart, result: Record): string // stage's code, etc. — all routinely produce useful output and aren't // failures. Only treat it as an error when the command produced no real // output to show; otherwise render the output normally (not red). + // `output_preview` counts as output: background-process polls report their + // text under that name, so omitting it painted healthy `process` rows red. const exit = numberValue(result.exit_code) if (exit !== null && exit !== 0) { - const hasOutput = Boolean(firstStringField(result, ['output', 'stdout', 'stderr'])?.trim()) + const hasOutput = Boolean(firstStringField(result, ['output', 'stdout', 'stderr', 'output_preview'])?.trim()) return hasOutput ? '' : `Command failed with exit code ${exit}.` }