Skip to content

A self-improving RLM agent for coding workflows and long-running autonomous tasks.

Rust

fix(coding-agent): tighten adjacent tool spacing (#544)

Sebastian Müller115f7a2fa08c
diff --git a/packages/coding-agent/src/modes/interactive/components/assistant-message.ts b/packages/coding-agent/src/modes/interactive/components/assistant-message.ts
index 0e14c82834..9a40769790 100644
--- a/packages/coding-agent/src/modes/interactive/components/assistant-message.ts
+++ b/packages/coding-agent/src/modes/interactive/components/assistant-message.ts
@@ -16,6 +16,7 @@ const LOGIN_RECOVERY_SUFFIX = `\n\n${LOGIN_RECOVERY_MESSAGE}`;
export interface AssistantMessageComponentOptions {
expanded?: boolean;
+ precededByToolActivity?: boolean;
}
function getThinkingMarkdownTheme(baseTheme: MarkdownTheme): MarkdownTheme {
@@ -68,6 +69,7 @@ export class AssistantMessageComponent extends Container {
private lastSignature?: string;
private blockMarkdowns = new Map<number, Markdown>();
private lastBlockTexts = new Map<number, string>();
+ private precededByToolActivity: boolean;
constructor(
message?: AssistantMessage,
@@ -82,6 +84,7 @@ export class AssistantMessageComponent extends Container {
this.markdownTheme = markdownTheme;
this.hiddenThinkingLabel = hiddenThinkingLabel;
this.expanded = options.expanded ?? false;
+ this.precededByToolActivity = options.precededByToolActivity ?? false;
// Container for text/thinking content
this.contentContainer = new Container();
@@ -265,7 +268,7 @@ export class AssistantMessageComponent extends Container {
this.contentContainer.addChild(this.createErrorComponent(errorMsg, "Error"));
}
- if (hasToolCalls) {
+ if (hasToolCalls && (hasVisibleContent || message.stopReason === "aborted" || !this.precededByToolActivity)) {
this.contentContainer.addChild(new Spacer(1));
}
}
diff --git a/packages/coding-agent/src/modes/interactive/components/conversation-components.ts b/packages/coding-agent/src/modes/interactive/components/conversation-components.ts
index de40150a38..1c60d83c86 100644
--- a/packages/coding-agent/src/modes/interactive/components/conversation-components.ts
+++ b/packages/coding-agent/src/modes/interactive/components/conversation-components.ts
@@ -52,7 +52,10 @@ export function buildConversationComponents(
options.hideThinkingBlock ?? false,
options.markdownTheme,
options.hiddenThinkingLabel ?? "Thinking...",
- { expanded },
+ {
+ expanded,
+ precededByToolActivity: components.at(-1) instanceof ToolExecutionComponent,
+ },
),
);
for (const content of message.content) {
diff --git a/packages/coding-agent/src/modes/interactive/interactive-mode.ts b/packages/coding-agent/src/modes/interactive/interactive-mode.ts
index 3b629608ad..6dc28f1c3a 100644
--- a/packages/coding-agent/src/modes/interactive/interactive-mode.ts
+++ b/packages/coding-agent/src/modes/interactive/interactive-mode.ts
@@ -5392,7 +5392,10 @@ export class InteractiveMode {
this.hideThinkingBlock,
this.getMarkdownThemeWithSettings(),
this.hiddenThinkingLabel,
- { expanded: this.toolOutputExpanded },
+ {
+ expanded: this.toolOutputExpanded,
+ precededByToolActivity: this.chatContainer.children.at(-1) instanceof ToolExecutionComponent,
+ },
);
this.streamingMessage = message;
this.chatContainer.addChild(this.streamingComponent);
@@ -6251,7 +6254,10 @@ export class InteractiveMode {
this.hideThinkingBlock,
this.getMarkdownThemeWithSettings(),
this.hiddenThinkingLabel,
- { expanded: this.toolOutputExpanded },
+ {
+ expanded: this.toolOutputExpanded,
+ precededByToolActivity: this.chatContainer.children.at(-1) instanceof ToolExecutionComponent,
+ },
);
this.chatContainer.addChild(assistantComponent);
break;