Skip to content

ToolExecutionComponent with renderShell:self leaves a blank line even when renderer returns empty #5299

@66RED99

Description

@66RED99

What happened?

When an extension registers a tool with renderShell: "self" and returns a zero-height component (e.g. new Text("", 0, 0)) from both renderCall and renderResult, the tool row still renders as one blank line instead of disappearing.

The blank line comes from the unconditional new Spacer(1) in the ToolExecutionComponent constructor. The hideComponent flag would suppress it, but that flag is only set when hasContent === false — which is impossible when any renderer is defined, because hasContent = true is set unconditionally after the renderer callback returns, regardless of what the callback emits.

Steps to reproduce

Register any tool with renderShell: "self" where both renderCall and renderResult return new Text("", 0, 0). Run the agent. Each tool call leaves one blank line in the chat even though the renderer emits nothing.

Expected behavior

A tool whose renderer emits no visible content should take no layout space.

Fix (happy to submit a PR once approved)

In ToolExecutionComponent.render(), after super.render(), return [] if every line is an empty string:

const lines = super.render(width);
if (lines.length > 0 && lines.every((l) => l === "")) return [];
return lines;

This only fires when the renderer deliberately emits nothing, so existing behaviour is unaffected.

Version: 0.78.0

Metadata

Metadata

Assignees

Labels

inprogressIssue is being worked on

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions