Skip to content

Commit 1c179d4

Browse files
committed
fix: improve config field filtering in workflow executor
1 parent 0fb4c10 commit 1c179d4

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

lib/workflow-executor.workflow.ts

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
preValidateConditionExpression,
88
validateConditionExpression,
99
} from "@/lib/condition-validator";
10+
import { findActionById, flattenConfigFields } from "@/plugins/registry";
1011
import {
1112
getActionLabel,
1213
getStepImporter,
@@ -222,6 +223,7 @@ async function executeActionStep(input: {
222223
}) {
223224
const { actionType, config, outputs, context } = input;
224225

226+
// Config is already filtered before this function is called
225227
// Build step input WITHOUT credentials, but WITH integrationId reference and logging context
226228
const stepInput: Record<string, unknown> = {
227229
...config,
@@ -539,9 +541,27 @@ export async function executeWorkflow(input: WorkflowExecutionInput) {
539541
return;
540542
}
541543

544+
// Filter config to only include fields defined in the action's configFields
545+
// This must happen BEFORE processTemplates to prevent extra fields from being processed
546+
let filteredConfig = config;
547+
const action = findActionById(actionType);
548+
if (action) {
549+
const validKeys = new Set(
550+
flattenConfigFields(action.configFields).map((field) => field.key)
551+
);
552+
// Always include integrationId and actionType
553+
validKeys.add("integrationId");
554+
validKeys.add("actionType");
555+
validKeys.add("condition"); // Keep condition for special handling
556+
557+
filteredConfig = Object.fromEntries(
558+
Object.entries(config).filter(([key]) => validKeys.has(key))
559+
);
560+
}
561+
542562
// Process templates in config, but keep condition unprocessed for special handling
543-
const configWithoutCondition = { ...config };
544-
const originalCondition = config.condition;
563+
const configWithoutCondition = { ...filteredConfig };
564+
const originalCondition = filteredConfig.condition;
545565
configWithoutCondition.condition = undefined;
546566

547567
const processedConfig = processTemplates(

0 commit comments

Comments
 (0)