From a1fdba27839a9104787309cdbdf3e37dce17ff57 Mon Sep 17 00:00:00 2001 From: Tanmay Deep Sharma Date: Wed, 15 Jul 2026 14:16:10 +0530 Subject: [PATCH] fix(automations): strip execution_delay when cloning a rule with the feature off clone duplicates the rule via dup (including execution_delay) with no param for ensure_execution_delay_allowed to inspect, so it could create new delayed rules while the feature is disabled. Drop the delay on the clone unless the account has delayed_automations enabled, matching create/update. --- app/controllers/api/v1/accounts/automation_rules_controller.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/controllers/api/v1/accounts/automation_rules_controller.rb b/app/controllers/api/v1/accounts/automation_rules_controller.rb index 4c1b2b373..2b924e971 100644 --- a/app/controllers/api/v1/accounts/automation_rules_controller.rb +++ b/app/controllers/api/v1/accounts/automation_rules_controller.rb @@ -49,6 +49,9 @@ class Api::V1::Accounts::AutomationRulesController < Api::V1::Accounts::BaseCont def clone automation_rule = Current.account.automation_rules.find_by(id: params[:automation_rule_id]) new_rule = automation_rule.dup + # dup copies execution_delay; drop it when the feature is off so clone can't create new + # delayed rules that create/update would reject. + new_rule.execution_delay = nil unless delayed_automations_enabled? new_rule.save! @automation_rule = new_rule end