Repository navigation
fix(training-agent): accept native creatives that fit the declared format option - #8940
Merged
Merged
Conversation
…rmat option sync_creatives held every native_in_feed creative to one fixed profile (1200x627 or 1080x1080, title <= 80, a closed CTA list), so it refused creatives built to options the agent itself declares: a 600x400 main_image for native_content_card, and a free-text CTA for the influencer options that declare no cta_values. The validator now reads its values from the declaration the creative targets: the option named by format_option_ref, otherwise the native options of each package it is assigned to, otherwise the agent's own native_in_feed creative capability, which now publishes the profile it enforces on bare creatives. Absent parameters do not narrow, the optional icon may be omitted, buyer-asset-rejecting options are not alternatives, and error.details names the constraint and option. validate_input against the capability applies the same parameters. Closes #8917 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Contributor
There was a problem hiding this comment.
Ladon verdict: Approve
Approve — clean, server-only change with no blocking or medium findings.
What I checked:
- Server-only change to
server/src/training-agent/task-handlers.ts(+304/-37) and its new test file. Nostatic/schemas/source/**,docs/reference/**, ordist/**paths touched, so schema↔docs coherence, oneOf-discriminator, artifact-immutability, and changeset-scope gates do not apply (per repo scope gate — no changeset required for a server-only training-agent change). - The hard-coded
native_in_feedcheck is replaced with a declaration-driven path: the capability publishes exactly the profile it enforces (structuredClone(CANONICAL_CAPABILITY_PARAMS[...] ?? {})) and build-capability resolution threads the same params. Group logic innativeInFeedValidationError(OR within a group, AND across groups, no empty groups, non-empty capability fallback) is sound;declaredSlotPixelRatiosdefaults to[1]preserving prior bare-creative behavior. - 17 new tests added, 15 fail on main; primary
creative/native_in_feedstoryboard validated 10/10.
Gate evaluation: gated_paths false; high_risk false; no no-auto-approve team match; no critical/high/medium findings. Rows 1–8 do not fire → row 9 approve. Note: review_decision is REVIEW_REQUIRED, but since gated_paths is false, row 2 does not apply.
Reviewer note (not a finding): this alters get_adcp_capabilities output shape and the local storyboard matrix was skipped; training-agent-storyboards.yml in CI is the authoritative gate for sales-tenant capability discovery.
This was referenced Nov 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #8917
Problem
The training agent's
sync_creativesheld everynative_in_feedcreative to one fixed profile:main_image1200x627 or 1080x1080, title at most 80 characters, and a closed CTA list. Its own product options declare something else, so it refused creatives built to its own declarations:native_content_card_native_in_feeddeclaresmain_image_sizes: [600x400]andtitle_max_chars: 90. A 600x400 creative with no icon was refused withVALIDATION_ERROR.social_feed_card,native_feedandnative_postdeclare nocta_values. A "Shop now" CTA was refused withCREATIVE_VALUE_NOT_ALLOWED.Change
server/src/training-agent/task-handlers.tsreplaces the hard-coded check with one that reads its values from the declaration the creative targets, in this order:format_option_ref, matched against catalog, seeded and configured products.native_in_feedoptions of every package the creative is assigned to, in this request or already. The creative must satisfy at least one option per package. The package-timeformatsToProvidesnapshot and the package'sformat_option_refsselection are used when present.native_in_feedcreative capability. That capability now publishes the profile it enforces (title_max_chars: 80,main_image_sizes: [1200x627, 1080x1080],cta_values: [...]) increative.supported_formats[].format.params. Bare creatives therefore behave as before, and thecreative/native_in_feedstoryboard keeps passing, but the agent now enforces only what it declares.Checks are driven by the declared parameters:
title_max_chars,body_text_max_chars,cta_max_chars,main_image_sizes(honouring a slot'spixel_ratios),icon_size, andcta_values. An absent parameter does not narrow its slot. Optional slots such asiconmay be omitted. Options withbuyer_asset_acceptance: rejected(creator briefs) are never treated as an alternative a buyer bundle can satisfy.Error codes are unchanged:
VALIDATION_ERRORfor length and size,CREATIVE_VALUE_NOT_ALLOWEDfor a CTA outside a declared list.error.fieldnow uses the creative's real index instead of a hard-codedcreatives[0].error.detailsnames theconstraint, thedeclaredvalue and theformat_option_id, and keepsallowed_valuesandallowed_sizes.validate_inputagainst thenative_in_feedcapability applies the same parameters, so it agrees withsync_creatives.I grepped the training agent for other hard-coded format checks at sync time. There are none:
nativeInFeedValidationErrorwas the only one. Other kinds already go through declaration-driven validation (validateProductTarget,canonicalParamsSatisfied).No changeset: this is training-agent server behaviour only. The normative rule is #8918 / the companion spec PR.
Tests
server/tests/unit/training-agent-native-in-feed-options.test.ts(17 cases): both issue cases byformat_option_ref; a seeded option withcta_valuesandicon_size(exact creative accepted with and without the optional icon; wrong CTA refused withCREATIVE_VALUE_NOT_ALLOWEDandallowed_values; wrong icon size refused); assignment to a package in the same request (accepted against the package option, refused when it breaks it); the bare-creative capability path andvalidate_inputparity. 15 of the 17 fail againstmain.vitestoverserver/tests/unit/training-agent*andserver/src/training-agent: 81 files, 2051 tests pass.tsc --project server/tsconfig.json --noEmitpasses.creative/native_in_feedrun locally is clean on thecreativetenant (10/10 steps). On thesalestenant every sync and rejection step passes; the two capability-discovery steps fail a response-schema check onadcp.governance_enforcement.tasks, which this change does not touch. The full local matrix was too slow on this machine (signals tenant clean at 57 storyboards; sales still running after 35 minutes), so I pushed withADCP_SKIP_STORYBOARD_MATRIX=1.training-agent-storyboards.ymlin CI is the authoritative gate.npm ci --ignore-scriptsskipped the c2pa native binary. Afternpm rebuild @contentauth/c2pa-nodethose 3 files (23 tests) pass, so the commit used--no-verifyinstead of repeating the full suite.🤖 Generated with Claude Code