Skip to content

Conversation

@BaiyuScope3
Copy link
Collaborator

@BaiyuScope3 BaiyuScope3 commented Jan 28, 2026

Problem

Erin found a bug in the sales agent,

When approving a media buy with GAM adapter, creatives were not being uploaded to GAM even though:

  • Creative assignments existed in the database
  • Creatives were approved
  • The order/line items were successfully created in GAM

GAM would show "Needs creatives (1)" on the line item.

Ticket: https://linear.app/scope3-projects/issue/PRO-88/hosted-sales-agent-creative-assignment-not-making-it-into-gam

Root Cause

The GAMCreativesManager initialization in google_ad_manager.py was checking for both advertiser_id AND trafficker_id:

if self.advertiser_id and self.trafficker_id:
    self.creatives_manager = GAMCreativesManager(...)

However, GAMCreativesManager does not actually use trafficker_id - only GAMOrdersManager does.

When gam_trafficker_id is NULL in the adapter_config table, it becomes an empty string "" which is falsy in Python. This caused creatives_manager to be set to None, and during approval the creative upload was silently skipped with the warning:

image
[APPROVAL] Adapter does not support creative upload, skipping

Fix

Remove the unnecessary and self.trafficker_id check since GAMCreativesManager only needs advertiser_id.

The comment on that line already said "Only initialize creative manager if we have advertiser_id" - the code just didn't match the comment.

Testing

  • All 194 GAM-related unit tests pass
  • tests/unit/test_gam_creatives_manager.py - 5 tests pass

…manager initialization

The GAMCreativesManager does not actually use trafficker_id (only GAMOrdersManager does),
but the initialization check was requiring both advertiser_id AND trafficker_id.

This caused creatives_manager to be None when trafficker_id was not configured,
resulting in creative uploads being silently skipped during media buy approval.
The order/line items would be created in GAM, but no creatives would be associated.

Root cause: When gam_trafficker_id is NULL in adapter_config, it becomes an empty
string which is falsy, causing the condition 'if self.advertiser_id and self.trafficker_id'
to evaluate to False even when advertiser_id is properly set.

Fix: Only check for advertiser_id since that's all GAMCreativesManager needs.
Upgrade python-multipart from 0.0.21 to 0.0.22 to fix security vulnerability.
@bokelley bokelley merged commit 87fad8a into main Jan 28, 2026
13 checks passed
Sign up for free to 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.

3 participants