Skip to content

Commit 839ad2f

Browse files
committed
fix(executor): strip childTraceSpans from block state before LLM tool calls
1 parent 4c86122 commit 839ad2f

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,8 @@ export class BlockExecutor {
187187
}
188188
}
189189

190-
this.state.setBlockOutput(node.id, normalizedOutput, duration)
190+
const { childTraceSpans: _traces, ...outputForState } = normalizedOutput
191+
this.state.setBlockOutput(node.id, outputForState as NormalizedBlockOutput, duration)
191192

192193
if (!isSentinel && blockLog) {
193194
const childWorkflowInstanceId =
@@ -270,7 +271,6 @@ export class BlockExecutor {
270271
}
271272

272273
if (ChildWorkflowError.isChildWorkflowError(error)) {
273-
errorOutput.childTraceSpans = error.childTraceSpans
274274
errorOutput.childWorkflowName = error.childWorkflowName
275275
if (error.childWorkflowSnapshotId) {
276276
errorOutput.childWorkflowSnapshotId = error.childWorkflowSnapshotId
@@ -287,8 +287,8 @@ export class BlockExecutor {
287287
blockLog.input = this.sanitizeInputsForLog(input)
288288
blockLog.output = filterOutputForLog(block.metadata?.id || '', errorOutput, { block })
289289

290-
if (errorOutput.childTraceSpans && Array.isArray(errorOutput.childTraceSpans)) {
291-
blockLog.childTraceSpans = errorOutput.childTraceSpans
290+
if (ChildWorkflowError.isChildWorkflowError(error) && error.childTraceSpans.length > 0) {
291+
blockLog.childTraceSpans = error.childTraceSpans
292292
}
293293
}
294294

0 commit comments

Comments
 (0)