Fix aborted tool display when continuing sessions
Two fixes for rendering aborted tools in --continue mode: 1. In renderInitialMessages: Check if assistant message was aborted/errored and immediately mark tool execution components as failed instead of leaving them in pending state. 2. In AssistantMessageComponent: Don't show "Aborted" text when there are tool calls in the message, since the tool execution components will show the error state themselves. This prevents duplicate error messages. Now aborted tools show properly as red with "Operation aborted" message, without the duplicate "Aborted" text above them.
This commit is contained in:
@@ -49,11 +49,15 @@ export class AssistantMessageComponent extends Container {
|
||||
}
|
||||
|
||||
// Check if aborted - show after partial content
|
||||
if (message.stopReason === "aborted") {
|
||||
this.contentContainer.addChild(new Text(chalk.red("Aborted")));
|
||||
} else if (message.stopReason === "error") {
|
||||
const errorMsg = message.errorMessage || "Unknown error";
|
||||
this.contentContainer.addChild(new Text(chalk.red(`Error: ${errorMsg}`)));
|
||||
// But only if there are no tool calls (tool execution components will show the error)
|
||||
const hasToolCalls = message.content.some((c) => c.type === "toolCall");
|
||||
if (!hasToolCalls) {
|
||||
if (message.stopReason === "aborted") {
|
||||
this.contentContainer.addChild(new Text(chalk.red("Aborted")));
|
||||
} else if (message.stopReason === "error") {
|
||||
const errorMsg = message.errorMessage || "Unknown error";
|
||||
this.contentContainer.addChild(new Text(chalk.red(`Error: ${errorMsg}`)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user