Skip to content

fix(training-agent): count the product's declarations when routing a manifest - #8991

Closed
KonstantinMirin wants to merge 2 commits into
adcontextprotocol:mainfrom
KonstantinMirin:fix/training-agent-manifest-routing-product-count
Closed

KonstantinMirin wants to merge 2 commits into
adcontextprotocol:mainfrom
KonstantinMirin:fix/training-agent-manifest-routing-product-count

Conversation

@KonstantinMirin

@KonstantinMirin KonstantinMirin commented Nov 13, 2026 •

Copy link
Copy Markdown
Collaborator

Follow-up to #8625, after #8876.

Brian's ruling on #8625: when two or more of the target product's format_options share a format_kind, a manifest without format_option_ref is rejected, and the count is the product's declarations. The /sales training agent did not follow that in two places:

  • sync_creatives created and assigned the manifest. It never checked for the missing ref.
  • create_media_buy counted the package's frozen selection. A package that picks one option with format_option_refs keeps one image declaration, so an inline or assigned manifest without the ref went through.

This PR makes both paths count the product's declarations. A manifest with no format_option_ref and no legacy format_id, whose format_kind appears two or more times in the product's format_options, gets format_option_ref_required with the matching option IDs as expected. On sync_creatives that covers assignment_operations, the deprecated assignments shorthand, and the re-sync of an already assigned creative. On create_media_buy it covers inline creatives and creative_assignments of library creatives.

The training agent, and one storyboard. inline_creatives_without_sync sent its product-scoped and publisher-scoped inline creatives without format_option_ref, to a product that can declare several options of the same format_kind (playfield_standard on /sales declares six image options). Under this rule both its create and update steps would be rejected. All four steps now route the manifest with the captured declaration, the same way the package's format_option_refs already does, with scope injected through context_inputs. The steps don't run on /sales today, because the run stops at the skipped legacy step, so CI results don't change. A patch changeset records the storyboard change.

The sync_creatives.mdx sentence is left to Brian. The storyboard step is #8876's (canonical_manifest_routing); this PR adds no storyboard phase. Merge it after #8876.

Tests

server/tests/unit/assignment-operations.test.ts seeds a product with two image declarations (300x250 and 728x90) and sends a 300x250 manifest with and without format_option_ref:

  • sync_creatives: the routed manifest is assigned. The unrouted one is rejected with both options on the package and with the package selecting the 300x250 option. The deprecated assignments shorthand reports it as a failed assignment.
  • create_media_buy, with the package selecting the 300x250 option: the routed inline manifest and the routed library creative are accepted. Without the ref, both are rejected.

Each negative test has an accepted control that differs only in the ref. On main the five negative tests fail and the rest pass. With only the sync_creatives change, the two create_media_buy negatives still fail.

The existing assignment-operations creatives target the catalog display product, which declares several image options. They now name its 300x250 option in format_option_ref.

Checks

The /sales training agent accepted a manifest without format_option_ref
on a product that declares its format_kind two or more times. On
sync_creatives it created and assigned the manifest. On create_media_buy
it counted the package's selection, so a package that selected one
option through format_option_refs let an inline or assigned manifest
through.

Reject that manifest with format_option_ref_required on both paths,
counting the target product's format_options. The assignment-operations
test creatives now name the catalog display product's 300x250 option,
since that product declares several image options.

Refs adcontextprotocol#8625
@mintlify

mintlify Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

Preview approval required

This pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit 0244243.

Approve preview

aao-secretariat[bot]
aao-secretariat Bot previously approved these changes Nov 13, 2026

@aao-secretariat aao-secretariat Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ladon verdict: Approve

Approve — training-agent manifest routing fix, app-only change.

Checked:

  • missingFormatOptionRefViolation (task-handlers.ts:14-27) correctly counts the product's full format_options sourced from productMap.get/productValidationMap.get, not the package's frozen selection. Behavior matches the #8625 ruling.
  • validateAssignedCreative is wired into all five create_media_buy/sync_creatives call sites.
  • Negative tests each have a ref-only control.
  • App-only training-agent change; no static/schemas/source/** or normative docs touched, so no changeset required and no schema↔docs coherence concern.

No blocking or medium findings. Not a protocol/breaking-class change. gated_paths is false and no author team gate applies — falls through to approve (row 9). Note: review_decision is REVIEW_REQUIRED, but gated_paths is false so the hard approval gate does not apply.

…ormat_option_ref

The product-scoped and publisher-scoped paths sent inline creatives with
format_kind alone, to a product that can declare several options of that
kind. Each creative now carries the captured declaration as its
format_option_ref, as the package's format_option_refs already does, with
scope injected through context_inputs.

@aao-secretariat aao-secretariat Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ladon verdict: Approve

Approve — clean compliance-scenario change with correct changeset.

The delta touches four files: a patch changeset, server/src/training-agent/task-handlers.ts, an assignment-operations unit test, and the inline_creatives_without_sync.yaml compliance scenario. The scenario adds format_option_ref: "$context.canonical_declaration" to the four product-/publisher-scoped inline-creative phases, each with a matching scope-only context_inputs injection — the documented DSL workaround for lack of object-spread. Placement is correct: refs land only in phases whose skip_if guarantees a routable format_option_id, and the unnamed-option phase is correctly left without one.

No schema change under static/schemas/source/**, so no docs-coherence or oneOf-discriminator exposure. Only static/compliance/source/** is touched (no dist/immutable-artifact mutation). Changeset is present, scoped, and typed as patch for a non-breaking change. No governance-precedent conflict and no breaking-class change.

Gate checks: gated_paths false, high_risk false, no no-auto-approve team match, review_decision REVIEW_REQUIRED (no gate forces escalation here since gated_paths is false). Prior decision was approve; this run adds no critical/high/medium findings. No decision-table row 1–8 fires → row 9 approve.

bokelley pushed a commit that referenced this pull request Nov 15, 2026
* Count the product's declarations when routing a manifest

The /sales training agent accepted a manifest without format_option_ref
on a product that declares its format_kind two or more times. On
sync_creatives it created and assigned the manifest. On create_media_buy
it counted the package's selection, so a package that selected one
option through format_option_refs let an inline or assigned manifest
through.

Reject that manifest with format_option_ref_required on both paths,
counting the target product's format_options. The assignment-operations
test creatives now name the catalog display product's 300x250 option,
since that product declares several image options.

Refs #8625

* fix(compliance): route inline_creatives_without_sync manifests with format_option_ref

The product-scoped and publisher-scoped paths sent inline creatives with
format_kind alone, to a product that can declare several options of that
kind. Each creative now carries the captured declaration as its
format_option_ref, as the package's format_option_refs already does, with
scope injected through context_inputs.

* fix(training-agent): check format_option_ref on update_media_buy

update_media_buy now applies the adcp#8625 routing rule that #8991 added
to sync_creatives and create_media_buy. When two or more of the target
product's format_options share a format_kind, a manifest without
format_option_ref or format_id is rejected with format_option_ref_required.

Covered: inline creatives and creative_assignments on packages[], and
inline creatives and creative_assignments on new_packages[]. Stored
assignments on a targeting-only package update are not re-checked.

The packages[] assignment check now reads the library as this update
leaves it, so an inline re-send that adds format_option_ref is accepted.
@bokelley

Copy link
Copy Markdown
Contributor

Closing as superseded: #9005 was built on this branch and merged first, so every code change here is already on main. The only conflict left is the tail of assignment-operations.test.ts, where #9005 added more tests after the same block. Thanks @KonstantinMirin.

@bokelley bokelley closed this Nov 15, 2026
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.

2 participants