Skip to content

Commit 0f293e8

Browse files
waleedlatif1claude
andcommitted
fix(execute-command): normalize both sides of variable name comparison, remove unused userId
Fix asymmetric normalization in resolveWorkflowVariables where the stored variable name was normalized but the reference name was only trimmed. This caused <variable.MyVar> to fail matching a variable named "MyVar". Applied the same fix to the function route which had the identical bug. Also removed unused userId field from the execute-command tool config request body — auth identity comes from checkInternalAuth, not the body. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 5dc31b5 commit 0f293e8

File tree

3 files changed

+2
-3
lines changed

3 files changed

+2
-3
lines changed

apps/sim/app/api/function/execute/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ function resolveWorkflowVariables(
366366
const variableName = match[1].trim()
367367

368368
const foundVariable = Object.entries(workflowVariables).find(
369-
([_, variable]) => normalizeName(variable.name || '') === variableName
369+
([_, variable]) => normalizeName(variable.name || '') === normalizeName(variableName)
370370
)
371371

372372
if (!foundVariable) {

apps/sim/app/api/tools/execute-command/run/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ function resolveWorkflowVariables(command: string, workflowVariables: Record<str
3131
while ((match = regex.exec(command)) !== null) {
3232
const variableName = match[1].trim()
3333
const foundVariable = Object.entries(workflowVariables).find(
34-
([_, variable]) => normalizeName(variable.name || '') === variableName
34+
([_, variable]) => normalizeName(variable.name || '') === normalizeName(variableName)
3535
)
3636

3737
if (!foundVariable) {

apps/sim/tools/execute-command/execute.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ export const executeCommandRunTool: ToolConfig<ExecuteCommandInput, ExecuteComma
8282
blockNameMapping: params.blockNameMapping || {},
8383
blockOutputSchemas: params.blockOutputSchemas || {},
8484
workflowId: params._context?.workflowId,
85-
userId: params._context?.userId,
8685
}),
8786
},
8887

0 commit comments

Comments
 (0)