fix(logs): make child workflow span errors the same as root level workflow errors (#1092)

This commit is contained in:
Waleed Latif
2025-08-21 21:17:09 -07:00
committed by GitHub
parent 77b0c5b9ed
commit f0643e01b4
2 changed files with 40 additions and 2 deletions
+32
View File
@@ -455,6 +455,14 @@ export class Executor {
success: false,
output: finalOutput,
error: 'Workflow execution was cancelled',
metadata: {
duration: Date.now() - startTime.getTime(),
startTime: context.metadata.startTime!,
workflowConnections: this.actualWorkflow.connections.map((conn: any) => ({
source: conn.source,
target: conn.target,
})),
},
logs: context.blockLogs,
}
}
@@ -503,6 +511,14 @@ export class Executor {
success: false,
output: finalOutput,
error: this.extractErrorMessage(error),
metadata: {
duration: Date.now() - startTime.getTime(),
startTime: context.metadata.startTime!,
workflowConnections: this.actualWorkflow.connections.map((conn: any) => ({
source: conn.source,
target: conn.target,
})),
},
logs: context.blockLogs,
}
} finally {
@@ -530,6 +546,14 @@ export class Executor {
success: false,
output: finalOutput,
error: 'Workflow execution was cancelled',
metadata: {
duration: Date.now() - new Date(context.metadata.startTime!).getTime(),
startTime: context.metadata.startTime!,
workflowConnections: this.actualWorkflow.connections.map((conn: any) => ({
source: conn.source,
target: conn.target,
})),
},
logs: context.blockLogs,
}
}
@@ -596,6 +620,14 @@ export class Executor {
success: false,
output: finalOutput,
error: this.extractErrorMessage(error),
metadata: {
duration: Date.now() - new Date(context.metadata.startTime!).getTime(),
startTime: context.metadata.startTime!,
workflowConnections: this.actualWorkflow.connections.map((conn: any) => ({
source: conn.source,
target: conn.target,
})),
},
logs: context.blockLogs,
}
}
@@ -119,7 +119,10 @@ export function buildTraceSpans(result: ExecutionResult): {
const flatChildSpans: TraceSpan[] = []
childTraceSpans.forEach((childSpan) => {
// Skip the synthetic workflow span wrapper - we only want the actual block executions
if (childSpan.type === 'workflow' && childSpan.name === 'Workflow Execution') {
if (
childSpan.type === 'workflow' &&
(childSpan.name === 'Workflow Execution' || childSpan.name.endsWith(' workflow'))
) {
// Add its children directly, skipping the synthetic wrapper
if (childSpan.children && Array.isArray(childSpan.children)) {
flatChildSpans.push(...childSpan.children)
@@ -401,7 +404,10 @@ function ensureNestedWorkflowsProcessed(span: TraceSpan): TraceSpan {
childTraceSpans.forEach((childSpan) => {
// Skip synthetic workflow wrappers and get the actual blocks
if (childSpan.type === 'workflow' && childSpan.name === 'Workflow Execution') {
if (
childSpan.type === 'workflow' &&
(childSpan.name === 'Workflow Execution' || childSpan.name.endsWith(' workflow'))
) {
if (childSpan.children && Array.isArray(childSpan.children)) {
// Recursively process each child to handle deeper nesting
childSpan.children.forEach((grandchildSpan) => {