Skip to content

Supercharge your AI agents with data from the web and beyond. Building the library for superintelligence. πŸ”₯

refactor(limits): remove the Autumn-limits ramp experiment (#4111)

firecrawl-spring[bot]f578c51ac76f
diff --git a/apps/api/src/config.ts b/apps/api/src/config.ts
index 773e18282..63c66a047 100644
--- a/apps/api/src/config.ts
+++ b/apps/api/src/config.ts
@@ -85,18 +85,6 @@ const configSchema = z.object({
LLAMAPARSE_API_KEY: z.string().optional(),
STRIPE_SECRET_KEY: z.string().optional(),
AUTUMN_SECRET_KEY: z.string().optional(),
- // Ramp control for sourcing rate limits / concurrency / job priority from
- // Autumn instead of ACUC. Two independent knobs (an org is enabled if it
- // matches either); both default to the old ACUC behavior:
- // - AUTUMN_LIMITS_ENABLED_ORG_IDS: comma-separated org IDs to always enable
- // (or "*" for all). Use to pin specific verified orgs on first.
- // - AUTUMN_LIMITS_EXPERIMENT_PERCENT: stable per-org bucket ramp in [0,100].
- AUTUMN_LIMITS_ENABLED_ORG_IDS: z.string().default(""),
- AUTUMN_LIMITS_EXPERIMENT_PERCENT: z.coerce
- .number()
- .min(0)
- .max(100)
- .default(0),
RESEND_API_KEY: z.string().optional(),
PREVIEW_TOKEN: z.string().optional(),
SEARCH_PREVIEW_TOKEN: z.string().optional(),
diff --git a/apps/api/src/controllers/auth.ts b/apps/api/src/controllers/auth.ts
index 54dd2ed0f..043d79772 100644
--- a/apps/api/src/controllers/auth.ts
+++ b/apps/api/src/controllers/auth.ts
@@ -27,10 +27,7 @@ import {
} from "../db/rpc";
import { AuthResponse, RateLimiterMode } from "../types";
import { AuthCreditUsageChunk, AuthCreditUsageChunkFromTeam } from "./v1/types";
-import {
- autumnService,
- isAutumnLimitsEnabled,
-} from "../services/autumn/autumn.service";
+import { autumnService } from "../services/autumn/autumn.service";
function normalizedApiIsUuid(potentialUuid: string): boolean {
// Check if the string is a valid UUID
@@ -459,7 +456,7 @@ const KEYLESS_SUSPICIOUS_IP_MESSAGE = `Unfortunately, your IP address looks susp
*/
async function handleKeylessAuth(
req,
- mode: RateLimiterMode | undefined,
+ mode: RateLimiterMode,
allowKeyless: boolean | undefined,
): Promise<AuthResponse> {
const unauthorized: AuthResponse = {
@@ -601,7 +598,7 @@ async function handleKeylessAuth(
export async function authenticateUser(
req,
res,
- mode?: RateLimiterMode,
+ mode: RateLimiterMode,
options?: { allowKeyless?: boolean },
): Promise<AuthResponse> {
const bypassChunk = mockACUC();
@@ -618,10 +615,24 @@ export async function authenticateUser(
})(req, res, mode, options);
}
+/**
+ * Builds the rate limiter for an authenticated team from its Autumn rate-limit
+ * multiplier. Shared by the OAuth and API-key paths so their limiter setup
+ * can't diverge.
+ */
+async function buildAuthenticatedRateLimiter(
+ teamId: string,
+ orgId: string | null | undefined,
+ mode: RateLimiterMode,
+): Promise<RateLimiterRedis> {
+ const multiplier = await autumnService.getRateLimitMultiplier(teamId, orgId);
+ return getAutumnRateLimiter(mode, multiplier);
+}
+
async function supaAuthenticateUser(
req,
res,
- mode?: RateLimiterMode,
+ mode: RateLimiterMode,
options?: { allowKeyless?: boolean },
): Promise<AuthResponse> {
const authHeader =
@@ -694,21 +705,11 @@ async function supaAuthenticateUser(
subscriptionData = {
team_id: teamId,
};
- if (isAutumnLimitsEnabled(chunk.org_id)) {
- const rateLimitMultiplier = await autumnService.getRateLimitMultiplier(
- teamId,
- chunk.org_id,
- );
- rateLimiter = getAutumnRateLimiter(
- mode ?? RateLimiterMode.Crawl,
- rateLimitMultiplier,
- );
- } else {
- rateLimiter = getRateLimiter(
- mode ?? RateLimiterMode.Crawl,
- chunk.rate_limits,
- );
- }
+ rateLimiter = await buildAuthenticatedRateLimiter(
+ teamId,
+ chunk.org_id,
+ mode,
+ );
} else {
normalizedApi = parseApi(token);
if (!normalizedApiIsUuid(normalizedApi)) {
@@ -734,21 +735,11 @@ async function supaAuthenticateUser(
subscriptionData = {
team_id: teamId,
};
- if (isAutumnLimitsEnabled(chunk.org_id)) {
- const rateLimitMultiplier = await autumnService.getRateLimitMultiplier(
- teamId,
- chunk.org_id,
- );
- rateLimiter = getAutumnRateLimiter(
- mode ?? RateLimiterMode.Crawl,
- rateLimitMultiplier,
- );
- } else {
- rateLimiter = getRateLimiter(
- mode ?? RateLimiterMode.Crawl,
- chunk.rate_limits,
- );
- }
+ rateLimiter = await buildAuthenticatedRateLimiter(
+ teamId,
+ chunk.org_id,
+ mode,
+ );
}
if (chunk?.flags?.ipRestriction) {
diff --git a/apps/api/src/controllers/v0/keyAuth.ts b/apps/api/src/controllers/v0/keyAuth.ts
index f4ec3df31..224e53622 100644
--- a/apps/api/src/controllers/v0/keyAuth.ts
+++ b/apps/api/src/controllers/v0/keyAuth.ts
@@ -10,7 +10,7 @@ import { applyAgentAuthDiscoveryHeader } from "../../lib/agent-auth-discovery";
export const keyAuthController = async (req: Request, res: Response) => {
try {
// make sure to authenticate user first, Bearer <token>
- const auth = await authenticateUser(req, res);
+ const auth = await authenticateUser(req, res, RateLimiterMode.Account);
if (!auth.success) {
if (auth.status === 401) applyAgentAuthDiscoveryHeader(res);
return res.status(auth.status).json({ error: auth.error });
diff --git a/apps/api/src/controllers/v1/concurrency-check.ts b/apps/api/src/controllers/v1/concurrency-check.ts
index 6cc955e72..2fe5cac50 100644
--- a/apps/api/src/controllers/v1/concurrency-check.ts
+++ b/apps/api/src/controllers/v1/concurrency-check.ts
@@ -19,7 +19,6 @@ export async function concurrencyCheckController(
concurrency: activeJobsOfTeam,
maxConcurrency: await getEffectiveConcurrencyLimit(
req.auth.team_id,
- req.acuc?.concurrency,
req.acuc?.org_id,
),
});
diff --git a/apps/api/src/controllers/v1/crawl.ts b/apps/api/src/controllers/v1/crawl.ts
index 82d863357..acdf87c15 100644
--- a/apps/api/src/controllers/v1/crawl.ts
+++ b/apps/api/src/controllers/v1/crawl.ts
@@ -216,7 +216,6 @@ export async function crawlController(
req.body.maxConcurrency,
await getEffectiveConcurrencyLimit(
req.auth.team_id,
- req.acuc?.concurrency,
req.acuc?.org_id,
),
)
diff --git a/apps/api/src/controllers/v1/queue-status.ts b/apps/api/src/controllers/v1/queue-status.ts
index 4c5956ae3..68157b27c 100644
--- a/apps/api/src/controllers/v1/queue-status.ts
+++ b/apps/api/src/controllers/v1/queue-status.ts
@@ -79,7 +79,6 @@ export async function queueStatusController(
waitingJobsInQueue: queuedJobsOfTeam,
maxConcurrency: await getEffectiveConcurrencyLimit(
req.auth.team_id,
- req.acuc?.concurrency,
req.acuc?.org_id,
),
diff --git a/apps/api/src/controllers/v1/scrape.ts b/apps/api/src/controllers/v1/scrape.ts
index 99a9bc7cf..8a6ece1db 100644
--- a/apps/api/src/controllers/v1/scrape.ts
+++ b/apps/api/src/controllers/v1/scrape.ts
@@ -190,11 +190,7 @@ export async function scrapeController(
doc = await teamConcurrencySemaphore.withSemaphore(
req.auth.team_id,
jobId,
- await getEffectiveConcurrencyLimit(
- req.auth.team_id,
- req.acuc?.concurrency,
- req.acuc?.org_id,
- ),
+ await getEffectiveConcurrencyLimit(req.auth.team_id, req.acuc?.org_id),
aborter.signal,
timeout ?? 60_000,
async limited => {
diff --git a/apps/api/src/controllers/v2/browser.ts b/apps/api/src/controllers/v2/browser.ts
index 0d461abad..8b351f31c 100644
--- a/apps/api/src/controllers/v2/browser.ts
+++ b/apps/api/src/controllers/v2/browser.ts
@@ -259,7 +259,6 @@ export async function browserCreateController(
// 0b. Enforce concurrency limit (shared pool with scrape/crawl/interact)
const concurrencyLimit = await getEffectiveConcurrencyLimit(
req.auth.team_id,
- req.acuc?.concurrency,
req.acuc?.org_id,
);
const activeCount = await getCombinedTeamActiveCount(req.auth.team_id);
diff --git a/apps/api/src/controllers/v2/concurrency-check.ts b/apps/api/src/controllers/v2/concurrency-check.ts
index 748f83694..3c93ee090 100644
--- a/apps/api/src/controllers/v2/concurrency-check.ts
+++ b/apps/api/src/controllers/v2/concurrency-check.ts
@@ -26,7 +26,6 @@ export async function concurrencyCheckController(
concurrency: activeJobsOfTeam,
maxConcurrency: await getEffectiveConcurrencyLimit(
req.auth.team_id,
- req.acuc.concurrency,
req.acuc.org_id,
),
});
diff --git a/apps/api/src/controllers/v2/crawl.ts b/apps/api/src/controllers/v2/crawl.ts
index efddfb326..0ed8a5029 100644
--- a/apps/api/src/controllers/v2/crawl.ts
+++ b/apps/api/src/controllers/v2/crawl.ts
@@ -259,7 +259,6 @@ export async function crawlController(
const effectiveConcurrency = await getEffectiveConcurrencyLimit(
req.auth.team_id,
- req.acuc?.concurrency,
req.acuc?.org_id,
);
const sc: StoredCrawl = {
diff --git a/apps/api/src/controllers/v2/parse.ts b/apps/api/src/controllers/v2/parse.ts
index d1ea04034..9ba6795d2 100644
--- a/apps/api/src/controllers/v2/parse.ts
+++ b/apps/api/src/controllers/v2/parse.ts
@@ -451,7 +451,6 @@ export async function parseController(
const baseConcurrency = await getEffectiveConcurrencyLimit(
req.auth.team_id,
- req.acuc?.concurrency,
req.acuc?.org_id,
);
const concurrency = boostConcurrency
diff --git a/apps/api/src/controllers/v2/queue-status.ts b/apps/api/src/controllers/v2/queue-status.ts
index 005229a4c..4110b020f 100644
--- a/apps/api/src/controllers/v2/queue-status.ts
+++ b/apps/api/src/controllers/v2/queue-status.ts
@@ -79,7 +79,6 @@ export async function queueStatusController(
waitingJobsInQueue: queuedJobsOfTeam,
maxConcurrency: await getEffectiveConcurrencyLimit(
req.auth.team_id,
- req.acuc?.concurrency,
req.acuc?.org_id,
),
diff --git a/apps/api/src/controllers/v2/scrape-browser.ts b/apps/api/src/controllers/v2/scrape-browser.ts
index 4a48a6250..9c8454631 100644
--- a/apps/api/src/controllers/v2/scrape-browser.ts
+++ b/apps/api/src/controllers/v2/scrape-browser.ts
@@ -592,7 +592,6 @@ async function createSessionForScrape(
// Active session limit β€” uses the same concurrency pool as scrape/crawl
const concurrencyLimit = await getEffectiveConcurrencyLimit(
req.auth.team_id,
- req.acuc?.concurrency,
req.acuc?.org_id,
);
const activeCount = await getCombinedTeamActiveCount(req.auth.team_id);
diff --git a/apps/api/src/controllers/v2/scrape.ts b/apps/api/src/controllers/v2/scrape.ts
index 21874cf7b..ef33aecb9 100644
--- a/apps/api/src/controllers/v2/scrape.ts
+++ b/apps/api/src/controllers/v2/scrape.ts
@@ -267,7 +267,6 @@ export async function scrapeController(
const baseConcurrency = await getEffectiveConcurrencyLimit(
req.auth.team_id,
- req.acuc?.concurrency,
req.acuc?.org_id,
);
const concurrency = boostConcurrency
diff --git a/apps/api/src/lib/concurrency-limit.ts b/apps/api/src/lib/concurrency-limit.ts
index a81314c5a..7f79f0a66 100644
--- a/apps/api/src/lib/concurrency-limit.ts
+++ b/apps/api/src/lib/concurrency-limit.ts
@@ -1,6 +1,4 @@
-import { RateLimiterMode } from "../types";
import { getRedisConnection } from "../services/queue-service";
-import { getACUCTeam } from "../controllers/auth";
import { getCrawl, StoredCrawl } from "./crawl-redis";
import { logger } from "./logger";
import { abTestJob } from "../services/ab-test";
@@ -20,31 +18,22 @@ import {
pushConcurrencyLimitActiveJob,
removeConcurrencyLimitActiveJob,
} from "./concurrency-redis";
-import {
- autumnService,
- isAutumnLimitsEnabled,
-} from "../services/autumn/autumn.service";
+import { autumnService } from "../services/autumn/autumn.service";
-// Legacy fallback when neither ACUC nor Autumn gives us a concurrency value.
+// Fallback when Autumn can't give us a concurrency value.
const DEFAULT_CONCURRENCY_LIMIT = 2;
/**
- * Returns the team's effective concurrency limit. When the Autumn-limits ramp
- * is enabled for the org, this comes from Autumn's CONCURRENCY balance (falling
- * back to the ACUC value, then the default, if Autumn can't answer). Otherwise
- * it's the ACUC value β€” the old, default behavior.
+ * Returns the team's effective concurrency limit from Autumn's CONCURRENCY
+ * balance. Autumn is authoritative; when it can't answer (unavailable, or the
+ * entity is missing) we fall back to the default of 2.
*/
export async function getEffectiveConcurrencyLimit(
teamId: string,
- acucConcurrency: number | null | undefined,
orgId?: string | null,
): Promise<number> {
- const acucValue = acucConcurrency ?? DEFAULT_CONCURRENCY_LIMIT;
- if (!isAutumnLimitsEnabled(orgId)) {
- return acucValue;
- }
const autumnValue = await autumnService.getConcurrencyLimit(teamId, orgId);
- return autumnValue ?? acucValue;
+ return autumnValue ?? DEFAULT_CONCURRENCY_LIMIT;
}
const constructKey = constructConcurrencyLimitKey;
@@ -330,16 +319,8 @@ export async function concurrentJobDone(job: NuQJob<any>) {
await cleanOldCrawlConcurrencyLimitEntries(job.data.crawl_id);
}
- const acuc = await getACUCTeam(
- job.data.team_id,
- false,
- true,
- job.data.is_extract ? RateLimiterMode.Extract : RateLimiterMode.Crawl,
- );
const maxTeamConcurrency = await getEffectiveConcurrencyLimit(
job.data.team_id,
- acuc?.concurrency,
- acuc?.org_id,
);
let staleSkipped = 0;
diff --git a/apps/api/src/lib/concurrency-queue-reconciler.ts b/apps/api/src/lib/concurrency-queue-reconciler.ts
index 69616fc9e..e8b477d8f 100644
--- a/apps/api/src/lib/concurrency-queue-reconciler.ts
+++ b/apps/api/src/lib/concurrency-queue-reconciler.ts
@@ -1,9 +1,8 @@
import { Logger } from "winston";
import { validate as isUUID } from "uuid";
-import { getACUCTeam } from "../controllers/auth";
import { getRedisConnection } from "../services/queue-service";
import { scrapeQueue, type NuQJob } from "../services/worker/nuq";
-import { RateLimiterMode, type ScrapeJobData } from "../types";
+import { type ScrapeJobData } from "../types";
import {
getConcurrencyLimitActiveJobs,
getEffectiveConcurrencyLimit,
@@ -107,27 +106,14 @@ async function reconcileTeam(
return null;
}
- // Concurrency comes from getEffectiveConcurrencyLimit, which honors the
- // Autumn-limits ramp per org and otherwise uses ACUC. Fetch the crawl and
- // extract ACUC values so the ramp-off path keeps its separate per-type
- // limits; when the ramp is on, both resolve to the single Autumn pool.
- // TODO: once fully on Autumn, gate crawl + extract against one combined pool
- // (sum of both active counts vs the single limit) instead of applying the
- // same limit to each type independently.
- const [crawlAcuc, extractAcuc] = await Promise.all([
- getACUCTeam(ownerId, false, true, RateLimiterMode.Crawl),
- getACUCTeam(ownerId, false, true, RateLimiterMode.Extract),
- ]);
- const maxCrawlConcurrency = await getEffectiveConcurrencyLimit(
- ownerId,
- crawlAcuc?.concurrency,
- crawlAcuc?.org_id,
- );
- const maxExtractConcurrency = await getEffectiveConcurrencyLimit(
- ownerId,
- extractAcuc?.concurrency,
- extractAcuc?.org_id,
- );
+ // Autumn's CONCURRENCY balance is a single per-team pool, so crawl and
+ // extract share the same effective limit.
+ // TODO: gate crawl + extract against one combined pool (sum of both active
+ // counts vs the single limit) instead of applying the same limit to each
+ // type independently.
+ const teamConcurrency = await getEffectiveConcurrencyLimit(ownerId);
+ const maxCrawlConcurrency = teamConcurrency;
+ const maxExtractConcurrency = teamConcurrency;
// Split active count by type so one type's active jobs don't gate the other
const activeJobIds = await getConcurrencyLimitActiveJobs(ownerId);
@@ -217,27 +203,14 @@ async function drainQueue(
ownerId: string,
teamLogger: Logger,
): Promise<{ jobsPromoted: number; staleSkipped: number }> {
- // Concurrency comes from getEffectiveConcurrencyLimit, which honors the
- // Autumn-limits ramp per org and otherwise uses ACUC. Fetch the crawl and
- // extract ACUC values so the ramp-off path keeps its separate per-type
- // limits; when the ramp is on, both resolve to the single Autumn pool.
- // TODO: once fully on Autumn, gate crawl + extract against one combined pool
- // (sum of both active counts vs the single limit) instead of applying the
- // same limit to each type independently.
- const [crawlAcuc, extractAcuc] = await Promise.all([
- getACUCTeam(ownerId, false, true, RateLimiterMode.Crawl),
- getACUCTeam(ownerId, false, true, RateLimiterMode.Extract),
- ]);
- const maxCrawlConcurrency = await getEffectiveConcurrencyLimit(
- ownerId,
- crawlAcuc?.concurrency,
- crawlAcuc?.org_id,
- );
- const maxExtractConcurrency = await getEffectiveConcurrencyLimit(
- ownerId,
- extractAcuc?.concurrency,
- extractAcuc?.org_id,
- );
+ // Autumn's CONCURRENCY balance is a single per-team pool, so crawl and
+ // extract share the same effective limit.
+ // TODO: gate crawl + extract against one combined pool (sum of both active
+ // counts vs the single limit) instead of applying the same limit to each
+ // type independently.
+ const teamConcurrency = await getEffectiveConcurrencyLimit(ownerId);
+ const maxCrawlConcurrency = teamConcurrency;
+ const maxExtractConcurrency = teamConcurrency;
const activeIds = await getConcurrencyLimitActiveJobs(ownerId);
const activeJobs = await scrapeQueue.getJobs(activeIds, teamLogger);
diff --git a/apps/api/src/lib/job-priority.ts b/apps/api/src/lib/job-priority.ts
index 7c3a24336..31714d53f 100644
--- a/apps/api/src/lib/job-priority.ts
+++ b/apps/api/src/lib/job-priority.ts
@@ -1,11 +1,6 @@
-import { RateLimiterMode } from "../types";
-import { getACUCTeam } from "../controllers/auth";
import { redisEvictConnection } from "../services/redis";
import { logger } from "./logger";
-import {
- autumnService,
- isAutumnLimitsEnabled,
-} from "../services/autumn/autumn.service";
+import { autumnService } from "../services/autumn/autumn.service";
import { inferPlanPriorityFromMultiplier } from "../services/rate-limiter";
const SET_KEY_PREFIX = "limit_team_id:";
@@ -47,34 +42,15 @@ export async function getJobPriority({
}
try {
- const acuc = await getACUCTeam(
- team_id,
- false,
- true,
- RateLimiterMode.Scrape,
- );
-
const setKey = SET_KEY_PREFIX + team_id;
// Get the length of the set
const setLength = await redisEvictConnection.scard(setKey);
- // When the Autumn-limits ramp is enabled for the org, infer plan priority
- // from the rate-limit multiplier; otherwise use the ACUC plan_priority (the
- // old, default behavior).
- let bucketLimit: number;
- let planModifier: number;
- if (isAutumnLimitsEnabled(acuc?.org_id)) {
- const multiplier = await autumnService.getRateLimitMultiplier(
- team_id,
- acuc?.org_id,
- );
- ({ bucketLimit, planModifier } =
- inferPlanPriorityFromMultiplier(multiplier));
- } else {
- planModifier = acuc?.plan_priority.planModifier ?? 1;
- bucketLimit = acuc?.plan_priority.bucketLimit ?? 25;
- }
+ // Plan priority is inferred from the team's Autumn rate-limit multiplier.
+ const multiplier = await autumnService.getRateLimitMultiplier(team_id);
+ const { bucketLimit, planModifier } =
+ inferPlanPriorityFromMultiplier(multiplier);
// if length set is smaller than set, just return base priority
if (setLength <= bucketLimit) {
diff --git a/apps/api/src/services/autumn/__tests__/autumn.service.test.ts b/apps/api/src/services/autumn/__tests__/autumn.service.test.ts
index 6071a4051..f2a988455 100644
--- a/apps/api/src/services/autumn/__tests__/autumn.service.test.ts
+++ b/apps/api/src/services/autumn/__tests__/autumn.service.test.ts
@@ -92,8 +92,8 @@ vi.mock("../../../db/connection", () => ({
}));
vi.mock("../../../config", () => ({
- // Read at module load by autumn.service.
- config: { AUTUMN_LIMITS_ENABLED_ORG_IDS: "" },
+ // Stubbed so importing the real config (which parses env) is avoided.
+ config: {},
}));
// Import AFTER mocks are wired up.
diff --git a/apps/api/src/services/autumn/autumn.service.ts b/apps/api/src/services/autumn/autumn.service.ts
index 6bf2859ab..c619ea004 100644
--- a/apps/api/src/services/autumn/autumn.service.ts
+++ b/apps/api/src/services/autumn/autumn.service.ts
@@ -1,5 +1,4 @@
import { randomUUID } from "crypto";
-import { config } from "../../config";
import { logger } from "../../lib/logger";
import { eq } from "drizzle-orm";
import { dbRr } from "../../db/connection";
@@ -25,44 +24,6 @@ export const SEARCH_CREDITS_FEATURE_ID = "SEARCH_CREDITS";
const CONCURRENCY_FEATURE_ID = "CONCURRENCY";
const RATE_LIMIT_FEATURE_ID = "rate_limits";
-// Explicit allowlist of orgs for which rate limits / concurrency / job priority
-// are sourced from Autumn instead of ACUC. Parsed once from
-// AUTUMN_LIMITS_ENABLED_ORG_IDS: comma-separated org IDs, or "*" for all orgs.
-const autumnLimitsAllowlist = new Set(
- config.AUTUMN_LIMITS_ENABLED_ORG_IDS.split(",")
- .map(id => id.trim())
- .filter(Boolean),
-);
-
-/**
- * Deterministic bucket for an org UUID in [0, 100). Takes the first 8 hex
- * digits (after stripping dashes) so the same org always lands in the same
- * bucket β€” the ramp decision is stable across requests, which matters for
- * rate-limit/concurrency limits that would otherwise flip request-to-request.
- */
-function orgBucket(orgId: string): number {
- const hex = orgId.replace(/-/g, "").slice(0, 8);
- return parseInt(hex, 16) % 100;
-}
-
-/**
- * Whether to source rate limits / concurrency / job priority from Autumn
- * (instead of ACUC) for this org. Enabled when the org is in the explicit
- * allowlist (AUTUMN_LIMITS_ENABLED_ORG_IDS, or "*") OR falls within the stable
- * percentage ramp (AUTUMN_LIMITS_EXPERIMENT_PERCENT). Defaults to false (old
- * ACUC behavior) and always requires a configured Autumn client.
- */
-export function isAutumnLimitsEnabled(orgId?: string | null): boolean {
- if (!autumnClient) return false;
- if (autumnLimitsAllowlist.has("*")) return true;
- if (orgId && autumnLimitsAllowlist.has(orgId)) return true;
-
- const percent = config.AUTUMN_LIMITS_EXPERIMENT_PERCENT;
- if (percent <= 0) return false;
- if (percent >= 100) return true;
- return !!orgId && orgBucket(orgId) < percent;
-}
-
/**
* Coerces a raw Autumn balance figure into a usable non-negative number, or
* null when it's absent or not a sane finite value. These balances feed
diff --git a/apps/api/src/services/queue-jobs.ts b/apps/api/src/services/queue-jobs.ts
index 370ad2ed9..72f491d71 100644
--- a/apps/api/src/services/queue-jobs.ts
+++ b/apps/api/src/services/queue-jobs.ts
@@ -1,5 +1,5 @@
import { v7 as uuidv7 } from "uuid";
-import { NotificationType, RateLimiterMode, ScrapeJobData } from "../types";
+import { NotificationType, ScrapeJobData } from "../types";
import {
cleanOldConcurrencyLimitEntries,
getConcurrencyLimitActiveJobs,
@@ -17,7 +17,6 @@ import {
import { logger as _logger } from "../lib/logger";
import { sendNotificationWithCustomDays } from "./notification/email_notification";
import { shouldSendConcurrencyLimitNotification } from "./notification/notification-check";
-import { getACUCTeam } from "../controllers/auth";
import { getJobFromGCS, removeJobFromGCS } from "../lib/gcs-jobs";
import { Document } from "../controllers/v1/types";
import { getCrawl } from "../lib/crawl-redis";
@@ -399,19 +398,9 @@ async function addScrapeJobRaw(
}
}
- {
- const acuc = await getACUCTeam(
- webScraperOptions.team_id,
- false,
- true,
- RateLimiterMode.Crawl,
- );
- maxConcurrency = await getEffectiveConcurrencyLimit(
- webScraperOptions.team_id,
- acuc?.concurrency,
- acuc?.org_id,
- );
- }
+ maxConcurrency = await getEffectiveConcurrencyLimit(
+ webScraperOptions.team_id,
+ );
if (concurrencyLimited === null) {
const now = Date.now();
@@ -704,17 +693,7 @@ export async function addScrapeJobs(
addToCQ = jobsForcedToCQ;
} else {
const now = Date.now();
- const acuc = await getACUCTeam(
- teamId,
- false,
- true,
- RateLimiterMode.Scrape,
- );
- maxConcurrency = await getEffectiveConcurrencyLimit(
- teamId,
- acuc?.concurrency,
- acuc?.org_id,
- );
+ maxConcurrency = await getEffectiveConcurrencyLimit(teamId);
await cleanOldConcurrencyLimitEntries(teamId, now);
currentActiveConcurrency = (
diff --git a/apps/api/src/services/rate-limiter.ts b/apps/api/src/services/rate-limiter.ts
index 63f9ba0c7..8dac08c06 100644
--- a/apps/api/src/services/rate-limiter.ts
+++ b/apps/api/src/services/rate-limiter.ts
@@ -59,9 +59,9 @@ const BASE_RATE_LIMITS: Partial<Record<RateLimiterMode, number>> = {
};
/**
- * Builds the per-minute rate limiter for a mode from the team's ACUC
- * rate_limits (the default path). Used unless the Autumn-limits ramp is enabled
- * for the org, in which case getAutumnRateLimiter is used instead.
+ * Builds the per-minute rate limiter for a mode from a `rate_limits` map (or the
+ * static fallback table). Used for the preview token, which has no Autumn
+ * entity; authenticated teams use getAutumnRateLimiter.
*/
export function getRateLimiter(
mode: RateLimiterMode,
@@ -78,10 +78,10 @@ export function getRateLimiter(
}
/**
- * Builds the per-minute rate limiter for a mode from an Autumn rate-limit
- * multiplier: the effective limit is `base Γ— multiplier` for multiplier-scaled
- * modes (default Γ—1). Modes without a base fall back to the static table. Used
- * only when the Autumn-limits ramp is enabled for the org.
+ * Builds the per-minute rate limiter for an authenticated team from its Autumn
+ * rate-limit multiplier: the effective limit is `base Γ— multiplier` for
+ * multiplier-scaled modes (default Γ—1). Modes without a base fall back to the
+ * static table.
*/
export function getAutumnRateLimiter(
mode: RateLimiterMode,