fix(env-vars): refactor for workspace/personal env vars to work with server side execution correctly (#2197)

* fix(env-var-resolution): new executor env var resolution changes

* add sessionuser id"

* cleanup code

* add doc update

* fix build

* fix client session pass through"

* add type change

* fix env var with hitl

* fix types
This commit is contained in:
Vikhyath Mondreti
2025-12-04 21:08:20 -08:00
committed by GitHub
parent ca818a6503
commit 8ef9a45125
18 changed files with 479 additions and 619 deletions

View File

@@ -208,8 +208,10 @@ async function runWorkflowExecution({
const mergedStates = mergeSubblockState(blocks)
const personalEnvUserId = workflowRecord.userId
const { personalEncrypted, workspaceEncrypted } = await getPersonalAndWorkspaceEnv(
actorUserId,
personalEnvUserId,
workflowRecord.workspaceId || undefined
)
@@ -239,17 +241,19 @@ async function runWorkflowExecution({
workflowId: payload.workflowId,
workspaceId: workflowRecord.workspaceId || '',
userId: actorUserId,
sessionUserId: undefined,
workflowUserId: workflowRecord.userId,
triggerType: 'schedule',
triggerBlockId: payload.blockId || undefined,
useDraftState: false,
startTime: new Date().toISOString(),
isClientSession: false,
}
const snapshot = new ExecutionSnapshot(
metadata,
workflowRecord,
input,
{},
workflowRecord.variables || {},
[]
)

View File

@@ -222,17 +222,19 @@ async function executeWebhookJobInternal(
workflowId: payload.workflowId,
workspaceId,
userId: payload.userId,
sessionUserId: undefined,
workflowUserId: workflow.userId,
triggerType: payload.provider || 'webhook',
triggerBlockId: payload.blockId,
useDraftState: false,
startTime: new Date().toISOString(),
isClientSession: false,
}
const snapshot = new ExecutionSnapshot(
metadata,
workflow,
airtableInput,
{},
workflowVariables,
[]
)
@@ -435,20 +437,16 @@ async function executeWebhookJobInternal(
workflowId: payload.workflowId,
workspaceId,
userId: payload.userId,
sessionUserId: undefined,
workflowUserId: workflow.userId,
triggerType: payload.provider || 'webhook',
triggerBlockId: payload.blockId,
useDraftState: false,
startTime: new Date().toISOString(),
isClientSession: false,
}
const snapshot = new ExecutionSnapshot(
metadata,
workflow,
input || {},
{},
workflowVariables,
[]
)
const snapshot = new ExecutionSnapshot(metadata, workflow, input || {}, workflowVariables, [])
const executionResult = await executeWorkflowCore({
snapshot,

View File

@@ -74,16 +74,18 @@ export async function executeWorkflowJob(payload: WorkflowExecutionPayload) {
workflowId,
workspaceId,
userId: actorUserId,
sessionUserId: undefined,
workflowUserId: workflow.userId,
triggerType: payload.triggerType || 'api',
useDraftState: false,
startTime: new Date().toISOString(),
isClientSession: false,
}
const snapshot = new ExecutionSnapshot(
metadata,
workflow,
payload.input,
{},
workflow.variables || {},
[]
)