Skip to content

fix(training-agent): webhook envelope protocol uses AdCP domain, not 'mcp' - #2876

Merged
bokelley merged 1 commit into
mainfrom
bokelley/webhook-protocol
Apr 22, 2026
Merged

bokelley merged 1 commit into
mainfrom
bokelley/webhook-protocol

Conversation

@bokelley

Copy link
Copy Markdown
Contributor

Summary

Webhook completion envelope emitted protocol: 'mcp' (a transport name), but core/mcp-webhook-payload.json references enums/adcp-protocol.json whose values are AdCP domain names (media-buy, signals, governance, creative, brand, sponsored-intelligence). Any strict schema validator rejects 'mcp'.

Adds TOOL_TO_PROTOCOL in server/src/training-agent/webhooks.ts, keyed off TOOL_TO_TASK_TYPE so tsc enforces both maps stay in sync. Rule: operational context over task grouping — matches the normative sync_creatives → media-buy example in the payload schema.

Mapping

  • media-buy: create/update_media_buy, sync_creatives, get_creative_delivery, sync_event_sources, sync_audiences, sync_catalogs, log_event
  • governance: sync_accounts, get_account_financials, create/update/get/list/delete_property_list
  • signals: activate_signal, get_signals
  • brand: get_brand_identity, get_rights, acquire_rights

Expert review

ad-tech-protocol-expert signed off with one correction (accounts → governance, applied).

Test plan

  • webhook_emission storyboard: 7P/0F under both dispatches
  • Full framework run: 27/56 clean (unchanged)
  • Full legacy run: 45/56 clean (unchanged)
  • npm run typecheck clean
  • npm run test:unit 631/631 passing

Surfaced during review of #2868.

🤖 Generated with Claude Code

The completion-webhook envelope emitted `protocol: 'mcp'` (transport name),
but `core/mcp-webhook-payload.json` references `enums/adcp-protocol.json`,
whose values are AdCP domains (`media-buy`, `signals`, `governance`, `creative`,
`brand`, `sponsored-intelligence`). Any strict validator would reject `'mcp'`.

Adds `TOOL_TO_PROTOCOL` keyed off `TOOL_TO_TASK_TYPE` so tsc enforces both
maps stay in sync. Rule: operational context over task grouping — creative
ops emitted by an inline-creative seller stamp `media-buy` (matching the
`sync_creatives → media-buy` example in the payload schema); accounts stamp
`governance` (identity/authorization); signals / property ops / brand ops
stamp their own domain.

- webhook_emission storyboard: 7P/0F under both dispatches (unchanged)
- full framework run: 27/56 (unchanged)
- full legacy run: 45/56 (unchanged)

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@bokelley
bokelley merged commit 751cd3d into main Apr 22, 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.

1 participant