Skip to content

fix(bullmq): restore CONCURRENCY_CONTROL_ENABLED flag guard#3903

Merged
waleedlatif1 merged 1 commit intostagingfrom
fix/restore-concurrency-control-flag
Apr 2, 2026
Merged

fix(bullmq): restore CONCURRENCY_CONTROL_ENABLED flag guard#3903
waleedlatif1 merged 1 commit intostagingfrom
fix/restore-concurrency-control-flag

Conversation

@waleedlatif1
Copy link
Copy Markdown
Collaborator

Summary

  • Restores CONCURRENCY_CONTROL_ENABLED env var that was accidentally removed in df6ceb6
  • isBullMQEnabled() was changed to return true whenever REDIS_URL is set, which enabled BullMQ in prod without the feature flag — breaking Slack-triggered workflow execution
  • Reverts isBullMQEnabled() to require both CONCURRENCY_CONTROL_ENABLED=true AND REDIS_URL

Type of Change

  • Bug fix

Testing

Tested manually

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@cursor
Copy link
Copy Markdown

cursor bot commented Apr 2, 2026

PR Summary

Medium Risk
Changes the condition that selects the BullMQ async backend, which can alter job dispatch/execution paths in production if the new flag is unset or misconfigured. Impact is contained to concurrency-control/BullMQ usage and is a straightforward guard restoration.

Overview
Restores an explicit feature-flag gate for BullMQ-based concurrency control.

isBullMQEnabled() now requires both REDIS_URL and CONCURRENCY_CONTROL_ENABLED (parsed via isTruthy) to enable BullMQ, preventing Redis presence alone from switching the async backend. The env schema reintroduces CONCURRENCY_CONTROL_ENABLED with a default of 'false' to keep inline/database execution as the default.

Written by Cursor Bugbot for commit b04438e. Configure here.

@vercel
Copy link
Copy Markdown

vercel bot commented Apr 2, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Apr 2, 2026 8:05pm

Request Review

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Apr 2, 2026

Greptile Summary

This PR is a targeted bug fix that restores the CONCURRENCY_CONTROL_ENABLED feature flag guard that was accidentally removed in commit df6ceb61, which had caused BullMQ to activate in production whenever REDIS_URL was set — breaking Slack-triggered workflow execution.

Key changes:

  • env.ts: Re-adds CONCURRENCY_CONTROL_ENABLED as an optional env var defaulting to 'false', making BullMQ strictly opt-in.
  • connection.ts: Reverts isBullMQEnabled() to require both isTruthy(env.CONCURRENCY_CONTROL_ENABLED) and Boolean(env.REDIS_URL), matching the pre-regression behavior.

The fix is minimal and correct. isTruthy (which checks value.toLowerCase() === 'true' || value === '1') correctly evaluates the default 'false' string as falsy, so no environment that omits the flag will accidentally enable BullMQ. All 15+ call-sites of isBullMQEnabled() across the codebase benefit from this fix without any further changes required.

Confidence Score: 5/5

This PR is safe to merge — it is a minimal, focused revert of a regression with no new logic introduced.

The change touches exactly two lines of logic: restoring a deleted env var declaration and adding back a single boolean guard. The fix is straightforwardly correct, the default of 'false' ensures safe opt-out, and the isTruthy helper already handles the string-boolean edge case. No API surface, schema, or behavioral contract changes are introduced. No findings were raised.

No files require special attention.

Important Files Changed

Filename Overview
apps/sim/lib/core/bullmq/connection.ts Restores the double-guard on isBullMQEnabled() — now correctly requires both CONCURRENCY_CONTROL_ENABLED=true and REDIS_URL before activating BullMQ.
apps/sim/lib/core/config/env.ts Re-adds the CONCURRENCY_CONTROL_ENABLED env var declaration (z.string().optional().default('false')), ensuring it is opt-in by default across all environments.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A["isBullMQEnabled()"] --> B{"CONCURRENCY_CONTROL_ENABLED\n== 'true' or '1'?"}
    B -- "No (default: 'false')" --> C["return false\n→ Inline / direct execution"]
    B -- "Yes" --> D{"REDIS_URL set?"}
    D -- "No" --> C
    D -- "Yes" --> E["return true\n→ BullMQ queue-based execution"]

    style C fill:#f87171,color:#fff
    style E fill:#4ade80,color:#000
Loading

Reviews (1): Last reviewed commit: "fix(bullmq): restore CONCURRENCY_CONTROL..." | Re-trigger Greptile

@waleedlatif1 waleedlatif1 merged commit 727bb1c into staging Apr 2, 2026
7 checks passed
@waleedlatif1 waleedlatif1 deleted the fix/restore-concurrency-control-flag branch April 2, 2026 20:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant