Skip to content

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

chore(api): remove sub_user_id tracing, bump ACUC to v55 (#4022)

firecrawl-spring[bot]2d94c90a797c
diff --git a/apps/api/src/controllers/auth.ts b/apps/api/src/controllers/auth.ts
index 59e6dc8c7..d9bfab625 100644
--- a/apps/api/src/controllers/auth.ts
+++ b/apps/api/src/controllers/auth.ts
@@ -79,7 +79,6 @@ const mockPreviewACUC: (
api_key: "preview",
api_key_id: 0,
team_id,
- sub_user_id: null,
rate_limits: {
crawl: 2,
scrape: 10,
@@ -105,7 +104,6 @@ const mockACUC: () => AuthCreditUsageChunk = () => ({
api_key: "bypass",
api_key_id: 0,
team_id: "bypass",
- sub_user_id: "bypass",
rate_limits: {
crawl: 99999999,
scrape: 99999999,
diff --git a/apps/api/src/controllers/v1/types.ts b/apps/api/src/controllers/v1/types.ts
index da61bfb1c..fc4331605 100644
--- a/apps/api/src/controllers/v1/types.ts
+++ b/apps/api/src/controllers/v1/types.ts
@@ -1257,7 +1257,6 @@ export type AuthCreditUsageChunk = {
api_key_id: number;
team_id: string;
org_id?: string | null;
- sub_user_id: string | null;
plan_priority: {
bucketLimit: number;
planModifier: number;
diff --git a/apps/api/src/controllers/v2/scrape-browser.ts b/apps/api/src/controllers/v2/scrape-browser.ts
index b702b5fbf..58646407c 100644
--- a/apps/api/src/controllers/v2/scrape-browser.ts
+++ b/apps/api/src/controllers/v2/scrape-browser.ts
@@ -278,7 +278,6 @@ export async function scrapeInteractController(
// so LangSmith metadata filters don't match empty strings.
const traceIdentity = {
orgId: req.auth.org_id ?? undefined,
- subUserId: req.acuc?.sub_user_id ?? undefined,
};
let execResult: BrowserServiceExecResponse | AgentResult;
diff --git a/apps/api/src/db/rpc.ts b/apps/api/src/db/rpc.ts
index b4c805462..f993d3bdc 100644
--- a/apps/api/src/db/rpc.ts
+++ b/apps/api/src/db/rpc.ts
@@ -34,7 +34,7 @@ export async function authCreditUsageChunk(
): Promise<AuthCreditUsageChunkRow[]> {
const rows = await execRows<AuthCreditUsageChunkRow>(
database,
- sql`select * from auth_credit_usage_chunk_54(input_key => ${input_key})`,
+ sql`select * from auth_credit_usage_chunk_55(input_key => ${input_key})`,
);
// api_key_id is a bigint column, so the pg driver hands it back as a string.
for (const row of rows) {
@@ -51,7 +51,7 @@ export function authCreditUsageChunkFromTeam(
): Promise<AuthCreditUsageChunkRow[]> {
return execRows(
database,
- sql`select * from auth_credit_usage_chunk_54_from_team(input_team => ${input_team})`,
+ sql`select * from auth_credit_usage_chunk_55_from_team(input_team => ${input_team})`,
);
}
diff --git a/apps/api/src/lib/scrape-interact/browser-agent.ts b/apps/api/src/lib/scrape-interact/browser-agent.ts
index 7987fc720..b0b708be5 100644
--- a/apps/api/src/lib/scrape-interact/browser-agent.ts
+++ b/apps/api/src/lib/scrape-interact/browser-agent.ts
@@ -214,7 +214,6 @@ interface BrowserAgentTraceContext {
scrapeId: string;
teamId: string;
orgId?: string;
- subUserId?: string;
zeroDataRetention?: boolean;
scrapeUrl?: string;
targetUrl?: string;
@@ -335,7 +334,6 @@ export async function executePromptViaBrowserAgent(
scrape_id: trace.scrapeId,
team_id: trace.teamId,
org_id: trace.orgId,
- sub_user_id: trace.subUserId,
browser_id: browserId,
mode: "prompt",
zeroDataRetention: trace.zeroDataRetention,
@@ -464,7 +462,6 @@ export async function executeCodeViaBrowserSession(
scrape_id: trace.scrapeId,
team_id: trace.teamId,
org_id: trace.orgId,
- sub_user_id: trace.subUserId,
browser_id: browserId,
mode: "code",
zeroDataRetention: trace.zeroDataRetention,
diff --git a/apps/api/src/lib/scrape-interact/langsmith.ts b/apps/api/src/lib/scrape-interact/langsmith.ts
index 4aac23f8b..41a89cc1b 100644
--- a/apps/api/src/lib/scrape-interact/langsmith.ts
+++ b/apps/api/src/lib/scrape-interact/langsmith.ts
@@ -22,12 +22,10 @@ export type InteractTraceMetadata = {
session_id: string;
scrape_id: string;
team_id: string;
- // Optional identifiers below team_id for finer-grained LangSmith filtering.
- // sub_user_id is the per-request sub-user label (when the API key carries
- // one); org_id is the parent org when teams are grouped. Neither is always
- // present — team_id is the only guaranteed identity.
+ // Optional org_id below team_id for finer-grained LangSmith filtering — the
+ // parent org when teams are grouped. Not always present; team_id is the only
+ // guaranteed identity.
org_id?: string;
- sub_user_id?: string;
browser_id?: string;
run_id?: string;
mode: "prompt" | "code";