mirror of
https://github.com/simstudioai/sim.git
synced 2026-09-24 15:45:35 +08:00
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
This commit is contained in:
@@ -187,7 +187,8 @@ export class BlockExecutor {
|
||||
}
|
||||
}
|
||||
|
||||
this.state.setBlockOutput(node.id, normalizedOutput, duration)
|
||||
const { childTraceSpans: _traces, ...outputForState } = normalizedOutput
|
||||
this.state.setBlockOutput(node.id, outputForState as NormalizedBlockOutput, duration)
|
||||
|
||||
if (!isSentinel && blockLog) {
|
||||
const childWorkflowInstanceId =
|
||||
@@ -211,7 +212,7 @@ export class BlockExecutor {
|
||||
)
|
||||
}
|
||||
|
||||
return normalizedOutput
|
||||
return outputForState as NormalizedBlockOutput
|
||||
} catch (error) {
|
||||
return await this.handleBlockError(
|
||||
error,
|
||||
@@ -270,7 +271,6 @@ export class BlockExecutor {
|
||||
}
|
||||
|
||||
if (ChildWorkflowError.isChildWorkflowError(error)) {
|
||||
errorOutput.childTraceSpans = error.childTraceSpans
|
||||
errorOutput.childWorkflowName = error.childWorkflowName
|
||||
if (error.childWorkflowSnapshotId) {
|
||||
errorOutput.childWorkflowSnapshotId = error.childWorkflowSnapshotId
|
||||
@@ -287,8 +287,8 @@ export class BlockExecutor {
|
||||
blockLog.input = this.sanitizeInputsForLog(input)
|
||||
blockLog.output = filterOutputForLog(block.metadata?.id || '', errorOutput, { block })
|
||||
|
||||
if (errorOutput.childTraceSpans && Array.isArray(errorOutput.childTraceSpans)) {
|
||||
blockLog.childTraceSpans = errorOutput.childTraceSpans
|
||||
if (ChildWorkflowError.isChildWorkflowError(error) && error.childTraceSpans.length > 0) {
|
||||
blockLog.childTraceSpans = error.childTraceSpans
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user