Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
3f84ed9
fix(settings): fix long description on wordpress integration (#2195)
waleedlatif1 Dec 4, 2025
dc5a2b1
fix(envvar): fix envvar dropdown positioning, remove dead code (#2196)
waleedlatif1 Dec 4, 2025
ca3eb5b
fix(subscription): fixed text clipping on subscription panel (#2198)
waleedlatif1 Dec 4, 2025
8e7d8c9
fix(profile-pics): remove sharp dependency for serving profile pics i…
waleedlatif1 Dec 4, 2025
d22b578
fix(enterprise-plan): seats should be taken from metadata (#2200)
icecrasher321 Dec 5, 2025
1642ed7
improvement: modal UI (#2202)
emir-karabeg Dec 5, 2025
dcbdcb4
chore(deps): upgrade to nextjs 16 (#2203)
waleedlatif1 Dec 5, 2025
3b9f0f9
feat(error-notifications): workspace-level configuration of slack, em…
icecrasher321 Dec 5, 2025
414a54c
feat(i18n): update translations (#2204)
waleedlatif1 Dec 5, 2025
1b903f2
fix(images): updated helm charts with branding URL guidance, removed …
waleedlatif1 Dec 5, 2025
ca818a6
feat(admin): added admin APIs for admin management (#2206)
waleedlatif1 Dec 5, 2025
8ef9a45
fix(env-vars): refactor for workspace/personal env vars to work with …
icecrasher321 Dec 5, 2025
58251e2
feat(copilot): superagent (#2201)
Sg312 Dec 5, 2025
7101dc5
improvement: loading, optimistic actions (#2193)
emir-karabeg Dec 5, 2025
7752bea
fix(import): fix array errors on import/export (#2211)
Sg312 Dec 5, 2025
5d6c1f7
feat(tools): added more slack tools (#2212)
waleedlatif1 Dec 5, 2025
002713e
feat(i18n): update translations (#2208)
waleedlatif1 Dec 5, 2025
4fd5f00
fix(copilot): validation (#2215)
Sg312 Dec 5, 2025
fb4c982
fix(custom-bot-slack): dependsOn incorrectly set for bot_token (#2214)
icecrasher321 Dec 5, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
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
  • Loading branch information
icecrasher321 authored Dec 5, 2025
commit 8ef9a45125eb6219b0fd3a3a5558fd30573a92de
14 changes: 7 additions & 7 deletions apps/docs/content/docs/en/variables/environment-variables.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,16 @@ To reference environment variables in your workflows, use the `{{}}` notation. W
height={350}
/>

## Variable Precedence
## How Variables are Resolved

When you have both personal and workspace variables with the same name:
**Workspace variables always take precedence** over personal variables, regardless of who runs the workflow.

1. **Workspace variables take precedence** over personal variables
2. This prevents naming conflicts and ensures consistent behavior across team workflows
3. If a workspace variable exists, the personal variable with the same name is ignored
When no workspace variable exists for a key, personal variables are used:
- **Manual runs (UI)**: Your personal variables
- **Automated runs (API, webhook, schedule, deployed chat)**: Workflow owner's personal variables

<Callout type="warning">
Choose variable names carefully to avoid unintended overrides. Consider prefixing personal variables with your initials or workspace variables with the project name.
<Callout type="info">
Personal variables are best for testing. Use workspace variables for production workflows.
</Callout>

## Security Best Practices
Expand Down
14 changes: 10 additions & 4 deletions apps/sim/app/api/workflows/[id]/execute/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const ExecuteWorkflowSchema = z.object({
stream: z.boolean().optional(),
useDraftState: z.boolean().optional(),
input: z.any().optional(),
// Optional workflow state override (for executing diff workflows)
isClientSession: z.boolean().optional(),
workflowStateOverride: z
.object({
blocks: z.record(z.any()),
Expand Down Expand Up @@ -92,16 +92,17 @@ export async function executeWorkflow(
workflowId,
workspaceId: workflow.workspaceId,
userId: actorUserId,
workflowUserId: workflow.userId,
triggerType,
useDraftState: false,
startTime: new Date().toISOString(),
isClientSession: false,
}

const snapshot = new ExecutionSnapshot(
metadata,
workflow,
input,
{},
workflow.variables || {},
streamConfig?.selectedOutputs || []
)
Expand Down Expand Up @@ -329,6 +330,7 @@ export async function POST(req: NextRequest, { params }: { params: Promise<{ id:
stream: streamParam,
useDraftState,
input: validatedInput,
isClientSession = false,
workflowStateOverride,
} = validation.data

Expand Down Expand Up @@ -503,17 +505,19 @@ export async function POST(req: NextRequest, { params }: { params: Promise<{ id:
workflowId,
workspaceId: workflow.workspaceId ?? undefined,
userId: actorUserId,
sessionUserId: isClientSession ? userId : undefined,
workflowUserId: workflow.userId,
triggerType,
useDraftState: shouldUseDraftState,
startTime: new Date().toISOString(),
isClientSession,
workflowStateOverride: effectiveWorkflowStateOverride,
}

const snapshot = new ExecutionSnapshot(
metadata,
workflow,
processedInput,
{},
workflow.variables || {},
selectedOutputs
)
Expand Down Expand Up @@ -769,17 +773,19 @@ export async function POST(req: NextRequest, { params }: { params: Promise<{ id:
workflowId,
workspaceId: workflow.workspaceId ?? undefined,
userId: actorUserId,
sessionUserId: isClientSession ? userId : undefined,
workflowUserId: workflow.userId,
triggerType,
useDraftState: shouldUseDraftState,
startTime: new Date().toISOString(),
isClientSession,
workflowStateOverride: effectiveWorkflowStateOverride,
}

const snapshot = new ExecutionSnapshot(
metadata,
workflow,
processedInput,
{},
workflow.variables || {},
selectedOutputs
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -879,7 +879,7 @@ export function useWorkflowExecution() {
selectedOutputs,
triggerType: overrideTriggerType || 'manual',
useDraftState: true,
// Pass diff workflow state if available for execution
isClientSession: true,
workflowStateOverride: executionWorkflowState
? {
blocks: executionWorkflowState.blocks,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ export async function executeWorkflowWithFullLogging(
const executionId = options.executionId || uuidv4()
const { addConsole } = useTerminalConsoleStore.getState()

// Build request payload
const payload: any = {
input: options.workflowInput,
stream: true,
triggerType: options.overrideTriggerType || 'manual',
useDraftState: true,
isClientSession: true,
}

const response = await fetch(`/api/workflows/${activeWorkflowId}/execute`, {
Expand Down
Loading
Loading