You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Line 28: Cutoff = 2026-04-01constLLMO_BRANDALF_GA_CUTOFF_MS_DEFAULT=Date.UTC(2026,3,1);// If org created after cutoff → V2// If org has brandalf flag enabled → V2 (override)
Paramount: Created before cutoff, but flag enabled → forced to V2
Takes V2 path (lines 1343-1413 in llmo-onboarding.js)
Calls upsertBrand() (line 1373)
upsertBrand() calls syncBrandSites() (line 558 in brands-storage.js)
syncBrandSites queries sites table, gets empty result
Returns silently, brand.siteIds empty
Later, DRS job finds brand but no sites in siteIds
Strict resolver fails → job fails
Execution Flow for McCain
resolveLlmoOnboardingMode() detects V2 (org after cutoff)
Takes V2 path (lines 1343-1413 in llmo-onboarding.js)
Calls upsertBrand() (line 1373)
upsertBrand() calls syncBrandSites() (line 558 in brands-storage.js)
syncBrandSites queries sites table, gets site match
Creates brand_sites rows, brand.siteIds populated
Later, DRS job finds brand with sites in siteIds
Strict resolver succeeds → job succeeds
Investigation Required
1. Paramount's Feature Flag History
SELECT*FROM feature_flags
WHERE organization_id ='296fefc8-1e54-46dd-aee4-a0f94621deaf'AND product ='LLMO'ORDER BY updated_at DESC
When was brandalf flag created?
Has it always been true, or was it updated?
Are there any error logs from when it was enabled?
2. Paramount's Sites in PostgreSQL
SELECT id, base_url, organization_id, created_at
FROM sites
WHERE organization_id ='296fefc8-1e54-46dd-aee4-a0f94621deaf'ORDER BY created_at
Expected for all 3 sites:
Do all 3 sites exist?
Do organization_ids match exactly: 296fefc8-1e54-46dd-aee4-a0f94621deaf?
Are base_urls formatted correctly (no-www canonical)?
3. Paramount's Brand-Sites Linkage
SELECTb.id, b.name, b.organization_id, COUNT(bs.site_id) as linked_sites
FROM brands b
LEFT JOIN brand_sites bs ONb.id=bs.brand_idWHEREb.organization_id='296fefc8-1e54-46dd-aee4-a0f94621deaf'GROUP BYb.id, b.name, b.organization_id
Expected result: 0 rows or all with linked_sites = 0
No brand_sites rows exist
Every brand has empty siteIds
4. McCain's (Control) Brand-Sites Linkage
SELECTb.id, b.name, b.organization_id, COUNT(bs.site_id) as linked_sites
FROM brands b
LEFT JOIN brand_sites bs ONb.id=bs.brand_idWHEREb.organization_id='d9aae1ba-2443-4a30-a8c9-5b1a58390966'GROUP BYb.id, b.name, b.organization_id
Expected result: Every brand has linked_sites > 0
brand_sites rows exist
Sites are properly linked
Solutions
Part 1: Short-term (Fixes Paramount)
Once root cause identified via PostgreSQL queries:
If sites have wrong organization_id:
UPDATE sites
SET organization_id ='296fefc8-1e54-46dd-aee4-a0f94621deaf'WHERE id IN ('738d9ce9-3879-4640-a345-25b5ae8bb92a',
'69847518-1efb-42a0-945a-d9ec37832620',
'74ebfcef-70e0-4537-afdc-6e61176c362b')
If base_url format is inconsistent:
Normalize base_urls in sites table to match brand URLs
Then re-run syncBrandSites:
Manually call syncBrandSites for all Paramount brands
Problem Statement
ALL sites in Paramount org fail DRS prompt generation with identical error:
This is not a one-off bug—it's an organization-wide failure indicating a systemic issue with the Paramount org's migration from V1 to V2 mode.
Critical Findings
1. Org-Wide Failure Pattern
All three sites in Paramount org (
296fefc8-1e54-46dd-aee4-a0f94621deaf) fail with 100% failure rate:2. Onboarding Mode: Auto-Detected by Org Creation Date
resolveLlmoOnboardingMode()determines V1 vs V2 per organization:brandalfflag can force V2 for old orgsParamount org was created 2025-02-24 (before cutoff) → default V1, but was manually upgraded to V2 via feature flag.
3. Control Case: McCain Org (Fresh V2)
McCain org created 2026-05-05 (after cutoff):
4. Bypass Case: CPKCR Org (V1)
CPKCR org created 2025-10-08 (before cutoff):
Root Cause: Organization State Inconsistency
Paramount org migration from V1 → V2 created a database state mismatch:
The Migration Problem
Org created 2025-02-24: V1 mode
Later (unknown date):
brandalfflag manually enabledWhen onboarding runs:
resolveLlmoOnboardingMode()findsbrandalfflag enabled → V2upsertBrand()→ creates brand in v2 catalogsyncBrandSites()→ queries sites table to link brandWhen DRS job runs:
find_brand_for_site_strict()) failsBrandResolverDriftErrorWhy syncBrandSites Fails for Paramount
The query in
syncBrandSites()(brands-storage.js:218-222):Returns empty for Paramount but succeeds for McCain because:
Hypothesis: When Paramount org was migrated, one of these occurred:
For McCain (fresh V2), none of these issues exist—site and brand created together.
Code Path Analysis
resolveLlmoOnboardingMode() (llmo-onboarding-mode.js)
Determines V1 vs V2 mode:
Execution Flow for Paramount
resolveLlmoOnboardingMode()detects V2 (flag enabled)upsertBrand()(line 1373)upsertBrand()callssyncBrandSites()(line 558 in brands-storage.js)Execution Flow for McCain
resolveLlmoOnboardingMode()detects V2 (org after cutoff)upsertBrand()(line 1373)upsertBrand()callssyncBrandSites()(line 558 in brands-storage.js)Investigation Required
1. Paramount's Feature Flag History
brandalfflag created?2. Paramount's Sites in PostgreSQL
Expected for all 3 sites:
296fefc8-1e54-46dd-aee4-a0f94621deaf?3. Paramount's Brand-Sites Linkage
Expected result: 0 rows or all with
linked_sites = 04. McCain's (Control) Brand-Sites Linkage
Expected result: Every brand has
linked_sites > 0Solutions
Part 1: Short-term (Fixes Paramount)
Once root cause identified via PostgreSQL queries:
If sites have wrong organization_id:
If base_url format is inconsistent:
Then re-run syncBrandSites:
Part 2: Medium-term (PR #2374)
This helps prevent similar issues and provides visibility.
Part 3: Long-term (Prevent future migrations)
Once root cause known:
Key Metrics
References
296fefc8-1e54-46dd-aee4-a0f94621deaf38931D6666E3ECDA0A495E80@AdobeOrg