@@ -164,63 +164,91 @@ describe("ui/conversation", () => {
164164 expect(lines.join("\n")).not.toContain('"command"');
165165 });
166166
167- test("shell tool results render structured stdout/stderr details and keep exit code visible in preview", () => {
167+ test("shell tool results render structured stdout/stderr details without stderr labels or error styling", () => {
168168 const stdout = Array.from(
169169 { length: 12 },
170170 (_, index) => `line ${index + 1}`,
171171 ).join("\n");
172- const lines = collectRenderedLines(
173- renderToolResult(
174- "shell",
175- { command: "run-tests" },
176- "Exit code: 1\nlegacy text should be ignored when details exist",
177- true,
178- {
179- showReasoning: true,
180- verbose: false,
181- theme: DEFAULT_THEME,
182- cwd: "/tmp/project",
183- previewWidth: 48,
184- },
185- {
186- stdout,
187- stderr: "boom",
188- exitCode: 1,
189- },
190- ),
172+ const node = renderToolResult(
173+ "shell",
174+ { command: "run-tests" },
175+ "Exit code: 1\nlegacy text should be ignored when details exist",
176+ true,
177+ {
178+ showReasoning: true,
179+ verbose: false,
180+ theme: DEFAULT_THEME,
181+ cwd: "/tmp/project",
182+ previewWidth: 48,
183+ },
184+ {
185+ stdout,
186+ stderr: "boom",
187+ exitCode: 1,
188+ },
191189 );
190+ const lines = collectRenderedLines(node);
191+ const textNodes = collectTextNodes(node);
192192
193193 expect(lines).toContain("│ shell <-");
194- expect(lines).toContain("│ stderr:");
195194 expect(lines).toContain("│ boom");
196195 expect(lines).toContain("│ exit 1");
197- expect(lines).toContain("│ And 7 lines more");
196+ expect(lines).toContain("│ And 6 lines more");
197+ expect(lines.join("\n")).not.toContain("stderr:");
198198 expect(lines.join("\n")).not.toContain("legacy text should be ignored");
199+ expect(
200+ textNodes.some(
201+ (textNode) =>
202+ textNode.content === "boom" &&
203+ textNode.props.fgColor === DEFAULT_THEME.toolText,
204+ ),
205+ ).toBe(true);
206+ expect(
207+ textNodes.some(
208+ (textNode) =>
209+ textNode.content === "exit 1" &&
210+ textNode.props.fgColor === DEFAULT_THEME.toolText,
211+ ),
212+ ).toBe(true);
199213 });
200214
201- test("shell tool results still render legacy flattened results from persisted history", () => {
202- const lines = collectRenderedLines(
203- renderToolResult(
204- "shell",
205- { command: "run-tests" },
206- "Exit code: 1\nout\n\n[stderr]\nerr",
207- true,
208- {
209- showReasoning: true,
210- verbose: true,
211- theme: DEFAULT_THEME,
212- cwd: "/tmp/project",
213- previewWidth: 80,
214- },
215- ),
215+ test("shell tool results still render legacy flattened results from persisted history without stderr labels", () => {
216+ const node = renderToolResult(
217+ "shell",
218+ { command: "run-tests" },
219+ "Exit code: 1\nout\n\n[stderr]\nerr",
220+ true,
221+ {
222+ showReasoning: true,
223+ verbose: true,
224+ theme: DEFAULT_THEME,
225+ cwd: "/tmp/project",
226+ previewWidth: 80,
227+ },
216228 );
229+ const lines = collectRenderedLines(node);
230+ const textNodes = collectTextNodes(node);
217231
218232 expect(lines).toContain("│ out");
219- expect(lines).toContain("│ stderr:");
220233 expect(lines).toContain("│ err");
221234 expect(lines).toContain("│ exit 1");
235+ expect(lines.join("\n")).not.toContain("stderr:");
222236 expect(lines.join("\n")).not.toContain("[stderr]");
223237 expect(lines.join("\n")).not.toContain("Exit code:");
238+ expect(
239+ textNodes.some(
240+ (textNode) =>
241+ textNode.content === "err" &&
242+ textNode.props.fgColor === DEFAULT_THEME.toolText,
243+ ),
244+ ).toBe(true);
245+ expect(
246+ textNodes.some(
247+ (textNode) =>
248+ textNode.content === "exit 1" &&
249+ textNode.props.fgColor === DEFAULT_THEME.toolText,
250+ ),
251+ ).toBe(true);
224252 });
225253
226254 test("read tool results include the resolved path, hide model paging hints, and render fewer body lines when verbose is off", () => {