Repository navigation
feat(training-agent): creative library for the inventory tenants - #9116
Conversation
A storefront's certification run on /inventory-adserver stopped at
creative sync ("Tool sync_creatives not found"). Both inventory tenants
claim sales-guaranteed, whose storyboards call sync_creatives, and a
storefront has to traffic its creatives to the packages it buys.
Both tenants now keep a creative library per account in the caller's
market (inventory-sim/creatives.ts):
- sync_creatives: creatives checked against the seed's formats; the
deprecated assignments (errors reported per package) and
assignment_operations assign, unassign and replace (all or nothing);
strict and lenient validation, dry_run and delete_missing. Merges,
assignment trackers, landing pages, installment scoping and placement
routing are rejected with UNSUPPORTED_FEATURE.
- list_creatives with assignment readback and the creative, format,
status, package and media-buy filters.
- list_creative_formats limited to the formats the seed serves.
- create_media_buy and update_media_buy take a package's inline
creatives and creative_assignments (update replaces). A creative is
only assigned to a package whose product serves its format.
- get_media_buys lists each package's creative_approvals.
Every creative is approved on arrival and delivery does not wait for
one, so seeded delivery is unchanged.
The library keys formats by canonical format_option_id. The named-format
wire (format_id, format_ids) is translated only in
inventory-sim/creative-wire.ts, registered as a compatibility boundary.
sync_creatives registers as a raw media-buy handler because the SDK
passes sales.syncCreatives only the creatives, not the assignments. The
tenants' creative format projection includes the seed's own formats, so
canonical inline creatives on create_media_buy resolve to them. The docs
page now describes the library.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
Ladon verdict: Approve
Approve — server-side creative library additions to the inventory simulation tenants, no blocking findings.
What I checked:
- No
static/schemas/source/**,docs/reference/**, ordist/**changes — schema↔docs coherence, changeset scope, oneOf discriminator, and artifact-immutability governance rules do not apply. - Not based on
3.1.x; no transport/auth/signing changes. - Account isolation is sound (per-principal market doc with account_id filters); all-or-nothing semantics hold via the structuredClone-then-save pattern.
- Building-guide docs are coherent with the implementation.
- Well-tested: six new adserver cases plus a content-tenant inline case.
Gate checks: No no-auto-approve team match. gated_paths is false. high_risk is false. No prior decision. Only one medium finding (not data-loss/schema/infra category), so no escalation trigger fires and the count is below the row-8 threshold of three.
Medium findings (non-blocking):
- server/src/training-agent/inventory-sim/creatives.ts:226 — delete_missing in lenient mode deletes a resent creative that failed validation.
Single medium finding, no blocking issues → row 9 approve.
Medium findings
- server/src/training-agent/inventory-sim/creatives.ts:226 — delete_missing in lenient mode deletes a resent creative that failed validation
…arams A storefront names creative formats canonically: a URL-free format_kind with params (for example image at 728x90), never a format_id. The ROS display products serve both a 728x90 and a 300x250 image, so format_kind alone was ambiguous there and creatives on sync_creatives could not resolve at all. Match format_kind with params against the product's format_options, or, without params, with the size of the creative's first image or video asset. A format that declares the same values wins; failing that, one whose declared params do not contradict them (the unsized takeover image takes any size). One match is accepted, several are refused naming them, none is FORMAT_NOT_SUPPORTED. This applies to sync_creatives and to inline creatives on create_media_buy and update_media_buy. The docs page says so, and links the creative tasks and error codes. Committed with --no-verify (maintainer-approved): the hook failed twice on unrelated suites (creative33-buyer, exact-inference) that pass alone. Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
Ladon verdict: Approve
Approve — subsequent pass over a 3-file delta (how-to mdx, creative-wire.ts format resolution, and its test) with no blocking or medium findings.
What I checked:
- The new format_kind + params/sizeHints resolution in creative-wire.ts is sound and fails closed: ambiguity resolves to an INVALID_REQUEST naming candidates rather than a wrong assignment.
- Doc prose in simulated-inventory-agents.mdx matches resolveCreativeFormat branch-for-branch.
- No changes to static/schemas/source/, normative docs/reference/, or other published protocol surface, so no changeset is required (changeset-scope gate not triggered).
- No oneOf/discriminator, released-artifact, or 3.1.x patch-eligibility concerns in the delta.
Iteration note: the prior run's single medium (creatives.ts:226 delete_missing in lenient mode) is outside this delta and not rechecked per scope rules; no new blocking or medium findings surfaced. The lone quirk (extra params key collapsing to a spurious ambiguity when an unsized same-kind format exists) fails closed with an actionable message and is Low.
No team gate, not high-risk, gated_paths false. Falls through to row 9 → approve.
With delete_missing and lenient validation, a creative the request resent but that failed validation was left out of the kept set, so its library version was deleted and its failed row overwritten as deleted. Keep every creative the request names; only ones it omits are deleted. Committed with --no-verify (maintainer-approved): the hook failed on stripe-client and compliance-authored-tool-gates under host load; both pass alone. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…creative A buy with no creatives reported pending_start, which tells a buyer nothing is missing. AdCP's media-buy-status defines pending_creatives as no package able to begin delivery for want of creative coverage. Report it while no live package of the buy has a creative assigned, then pending_start, active or the other states as before. Seeded delivery is not gated on creatives; the docs page says so. Committed with --no-verify (standing approval for #9116 until merge). Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
Ladon verdict: Approve
Approve — clean delta pass over PR #9116.
The code change narrows a real bug in syncCreatives' delete_missing branch: kept now derives from the raw request creatives (every named creative_id) rather than parsed (only successfully-validated ones), so a resent creative that fails lenient validation is preserved with its existing library version instead of being wrongly deleted. The fix is correct — strict mode still fails fast before delete_missing, no row collision occurs, and the added test (banner_keep→failed/kept, banner_a→deleted) covers the fixed path.
Checks applied:
- No
static/schemas/source/**changes → no schema↔docs coherence or oneOf discriminator concerns. - Training-agent app surface (not static/schemas/source/task defs/reference docs) → no changeset required; scope gate not triggered.
- No high-risk paths, no gated paths, no no-auto-approve team match.
review_decisionis REVIEW_REQUIRED butgated_paths: false, so row 2 does not fire.- Prior decision was
approve; no blocker recurs.
Decision table: no critical/high/medium findings, no escalation triggers, no team gate → falls through to row 9 (approve).
There was a problem hiding this comment.
Ladon verdict: Approve
Approve — clean subsequent pass, no blocking findings.
This is a follow-up pass on a prior approve decision. The delta is 3 files: the pending_creatives status addition in inventory-sim/platform.ts, one docs line, and test updates. The new status logic (live.length > 0 && live.every(pkg => !pkg.creative_assignments?.length) → pending_creatives, checked before pending_start/active) is correct — pending_creatives is a valid media-buy-status enum value, and the schema's definition matches the implementation. Tests cover both transition directions.
No changeset required: this is training-agent simulation code with no change to static/schemas/source/**, task definitions, normative reference docs, or published artifacts.
Decision table: no critical/high/medium findings (row 1 N/A); gated_paths false (row 2 N/A); high_risk false (rows 3,5 N/A); no medium data-loss/schema/infra findings (row 4 N/A); prior decision was approve so row 6 sticky-escalation does not apply; no no-auto-approve team match (row 7 N/A); fewer than three medium findings (row 8 N/A). Falls through to row 9 → approve.
Brings in 23 commits from main, among them the 3.2.12 hosted registration, the @adcp/sdk 17.0.0-beta.31 bump (adcontextprotocol#9132), the inventory-tenant creative library (adcontextprotocol#9116, adcontextprotocol#9143), the macOS runner tools for the release tests (adcontextprotocol#9138) and the hook split in adcontextprotocol#9126. The hooks stay as this branch has them: pre-commit runs the root suite, the staged-file-scoped server suite, the checks and the node:test files as one vitest run under a 120 s budget, and pre-push runs the storyboard queue under 180 s. With the shared workers, caches and queue, both fit in about 200 s on an M4 Pro, so this branch keeps the suites in the hooks. adcontextprotocol#9126's additive pieces stay: npm run verify:local and precommit-server-unit.cjs --full. Resolution ledger: - mechanical: package-lock.json -> main's (identical to main after the merge). - semantic: - package.json -> this branch's precommit script, plus main's verify:local. - .husky/pre-push (auto-merged) -> this branch's storyboard block; the matrix runs when its sources change, ADCP_SKIP_STORYBOARD_MATRIX=1 skips it. - .agents/playbook.md -> this branch's Local Hooks text, plus a verify:local paragraph; main's auto-merged hook description removed. - scripts/precommit-server-unit.cjs -> union: main's --full switch runs this branch's single-run full plan. - scripts/verify-local.cjs -> main's, with its header no longer saying the hooks run only fast checks. - server/tests/unit/training-agent-inventory-tenants.test.ts -> union: main's new cases with this branch's static import and state resets. - tests/cdn-artifacts, changesets-fence, maintenance-release-publication, release-publication-ordering -> union: this branch's git-env isolation, main's runnerPath() as the one GNU-tools mechanism; this branch's tests/helpers/gnu-tools.cjs and its shims are removed as unused.
Why
A storefront's certification run against
/inventory-adservergets past accounts, then stops at creative sync withMCP error -32602: Tool sync_creatives not found. Both inventory tenants claimsales-guaranteed, andinventory-adserveralso claimssales-non-guaranteed. Both specialisms' storyboards callsync_creativeswithout arequires_toolgate. A storefront also has to traffic its creatives to the packages it buys. Until now, inline creatives oncreate_media_buywere silently ignored.What
Both inventory tenants now keep a creative library per account, inside the caller's simulated market (
inventory-sim/creatives.ts).sync_creativesassignment_operationssupportsassign,unassignandreplace. A request's operations apply together or not at all.assignmentsfield still works; each failed assignment is reported in that creative'sassignment_errors.validation_mode,dry_runanddelete_missingare supported.installment_refsand placement routing are rejected withUNSUPPORTED_FEATURErather than dropped.list_creativesreads back assignments, and filters by creative, format, status, package, media buy or unassigned.list_creative_formatsreturns the training creative catalogue, limited to the formats the seed serves.create_media_buy/update_media_buytake a package's inlinecreativesandcreative_assignments; on update they replace the package's assignments. A creative is only assigned to a package whose product serves its format; otherwise the request fails withFORMAT_NOT_SUPPORTED.get_media_buyslists each package'screative_approvals.get_adcp_capabilitiesdeclarescreative.has_creative_libraryand the supported assignment operations.pending_creatives. A buy reportspending_creativeswhile none of its live packages has a creative (AdCP's definition: no package can begin delivery for want of creative coverage), thenpending_startoractiveas before. Packages without a creative carry nocreative_approvals.Every creative is approved as soon as it arrives, and delivery does not wait for one: the engine is untouched, so seeded delivery is unchanged. There is no "deliver only once a creative is assigned" gate.
Canonical format resolution
A storefront may name a creative's format only canonically, with
format_kindandparamsand noformat_id. This works onsync_creativesand on inline creatives:paramsvalues wins.params. The size of the creative's first image or video asset is used instead.INVALID_REQUEST, naming them. None givesFORMAT_NOT_SUPPORTED.format_option_refwith the product'sformat_option_idand a namedformat_idalso resolve.paramsis not a field ofcore/creative-asset.json; it is accepted because that schema allows additional properties.Design notes
format_option_id, taken from the seed's product format declarations. The named-format wire (format_id,format_ids) is translated only ininventory-sim/creative-wire.ts, which is added totests/lint-format-identity-boundaries.test.cjs.sync_creatives,list_creativesandlist_creative_formatsregister as rawlegacyHandlers.mediaBuyhandlers. The SDK'ssales.syncCreativesreceives only the creatives, never theassignmentsorassignment_operations.create_media_buybefore the platform sees them, and rejected formats missing from the sales catalogue (email_sponsored,audio_spot,creator_brief). The inventory tenants now passcreativeProjectionAdapters()their seed's format declarations. A canonical creative then resolves to the product's format, byformat_option_refor by aformat_kindthat only one of the product's formats has.reset_stateclears them with the market.The docs page
docs/building/verification/simulated-inventory-agents.mdxgains a Creatives section. No changeset: there is no protocol change.Tests
The follow-up commit
16deb86a1fwas made with--no-verify, approved by the maintainer. Its pre-commit hook failed twice on unrelated suites,creative33-buyer(20/20 when run alone) and Addie'sexact-inferenceworkers. CI is the gate.training-agent-inventory-tenants: 22/22, including 9 new cases, plus status checks forpending_creativesand a lenientdelete_missingregression. The ninth covers canonical resolution alone: 728x90 versus 300x250 on a ROS display product, size from the asset, the ambiguity refusal, and an inline 728x90 oncreate_media_buy.list_creativesandget_media_buys.assignmentserrors, anddry_run.Also passing:
lint-format-identity-boundaries, the engine suite, the creative33 suites and the tenant smoke tests.exact-inference,matched-v4-evaluation) that fail under host load.🤖 Generated with Claude Code