Skip to content

Commit 5d53847

Browse files
authored
fix(executor): strip childTraceSpans from block state before LLM tool calls (#4428)
* fix(executor): strip childTraceSpans from block state before LLM tool calls * fix(executor): return stripped output so orchestrator setBlockOutput stays clean
1 parent af8dfbd commit 5d53847

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

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

Lines changed: 5 additions & 5 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 =
@@ -211,7 +212,7 @@ export class BlockExecutor {
211212
)
212213
}
213214

214-
return normalizedOutput
215+
return outputForState as NormalizedBlockOutput
215216
} catch (error) {
216217
return await this.handleBlockError(
217218
error,
@@ -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)