Skip to content

Commit 4879a93

Browse files
committed
fix(child-workflow): must bypass hiddenFromDisplay config
1 parent 78410ee commit 4879a93

3 files changed

Lines changed: 42 additions & 13 deletions

File tree

apps/sim/executor/execution/block-executor.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,12 @@ export class BlockExecutor {
152152
blockLog.durationMs = duration
153153
blockLog.success = true
154154
blockLog.output = filterOutputForLog(block.metadata?.id || '', normalizedOutput, { block })
155+
156+
// Extract childTraceSpans for nested workflow execution
157+
// Store separately to keep output clean for display while preserving for trace processing
158+
if (normalizedOutput.childTraceSpans && Array.isArray(normalizedOutput.childTraceSpans)) {
159+
blockLog.childTraceSpans = normalizedOutput.childTraceSpans
160+
}
155161
}
156162

157163
this.state.setBlockOutput(node.id, normalizedOutput, duration)
@@ -245,6 +251,12 @@ export class BlockExecutor {
245251
blockLog.error = errorMessage
246252
blockLog.input = this.sanitizeInputsForLog(input)
247253
blockLog.output = filterOutputForLog(block.metadata?.id || '', errorOutput, { block })
254+
255+
// Extract childTraceSpans for nested workflow execution errors
256+
// Store separately to keep output clean for display while preserving for trace processing
257+
if (errorOutput.childTraceSpans && Array.isArray(errorOutput.childTraceSpans)) {
258+
blockLog.childTraceSpans = errorOutput.childTraceSpans
259+
}
248260
}
249261

250262
logger.error(

apps/sim/executor/types.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,12 @@ export interface BlockLog {
114114
loopId?: string
115115
parallelId?: string
116116
iterationIndex?: number
117+
/**
118+
* Child workflow trace spans for nested workflow execution.
119+
* Stored separately from output to keep output clean for display
120+
* while preserving data for trace-spans processing.
121+
*/
122+
childTraceSpans?: TraceSpan[]
117123
}
118124

119125
export interface ExecutionMetadata {

apps/sim/lib/logs/execution/trace-spans/trace-spans.ts

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -318,19 +318,30 @@ export function buildTraceSpans(result: ExecutionResult): {
318318
}
319319
}
320320

321-
if (
322-
isWorkflowBlockType(log.blockType) &&
323-
log.output?.childTraceSpans &&
324-
Array.isArray(log.output.childTraceSpans)
325-
) {
326-
const childTraceSpans = log.output.childTraceSpans as TraceSpan[]
327-
const flattenedChildren = flattenWorkflowChildren(childTraceSpans)
328-
span.children = mergeTraceSpanChildren(span.children || [], flattenedChildren)
329-
330-
const { childTraceSpans: _, ...cleanOutput } = span.output as {
331-
childTraceSpans?: TraceSpan[]
332-
} & Record<string, unknown>
333-
span.output = cleanOutput
321+
// Handle child workflow trace spans - check both log.childTraceSpans (preferred)
322+
// and log.output.childTraceSpans (backward compatibility)
323+
if (isWorkflowBlockType(log.blockType)) {
324+
const childTraceSpansFromLog = (log as { childTraceSpans?: TraceSpan[] }).childTraceSpans
325+
const childTraceSpansFromOutput = log.output?.childTraceSpans
326+
327+
const childTraceSpans = Array.isArray(childTraceSpansFromLog)
328+
? childTraceSpansFromLog
329+
: Array.isArray(childTraceSpansFromOutput)
330+
? (childTraceSpansFromOutput as TraceSpan[])
331+
: null
332+
333+
if (childTraceSpans) {
334+
const flattenedChildren = flattenWorkflowChildren(childTraceSpans)
335+
span.children = mergeTraceSpanChildren(span.children || [], flattenedChildren)
336+
337+
// Clean childTraceSpans from output if present
338+
if (span.output && typeof span.output === 'object' && 'childTraceSpans' in span.output) {
339+
const { childTraceSpans: _, ...cleanOutput } = span.output as {
340+
childTraceSpans?: TraceSpan[]
341+
} & Record<string, unknown>
342+
span.output = cleanOutput
343+
}
344+
}
334345
}
335346

336347
spanMap.set(spanId, span)

0 commit comments

Comments
 (0)