Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions src/browser/utils/messages/StreamingMessageAggregator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,16 @@ function hasSuccessResult(result: unknown): boolean {
}

/**
* Check if a tool result indicates failure (for tools that return { success: boolean })
* Check if a tool result indicates failure.
* Handles both explicit failure ({ success: false }) and implicit failure ({ error: "..." })
*/
function hasFailureResult(result: unknown): boolean {
return (
typeof result === "object" && result !== null && "success" in result && result.success === false
);
if (typeof result !== "object" || result === null) return false;
// Explicit failure
if ("success" in result && result.success === false) return true;
// Implicit failure - error field present
if ("error" in result && result.error) return true;
return false;
}

export class StreamingMessageAggregator {
Expand Down
1 change: 1 addition & 0 deletions src/node/services/streamManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -938,6 +938,7 @@ export class StreamManager extends EventEmitter {

// Format error output
const errorOutput = {
success: false,
error:
typeof toolErrorPart.error === "string"
? toolErrorPart.error
Expand Down