#6819: fix(tui): handle unstructured tool results and errors in tool execution output
Cluster:
TUI and Tool Execution Fixes
This PR fixes a bug where the TUI displays no output when a tool returns an error or unstructured result (e.g., from a failed browser action or connection error).
It updates [extractText](cci:1://file:///C:/Users/chenx/AppData/Roaming/npm/node_modules/openclaw/dist/tui/components/tool-execution.js:20:0-58:1) in [src/tui/components/tool-execution.ts](cci:7://file:///C:/Users/chenx/.gemini/antigravity/scratch/openclaw/src/tui/components/tool-execution.ts:0:0-0:0) to:
- Check for `result.error` string.
- Check for `result.message` string.
- Check for `result.details.status` string.
- Fallback to `JSON.stringify(result)` if no structured content is available.
This ensures that error messages are visible to the user instead of a blank output block.
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
Updates the TUI tool-execution output rendering to be more resilient when tool results are missing structured `content`. `extractText` now handles unstructured results and common error shapes (`error`, `message`, `details.status`) and falls back to stringifying the raw object so users see something instead of a blank output block.
This fits into the existing `ToolExecutionComponent.refresh()` flow, which derives the text to show from `extractText(this.result)` and then applies preview/expanded behavior for the markdown output.
<h3>Confidence Score: 4/5</h3>
- This PR is safe to merge with low risk; it’s a localized fallback improvement to tool result rendering.
- Change is confined to `extractText` and adds defensive fallbacks without altering the surrounding rendering logic. Main concern is minor maintainability/type-safety due to an `any` cast on `details.status` and the possibility of very verbose JSON output for large objects.
- src/tui/components/tool-execution.ts
<!-- greptile_other_comments_section -->
<sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub>
**Context used:**
- Context from `dashboard` - CLAUDE.md ([source](https://app.greptile.com/review/custom-context?memory=fd949e91-5c3a-4ab5-90a1-cbe184fd6ce8))
- Context from `dashboard` - AGENTS.md ([source](https://app.greptile.com/review/custom-context?memory=0d0c8278-ef8e-4d6c-ab21-f5527e322f13))
<!-- /greptile_comment -->
Most Similar PRs
#6502: fix(tui): skip empty text for tool-only assistant turns
by douvy · 2026-02-01
81.9%
#4269: fix: support tool result image format in Control UI
by bobcyw · 2026-01-30
81.3%
#12079: TUI: improve thinking UX, tool readability, and live running status...
by rubenfb23 · 2026-02-08
80.2%
#12974: fix: intermittent (no output) reported by users
by vincentkoc · 2026-02-10
80.0%
#9248: Fix: Webchat UI goes grey/unresponsive after Slack message tool calls
by vishaltandale00 · 2026-02-05
79.9%
#16733: fix(ui): avoid injected newlines when tool output is hidden
by jp117 · 2026-02-15
78.8%
#2805: fix: wire onToolResult to dispatcher for verbose tool summaries
by LinghaoZhuang · 2026-01-27
78.4%
#8888: fix: increase tool result/error context limits
by joetomasone · 2026-02-04
78.3%
#8880: feat(ui): make URLs clickable in tool output
by jnvw · 2026-02-04
78.3%
#17647: fix: Display error messages instead of (no output) for non-Claude m...
by MisterGuy420 · 2026-02-16
78.2%