mirror of
https://github.com/simstudioai/sim.git
synced 2026-09-24 15:45:35 +08:00
fix(logs): make child workflow span errors the same as root level workflow errors (#1092)
This commit is contained in:
@@ -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) => {
|
||||
|
||||
Reference in New Issue
Block a user