-
Notifications
You must be signed in to change notification settings - Fork 12
fix(workflow-executor): no record on a global action's approval [PRD-688] #1723
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -42,6 +42,9 @@ Important rules: | |
|
|
||
| interface ActionTarget extends ActionRef { | ||
| selectedRecordRef: RecordRef; | ||
| // A global action runs on no record — the executor must not attach one (record_ids stays empty, | ||
| // so an approval request it triggers isn't wrongly linked to a record). | ||
| isGlobal?: boolean; | ||
| } | ||
|
|
||
| export default class TriggerRecordActionStepExecutor extends RecordStepExecutor<TriggerActionStepDefinition> { | ||
|
|
@@ -146,6 +149,7 @@ export default class TriggerRecordActionStepExecutor extends RecordStepExecutor< | |
| selectedRecordRef, | ||
| displayName: action.displayName, | ||
| name: action.name, | ||
| isGlobal: action.type === 'global', | ||
| }; | ||
|
|
||
| const form = await this.context.agent.getActionForm({ | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 Medium
🚀 Reply "fix it for me" or copy this AI Prompt for your agent: |
||
|
|
@@ -363,7 +367,9 @@ export default class TriggerRecordActionStepExecutor extends RecordStepExecutor< | |
| { | ||
| collection: selectedRecordRef.collectionName, | ||
| action: name, | ||
| id: selectedRecordRef.recordId, | ||
| // A global action runs on no record: omit the id so it isn't attached (notably to the | ||
| // approval request it may trigger). Single/bulk actions keep their record. | ||
| ...(target.isGlobal ? {} : { id: selectedRecordRef.recordId }), | ||
| ...(form && { values: form.values }), | ||
| }, | ||
| { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟡 Medium
agent-nodejs/packages/workflow-executor/src/executors/trigger-record-action-step-executor.ts
Line 136 in e85cdd6
isGlobalis only set on the transientActionTargetinhandleFirstCall, butpauseForConfirmationnever persists it — onlydisplayName,name, andselectedRecordRefare saved. On re-entry in Branch A,saveFrontendResultrebuilds the target withoutisGlobal, so the flag is lost. Because paused flows execute natively on the frontend, a global action inManualorAutomatedWithConfirmationmode keeps carrying the sourceselectedRecordRef, causing the frontend to submit the source record and create approval requests wrongly linked to it. Consider persistingisGlobalinpauseForConfirmation'spendingDataand restoring it when rebuilding the target in the confirmation handler.🚀 Reply "fix it for me" or copy this AI Prompt for your agent: