Skip to content

fix(limits): updated rate limiter to match execution timeouts, adjusted timeouts fallback to be free plan - #3136

Merged
waleedlatif1 merged 2 commits into
stagingfrom
fix/limits
Feb 4, 2026
Merged

fix(limits): updated rate limiter to match execution timeouts, adjusted timeouts fallback to be free plan#3136
waleedlatif1 merged 2 commits into
stagingfrom
fix/limits

Conversation

@waleedlatif1

@waleedlatif1waleedlatif1 commented Feb 4, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • updated rate limiter to match execution timeouts interfaces
  • adjusted timeouts fallback to be free plan instead of enterprise plan for consistency
  • updated tests
  • upgraded turborepo

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 Bugbot reviewed your changes and found no issues for commit bf02231

@vercel

vercelBot commented Feb 4, 2026

Copy link
Copy Markdown

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

ProjectDeploymentActionsUpdated (UTC)
docsReadyReadyPreview, CommentFeb 4, 2026 11:23pm

Request Review

@greptile-apps

Copy link
Copy Markdown
Contributor

Greptile Overview

Greptile Summary

This PR addresses timeout and rate limit consistency by aligning both systems to use free plan defaults when billing is disabled.

Key Changes:

  • Execution Timeouts: Simplified fallback logic to consistently return free plan timeouts when billing is disabled, removing the conditional check that previously returned enterprise timeouts
  • Rate Limiter: Added new getRateLimit() function that centralizes rate limit retrieval and respects isBillingEnabled flag, matching the pattern used in execution timeouts
  • Code Quality: Removed duplicate helper methods (getBucketConfig, createUnlimitedStatus) in RateLimiter class by using the centralized getRateLimit() function
  • Testing: Added mock for isBillingEnabled feature flag to ensure tests run with billing enabled
  • Dependencies: Upgraded turborepo from 2.8.0 to 2.8.3

The changes improve consistency between execution timeouts and rate limiting, ensuring both systems behave predictably when billing is disabled.

Confidence Score: 5/5

  • This PR is safe to merge with no identified issues
  • The changes are well-structured refactorings that improve code consistency and maintainability. The logic changes align execution timeouts and rate limiting behavior when billing is disabled. Tests have been updated appropriately to handle the new feature flag dependency.
  • No files require special attention

Important Files Changed

FilenameOverview
apps/sim/lib/core/execution-limits/types.tsSimplified timeout fallback logic to consistently use free plan when billing is disabled
apps/sim/lib/core/rate-limiter/types.tsAdded getRateLimit function to centralize rate limit retrieval with isBillingEnabled check
apps/sim/lib/core/rate-limiter/rate-limiter.tsRefactored to use centralized getRateLimit function, removed duplicate helper methods
apps/sim/lib/core/rate-limiter/rate-limiter.test.tsAdded mock for isBillingEnabled feature flag to ensure tests run with billing enabled

Sequence Diagram

sequenceDiagram
participant Client
participant RateLimiter
participant getRateLimit
participant FeatureFlags
participant Storage
Client->>RateLimiter: checkRateLimitWithSubscription(userId, subscription, triggerType, isAsync)
alt triggerType === 'manual'
RateLimiter-->>Client: return unlimited result
else
RateLimiter->>RateLimiter: determine plan (subscription?.plan || 'free')
RateLimiter->>RateLimiter: getCounterType(triggerType, isAsync)
RateLimiter->>getRateLimit: getRateLimit(plan, counterType)
getRateLimit->>getRateLimit: toConfigKey(counterType)
getRateLimit->>FeatureFlags: check isBillingEnabled
alt !isBillingEnabled
getRateLimit-->>RateLimiter: return RATE_LIMITS.free[key]
else
getRateLimit-->>RateLimiter: return RATE_LIMITS[plan || 'free'][key]
end
RateLimiter->>Storage: consumeTokens(storageKey, 1, config)
Storage-->>RateLimiter: ConsumeResult
RateLimiter-->>Client: return RateLimitResult
end
Loading

@greptile-appsgreptile-appsBot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

4 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@waleedlatif1
waleedlatif1 merged commit 793adda into stagingFeb 4, 2026
12 checks passed
@waleedlatif1
waleedlatif1 deleted the fix/limits branch February 4, 2026 23:31
royceP2 pushed a commit to arenadeveloper02/p2-sim that referenced this pull request Mar 3, 2026
…ed timeouts fallback to be free plan (simstudioai#3136)
* fix(limits): updated rate limiter to match execution timeouts, adjusted timeouts fallback to be free plan
* upgrade turborepo
Sign up for freeto 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

@waleedlatif1