mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 00:18:26 +00:00
fix: show tool error fallback for tool-only replies
This commit is contained in:
@@ -169,7 +169,16 @@ export function buildEmbeddedRunPayloads(params: {
|
||||
}
|
||||
|
||||
if (params.lastToolError) {
|
||||
const hasUserFacingReply = replyItems.length > 0;
|
||||
const lastAssistantHasToolCalls =
|
||||
Array.isArray(params.lastAssistant?.content) &&
|
||||
params.lastAssistant?.content.some((block) =>
|
||||
block && typeof block === "object"
|
||||
? (block as { type?: unknown }).type === "toolCall"
|
||||
: false,
|
||||
);
|
||||
const lastAssistantWasToolUse = params.lastAssistant?.stopReason === "toolUse";
|
||||
const hasUserFacingReply =
|
||||
replyItems.length > 0 && !lastAssistantHasToolCalls && !lastAssistantWasToolUse;
|
||||
// Check if this is a recoverable/internal tool error that shouldn't be shown to users
|
||||
// when there's already a user-facing reply (the model should have retried).
|
||||
const errorLower = (params.lastToolError.error ?? "").toLowerCase();
|
||||
|
||||
Reference in New Issue
Block a user