From a921a38db9c8ac831d9baa182d2cf2ff59f97ee5 Mon Sep 17 00:00:00 2001 From: Tanmay Deep Sharma Date: Wed, 15 Jul 2026 16:18:55 +0530 Subject: [PATCH] fix(automations): pause (not skip) armed rows when the account flag is off MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Marking a due row skipped/flag_disabled was terminal, so re-enabling the account flag could never resume it (sweepable only sees pending/processing) — the delayed action was lost, contradicting the banner that says rules resume when re-enabled. Check the flag before claiming and return, leaving the row pending like the instance kill switch does, so it fires once the feature is turned back on. --- app/jobs/automation_rules/process_pending_execution_job.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/jobs/automation_rules/process_pending_execution_job.rb b/app/jobs/automation_rules/process_pending_execution_job.rb index 4869b25cb..1fab8e0c5 100644 --- a/app/jobs/automation_rules/process_pending_execution_job.rb +++ b/app/jobs/automation_rules/process_pending_execution_job.rb @@ -5,6 +5,8 @@ class AutomationRules::ProcessPendingExecutionJob < ApplicationJob def perform(pending_execution) return if delayed_automations_disabled? + # Account flag off pauses (not skips): leave the row pending so re-enabling resumes it. + return unless pending_execution.account.feature_enabled?('delayed_automations') # Atomic claim: a duplicate enqueue (overlapping sweep or stale reclaim) loses here and returns. return unless pending_execution.claim! @@ -28,7 +30,6 @@ class AutomationRules::ProcessPendingExecutionJob < ApplicationJob def structural_skip_reason(pending_execution) rule = pending_execution.automation_rule return 'rule_inactive' if rule.nil? || !rule.active? - return 'flag_disabled' unless pending_execution.account.feature_enabled?('delayed_automations') return 'conversation_gone' if pending_execution.conversation.nil? nil