@@ -4,6 +4,7 @@ import { createLogger } from '@sim/logger'
44import { toError } from '@sim/utils/errors'
55import { sleep } from '@sim/utils/helpers'
66import { and , eq , inArray , isNull } from 'drizzle-orm'
7+ import { normalizeStringRecord , normalizeWorkflowVariables } from '@/lib/core/utils/records'
78import { createMcpToolId } from '@/lib/mcp/utils'
89import { getCustomToolById } from '@/lib/workflows/custom-tools/operations'
910import { getAllBlocks } from '@/blocks'
@@ -815,8 +816,8 @@ export class AgentBlockHandler implements BlockHandler {
815816 userId : ctx . userId ,
816817 stream : streaming ,
817818 messages : messages ?. map ( ( { executionId, ...msg } ) => msg ) ,
818- environmentVariables : ctx . environmentVariables || { } ,
819- workflowVariables : ctx . workflowVariables || { } ,
819+ environmentVariables : normalizeStringRecord ( ctx . environmentVariables ) ,
820+ workflowVariables : normalizeWorkflowVariables ( ctx . workflowVariables ) ,
820821 blockData,
821822 blockNameMapping,
822823 reasoningEffort : inputs . reasoningEffort ,
@@ -885,8 +886,8 @@ export class AgentBlockHandler implements BlockHandler {
885886 userId : ctx . userId ,
886887 stream : providerRequest . stream ,
887888 messages : 'messages' in providerRequest ? providerRequest . messages : undefined ,
888- environmentVariables : ctx . environmentVariables || { } ,
889- workflowVariables : ctx . workflowVariables || { } ,
889+ environmentVariables : normalizeStringRecord ( ctx . environmentVariables ) ,
890+ workflowVariables : normalizeWorkflowVariables ( ctx . workflowVariables ) ,
890891 blockData,
891892 blockNameMapping,
892893 isDeployedContext : ctx . isDeployedContext ,
0 commit comments