fix(envvars): restore workflowUserId fallback for scheduled execution env var resolution#3941
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryMedium Risk Overview Adds coverage ensuring the correct user id is passed to Reviewed by Cursor Bugbot for commit 0bcc774. Configure here. |
Greptile SummaryThis PR fixes a regression introduced in #3179 where scheduled workflow executions resolved personal env vars against the billing/actor user instead of the workflow creator. The fix restores the original two-path logic from #2197: client sessions (manual runs from the UI) use Changes:
Confidence Score: 5/5Safe to merge — the bug fix is correct, all three branches are tested, and the only remaining finding is a P2 improvement to an error message. All three code paths in the restored logic are covered by new unit tests. The fix precisely targets the regression (wrong user for scheduled env-var resolution) without touching unrelated behaviour. The sole open comment is a P2 cosmetic improvement to the error message for an already-unusual edge case (client session with no No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[executeWorkflowCore] --> B{metadata.isClientSession\n&& metadata.sessionUserId?}
B -- Yes --> C[personalEnvUserId = sessionUserId\nclient / manual run]
B -- No --> D{metadata.workflowUserId?}
D -- Set --> E[personalEnvUserId = workflowUserId\nschedule / webhook / API]
D -- Missing --> F[throw Error:\n'Missing workflowUserId in execution metadata']
C --> G[getPersonalAndWorkspaceEnv\npersonalEnvUserId, workspaceId]
E --> G
G --> H[Decrypt env vars\nand continue execution]
Greploops — Automatically fix all review issues by running Reviews (2): Last reviewed commit: "test(envvars): add coverage for env var ..." | Re-trigger Greptile |
0fa571e to
0fe6960
Compare
… env var resolution
0fe6960 to
ff77546
Compare
|
@greptile |
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 0bcc774. Configure here.
… env var resolution (#3941) * fix(envvars): restore workflowUserId fallback for scheduled execution env var resolution * test(envvars): add coverage for env var user resolution branches
Summary
personalEnvUserIdlogic and dropped theworkflowUserIdfallbacksessionUserIdfor client sessions,workflowUserIdfor server-side executions (schedules, webhooks)metadata.userIdas a final safety fallbackType of Change
Testing
Tested manually
Checklist