Skip to content

Supercharge your AI agents with data from the web and beyond. Building the library for superintelligence. 🔥

feat(autumn): add Autumn org bypass (#3179)

firecrawl-spring[bot]82aa3010abb2
diff --git a/apps/api/src/controllers/auth.ts b/apps/api/src/controllers/auth.ts
index 7905d1ffa..32f306dde 100644
--- a/apps/api/src/controllers/auth.ts
+++ b/apps/api/src/controllers/auth.ts
@@ -12,7 +12,10 @@ import { redlock } from "../services/redlock";
import { supabase_rr_service, supabase_service } from "../services/supabase";
import { AuthResponse, RateLimiterMode } from "../types";
import { AuthCreditUsageChunk, AuthCreditUsageChunkFromTeam } from "./v1/types";
-import { isAutumnCheckEnabled } from "../services/autumn/autumn.service";
+import {
+ isAutumnCheckEnabled,
+ AUTUMN_BYPASS_ORG_IDS,
+} from "../services/autumn/autumn.service";
function normalizedApiIsUuid(potentialUuid: string): boolean {
// Check if the string is a valid UUID
@@ -403,7 +406,7 @@ async function ensureChunkOrgId(
!chunk ||
chunk.org_id ||
config.USE_DB_AUTHENTICATION !== true ||
- !isAutumnCheckEnabled()
+ (!isAutumnCheckEnabled() && AUTUMN_BYPASS_ORG_IDS.size === 0)
) {
return chunk;
}
diff --git a/apps/api/src/services/autumn/autumn.service.ts b/apps/api/src/services/autumn/autumn.service.ts
index 1fb329bc7..676078055 100644
--- a/apps/api/src/services/autumn/autumn.service.ts
+++ b/apps/api/src/services/autumn/autumn.service.ts
@@ -19,6 +19,15 @@ import type {
const TEAM_FEATURE_ID = "TEAM";
const CREDITS_FEATURE_ID = "CREDITS";
+/**
+ * Org IDs that always have Autumn enabled, regardless of experiment
+ * percentage or feature flags.
+ */
+export const AUTUMN_BYPASS_ORG_IDS = new Set([
+ "318e9dfd-9d76-489d-86fa-64bcbc3682f9", // Autumn
+ "601f9bf3-425c-4309-97ae-4626842738d5", // Autumn
+]);
+
/**
* Deterministic bucket for an org UUID.
*
@@ -45,12 +54,14 @@ export function orgBucket(orgId: string): number {
* `ensureTeamProvisioned`.
*/
export function isAutumnEnabled(orgId?: string): boolean {
+ if (orgId && AUTUMN_BYPASS_ORG_IDS.has(orgId)) return true;
if (config.AUTUMN_EXPERIMENT !== "true") return false;
if (!orgId || config.AUTUMN_EXPERIMENT_PERCENT >= 100) return true;
return orgBucket(orgId) < config.AUTUMN_EXPERIMENT_PERCENT;
}
export function isAutumnCheckEnabled(orgId?: string): boolean {
+ if (orgId && AUTUMN_BYPASS_ORG_IDS.has(orgId)) return true;
if (config.AUTUMN_CHECK_ENABLED !== "true") return false;
if (config.AUTUMN_EXPERIMENT !== "true") return false;
const percent = config.AUTUMN_CHECK_EXPERIMENT_PERCENT ?? 100;
@@ -67,6 +78,7 @@ export function isAutumnCheckDryRun(): boolean {
}
export function isAutumnRequestTrackEnabled(orgId?: string): boolean {
+ if (orgId && AUTUMN_BYPASS_ORG_IDS.has(orgId)) return true;
if (config.AUTUMN_REQUEST_TRACK_EXPERIMENT !== "true") return false;
if (!isAutumnEnabled(orgId)) return false;
if (!orgId || config.AUTUMN_REQUEST_TRACK_EXPERIMENT_PERCENT >= 100) {
@@ -362,11 +374,7 @@ export class AutumnService {
value,
properties,
}: TrackCreditsParams): Promise<boolean | null> {
- if (
- !isAutumnCheckEnabled() ||
- !autumnClient ||
- this.isPreviewTeam(teamId)
- ) {
+ if (!autumnClient || this.isPreviewTeam(teamId)) {
return null;
}
@@ -412,7 +420,7 @@ export class AutumnService {
expiresAt,
properties,
}: LockCreditsParams): Promise<string | null> {
- if (!isAutumnEnabled() || !autumnClient || this.isPreviewTeam(teamId)) {
+ if (!autumnClient || this.isPreviewTeam(teamId)) {
return null;
}