Skip to content

feat(media-buy): add a cost target to criteria.outcome_target - #7778

Merged
bokelley merged 4 commits into
mainfrom
feat/outcome-target-cost-per
Sep 30, 2026
Merged

bokelley merged 4 commits into
mainfrom
feat/outcome-target-cost-per

Conversation

@bokelley

Copy link
Copy Markdown
Contributor

Part of #7676 (cost_per slice only; threshold_rate, per_ad_spend, and the vendor-metric goal are deferred).

Problem

A buyer cannot ask for "clicks at €3 or less on a €5k budget" at request time. It must pre-compute a volume (€5k ÷ €3 ≈ 1,667) and drop the ceiling, so the seller cannot tell a volume ask from a cost ask or answer "I can do €4.50, not €3".

Change

  • outcome_target.cost_per { amount, currency, strength: cap | target }, mirroring 3.2 BiddingPolicy.cost_per, not the deprecated optimization-goal target. volume becomes optional; at least one is required, so every document valid today stays valid. A test pins strength to BiddingPolicy's enum.
  • Four request shapes: volume only (unchanged); cost_per with a buyer budget (budget_range max, else min, or the brief; total_budget stays within both bounds); cost_per plus volume (under a cap the seller SHOULD keep the amount and forecast the lower volume); cost_per alone (the seller plans the deliverable volume at the cost and states the spend in total_budget_guidance).
  • Answer: commercial_terms.bidding.cost_per, adopted by the buyer on acceptance. amount ≥ the ask: the ask when plannable, otherwise the lowest plannable amount. The buyer's strength is kept: a cap of 3 met at 4.50 comes back { amount: 4.50, strength: "cap" }, never "target". A seller that won't plan at any amount under the buyer's strength rejects rather than switching strength.
  • Binding: no purchase-level bidding. Under fixed or omitted allocation, every purchase's primary goal matches goal; under seller_optimized, budget_allocation's primary goal does. "Matches" means the same kind and metric, or event_type/custom_event_name; seller-added qualifiers are allowed and visible. Event goals bind through event sources registered on the buyer's account, with a stated attribution_window, or are rejected. A goal with no canonical optimization-goal form rejects the cost target, not the goal.
  • Currency is the one departure from BiddingPolicy: BiddingPolicy.cost_per inherits the media-buy currency and none exists at request time. cost_per.currency is the answer currency, anchored on purchases[].pricing.currency (the monetary_fields constraint already ties bidding to it); forecast.currency equals it, as do total_budget/total_budget_guidance when present. No conversion.
  • Errors: INVALID_REQUEST naming criteria.outcome_target.cost_per for a target that can't be represented or bound (strength, currency, goal, capability); outcome: "rejected" for a valid target with no viable inventory; UNSUPPORTED_FEATURE for sellers not declaring media_buy.outcome_target.
  • Conformance: the answering phases of media_buy_seller/outcome_target are gated on fixed media-buy cost-cap support in features.bidding_policy; the EUR-vs-USD currency rejection (with a matching EUR budget range) is required of every declaring seller.
  • Training agent: advertises fixed media-buy cost_per (cap, target) on 3.2 responses and plans cost targets deterministically, including event goals through registered sources. create_media_buy now rejects canonical bidding outside that profile and ambiguous fixed cost bindings, so bidding_cost_binding runs and passes.

WG notes

  • Capability errors use INVALID_REQUEST, not feat(media-buy): gate seller-optimized package controls behind their own capabilities #7752's UNSUPPORTED_FEATURE. A seller answers only inside its advertised features.bidding_policy profile; a declaring seller without one rejects with INVALID_REQUEST naming criteria.outcome_target.cost_per. The maintainer chose this so a buyer has one recovery path for every cost-target rejection.
  • Currency conflicts deliberately depart from get_products. A budget_range, pricing_currencies, or account-currency conflict is INVALID_REQUEST naming criteria.outcome_target.cost_per, whereas get_products returns zero products. A cost target states the answer's currency, so a conflict is a malformed request, not an empty result.
  • No strength switching. A seller that won't plan at any amount under the buyer's strength rejects rather than switching strength.
  • The capability flag is ambiguous. media_buy.outcome_target can't distinguish rc.7 sellers from cost-aware ones; buyers use the negotiated adcp_version plus features.bidding_policy.
  • Deferred: a structured committed / best-effort / declined answer; threshold_rate, per_ad_spend, the vendor-metric goal; an event-goal conformance case (no capability declares event-goal cost support).

Verification

outcome_target storyboard 8/8; bidding_cost_binding newly active and 6/6; proposal storyboards unchanged. Schema, example, composed, oneOf, MCP projection (media-buy 441.67/442 KiB, no raise), storyboard lints, typecheck, and the full training-agent vitest suites (37 files, 1,387 tests) pass.

🤖 Generated with Claude Code

bokelley and others added 2 commits September 30, 2026 05:13
A buyer could not ask for "clicks at 3 or less on a 5,000 budget" at
request time: it had to pre-compute a volume and drop the ceiling, so the
seller could not tell a volume ask from a cost ask or answer "I can do 4.50,
not 3".

outcome_target gains an optional cost_per { amount, currency, strength },
mirroring the 3.2 BiddingPolicy.cost_per (cap/target) rather than the
deprecated optimization-goal target. currency is the one addition:
BiddingPolicy inherits the media-buy currency and none exists at request
time. volume becomes optional; at least one of volume or cost_per is
required, so every document valid today stays valid.

The seller answers in the proposal's commercial_terms.bidding.cost_per,
keeping the buyer's strength and stating its own amount, which MAY exceed
the ask. The policy binds to a primary optimization goal matching
outcome_target.goal. cost_per.currency MUST equal budget_range.currency when
present and is the answer's currency (total_budget, total_budget_guidance,
forecast); no conversion. A declaring seller that cannot plan the cost
target rejects with INVALID_REQUEST naming criteria.outcome_target.cost_per.

- Schema descriptions updated on outcome-target, product-discovery-criteria,
  canonical-proposal, commercial-terms bidding, and the capability flag.
- request_proposals docs gain a Cost targets section with a validated
  request/proposal worked example (3 asked, 4.50 answered).
- media_buy_seller/outcome_target storyboard adds three phases: cost cap on a
  budget, volume at a cost cap without a budget range, and EUR rejection
  against the USD-only fixture.
- Training agent plans cost targets deterministically from the fixture CPM
  and response-rate constants, with unit tests.

Part of #7676

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Applies the protocol review of the outcome_target cost_per slice.

- The answered bidding.cost_per.amount is never below the ask: the
  requested amount when plannable, otherwise the lowest plannable amount.
- A fourth request shape is defined: cost_per with neither volume nor
  budget plans the deliverable volume at the cost and states the spend in
  total_budget_guidance. Budget ranges use max, else min, and total_budget
  stays within both bounds.
- Goal binding covers both allocation modes: no purchase-level bidding;
  each purchase's primary goal (fixed) or budget_allocation's primary goal
  (seller_optimized) matches the outcome goal; seller qualifiers are
  permitted. Event goals bind through account-registered event sources with
  a stated attribution window, or are rejected.
- Answers stay inside the seller's advertised features.bidding_policy
  profile; a declaring seller without one rejects with INVALID_REQUEST
  naming criteria.outcome_target.cost_per. INVALID_REQUEST covers targets
  that cannot be represented or bound; outcome "rejected" covers a valid
  target with no inventory. Currency conflicts (budget_range,
  pricing_currencies, account, product pricing) are INVALID_REQUEST.
- The answer currency is anchored on purchases[].pricing.currency;
  total_budget and total_budget_guidance must match when present.
- The outcome-target root description is cut to pointers; rules live on
  the properties and in the docs. strength is pinned to BiddingPolicy's
  enum by test.
- Storyboard: the answering phases are gated on fixed media-buy cost-cap
  support; the currency rejection carries a matching EUR budget range and
  stays required; pricing currency is asserted, total_budget when present.
- Training agent: advertises fixed media-buy cost_per (cap, target) on 3.2
  responses, binds event goals to registered sources, plans the no-budget
  shape, and rejects canonical bidding outside the profile or a fixed
  media-buy cost_per across incompatible result units on create_media_buy,
  which makes media_buy_seller/bidding_cost_binding run and pass.

Part of #7676

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

@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: Escalate to human review

Escalate — gated schema paths require human/CODEOWNERS review.

This PR modifies files under static/schemas/source/**, which are under a hard, deterministic approval gate (gated_paths: true). The current review_decision is REVIEW_REQUIRED, not APPROVED, so the gate is not satisfied (decision table row 2).

The reviewer found no Critical/High/Medium findings — the additive cost outcome target is coherent across schema, docs, capability object, compliance scenario, and the training-agent reference implementation; the volume required→optional shift via anyOf preserves existing-document validity; and the minor changeset is correct for a non-breaking Normative change. On the merits this diff looks clean, but the gate lifts only when a human/CODEOWNERS approval lands.

Escalation reasons

  • Modifies gated schema files (static/schemas/source/core/canonical-proposal.json, commercial-terms.json, outcome-target.json, product-discovery-criteria.json, get-adcp-capabilities-response.json) while review_decision is REVIEW_REQUIRED — human/CODEOWNERS review required.

Why human review

  • Modifies gated paths under static/schemas/source/** while review_decision is REVIEW_REQUIRED (not APPROVED) — human/CODEOWNERS approval required before merge (decision table row 2).
  • This PR touches a path under a hard, non-overridable approval gate (static/schemas/source/core/canonical-proposal.json (modified) matches static/schemas/source/**; static/schemas/source/media-buy/commercial-terms.json (modified) matches static/schemas/source/**; static/schemas/source/media-buy/outcome-target.json (modified) matches static/schemas/source/**; static/schemas/source/media-buy/product-discovery-criteria.json (modified) matches static/schemas/source/**; static/schemas/source/protocol/get-adcp-capabilities-response.json (modified) matches static/schemas/source/**) and the current GitHub review decision is 'REVIEW_REQUIRED', not APPROVED. This is a hard gate enforced in code — Ladon cannot auto-approve until a human/CODEOWNERS approval is recorded, regardless of how clean the diff is.

@aao-secretariat aao-secretariat Bot added the ladon/needs-human-review Ladon has escalated this PR for human review. label Sep 30, 2026
…ions

CI regressions:
- Python SDK codegen: cost_per and its strength enum are now named
  definitions (outcome_target_cost_per, outcome_target_cost_strength), so
  datamodel-codegen emits OutcomeTargetCostPer/OutcomeTargetCostStrength
  instead of a second CostPer/Strength. JSON Schema titles alone do not
  change generated class names. A test pins the strength values to
  BiddingPolicy's.
- docs-json-field-audit treats an object whose additionalProperties is a
  schema as an open map and audits its values against that schema, which
  clears the forecast metrics false positive. The script now exports its
  audit functions for a new unit test.
- 3.0 storyboard compat: features.bidding_policy leaked into frozen 3.0
  capability projections on routes that resolve a newer served version
  (signed_requests-strict-required on every tenant). Both capability paths
  now gate on 3.0 compat; a tenant-router test covers all tenants.

Protocol and workflow review:
- Result-unit matching follows BiddingPolicy exactly; event goals carry
  event_type/custom_event_name on each event_sources[] entry with one
  resolved attribution_window.
- "Plannable" is defined against the buyer budget (and budget_range.min);
  forecast points carry metrics.spend when the planned spend is below
  total_budget; extra proposals at higher amounts are allowed.
- Event sources may be buyer-synced or seller-managed; exactly one unless
  multi_source_event_dedup is advertised; the stated attribution window
  SHOULD be an advertised one.
- The no-volume, no-budget shape MUST state spend; budget bounds use max,
  else at or above min. The answer is documented as an execution control,
  not a price. list_products gives outcome_target no answer.
- Conformance: the gated cost phases plan against a new auction-priced USD
  fixture, assert the answer is not below the ask and that purchases carry
  no bidding; the currency rejection drops its budget range.

Reference agent:
- The answered amount is max(ask, plannable cost rounded up to the cent);
  the ask is never rounded. Plans that buy less than one result are dropped,
  returning outcome "rejected" when none remain.
- The advertised profile adds package fixed bid_amount/max_bid, which
  buy_products already accepted, so those purchases keep working; bidding
  errors on buy_products name purchases[i].bidding.
- One event source per event goal, resolved attribution-window comparison,
  advertised attribution window, CPM-preferred pricing selection, forecast
  points capped at the budget ceiling, and clearer messages.
- The media-buy MCP model-context budget moves from 442 to 443 KiB,
  measured at 442.4 KiB.

Part of #7676

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

@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: Escalate to human review

Escalate — gated schema paths require human/CODEOWNERS approval.

This PR modifies files under static/schemas/source/**, which are under a hard, non-overridable approval gate (gated_paths: true). The current review_decision is REVIEW_REQUIRED, not APPROVED, so decision table row 2 fires: Ladon cannot auto-approve until a human/CODEOWNERS approval is recorded, regardless of how clean the diff is.

The reviewer's delta pass surfaced no new critical/high/medium findings — the outcome-target.json refactor (cost_per/strength into named definitions) is semantically identical, metrics.spend is on-schema, schema↔docs coherence holds, the changeset is correctly scoped as a non-breaking additive minor, no new undiscriminated oneOf, and no dist artifact mutation. The diff is clean, but the gate stands independent of diff quality.

Escalation reasons

  • Modifies gated paths under static/schemas/source/** (canonical-proposal.json, commercial-terms.json, outcome-target.json, product-discovery-criteria.json, get-adcp-capabilities-response.json) while review_decision is REVIEW_REQUIRED — human/CODEOWNERS approval required before merge (row 2).

Why human review

  • Modifies gated paths under static/schemas/source/** (canonical-proposal.json, commercial-terms.json, outcome-target.json, product-discovery-criteria.json, get-adcp-capabilities-response.json) while review_decision is REVIEW_REQUIRED (not APPROVED) — human/CODEOWNERS approval required before merge (decision table row 2).
  • This PR touches a path under a hard, non-overridable approval gate (static/schemas/source/core/canonical-proposal.json (modified) matches static/schemas/source/**; static/schemas/source/media-buy/commercial-terms.json (modified) matches static/schemas/source/**; static/schemas/source/media-buy/outcome-target.json (modified) matches static/schemas/source/**; static/schemas/source/media-buy/product-discovery-criteria.json (modified) matches static/schemas/source/**; static/schemas/source/protocol/get-adcp-capabilities-response.json (modified) matches static/schemas/source/**) and the current GitHub review decision is 'REVIEW_REQUIRED', not APPROVED. This is a hard gate enforced in code — Ladon cannot auto-approve until a human/CODEOWNERS approval is recorded, regardless of how clean the diff is.

The TypeScript SDK generator failed with "OutcomeTargetCostPerSchema is not
defined". Its zod post-processing replaces everything between
CompatibilityPurchaseCoordinatorInputSchema and OutcomeTargetSchema, so any
dependency of OutcomeTarget emitted just before it is deleted. That happened
both to the local #/definitions entry and to a media-buy/ sibling file,
which the gap-schema pass also emits right before outcome-target.json.

Use the repo's cross-file pattern, placed so the generated schema lands
outside that window:
- core/outcome-target-cost-per.json ("Outcome Target Cost Per", next to
  core/bidding-policy.json) holds amount, currency, and strength with the
  same descriptions.
- enums/outcome-target-cost-strength.json holds cap/target; a test still
  pins its values to BiddingPolicy.cost_per.strength.
- Both are registered in index.json. The MCP schema analysis pins move to
  184 unique definitions and 678 instances; the model-context budget comment
  is re-measured at 452,953 bytes, within 443 KiB.

Verified locally against a PR bundle built from this tree: the TypeScript
SDK's sync-schemas, generate-types, validate-schemas, and build:lib all
pass. The Python SDK's regenerate-schemas (including the collision guard)
and validate-generated pass, and test_code_generation plus
test_schemas_version_pin pass, with distinct OutcomeTargetCostPer and
OutcomeTargetCostStrength types and bidding_policy unchanged.

Part of #7676

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>

@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: Escalate to human review

Escalate — gated schema paths require human/CODEOWNERS approval.

This PR modifies files under static/schemas/source/**, which are under a hard, non-overridable approval gate (gated_paths: true). The current review_decision is REVIEW_REQUIRED, not APPROVED. Per decision table row 2, this must escalate until a human/CODEOWNERS approval is recorded — regardless of how clean the diff is.

The reviewer's delta pass found the change to be a clean structural refactor (lifting inline outcome_target.cost_per definitions into standalone core/outcome-target-cost-per.json and enums/outcome-target-cost-strength.json; wire shape unchanged, index.json registration complete, no dangling refs, description text byte-identical). No critical/high/medium findings, and the prior escalation carried no findings either. The escalation here is purely the gated-path/approval-status gate, not a code defect.

Escalation reasons

  • Modifies gated paths under static/schemas/source/** (canonical-proposal.json, commercial-terms.json, outcome-target.json, product-discovery-criteria.json, get-adcp-capabilities-response.json, index.json + two new files) while review_decision is REVIEW_REQUIRED, not APPROVED. Human/CODEOWNERS approval required before merge (decision table row 2).

Why human review

  • Modifies gated paths under static/schemas/source/** (canonical-proposal.json, commercial-terms.json, outcome-target.json, product-discovery-criteria.json, get-adcp-capabilities-response.json, index.json, plus new outcome-target-cost-per.json and outcome-target-cost-strength.json) while review_decision is REVIEW_REQUIRED, not APPROVED — human/CODEOWNERS approval required before merge (decision table row 2).
  • This PR touches a path under a hard, non-overridable approval gate (static/schemas/source/core/canonical-proposal.json (modified) matches static/schemas/source/**; static/schemas/source/core/outcome-target-cost-per.json (added) matches static/schemas/source/**; static/schemas/source/enums/outcome-target-cost-strength.json (added) matches static/schemas/source/**; static/schemas/source/index.json (modified) matches static/schemas/source/**; static/schemas/source/media-buy/commercial-terms.json (modified) matches static/schemas/source/**; static/schemas/source/media-buy/outcome-target.json (modified) matches static/schemas/source/**; static/schemas/source/media-buy/product-discovery-criteria.json (modified) matches static/schemas/source/**; static/schemas/source/protocol/get-adcp-capabilities-response.json (modified) matches static/schemas/source/**) and the current GitHub review decision is 'REVIEW_REQUIRED', not APPROVED. This is a hard gate enforced in code — Ladon cannot auto-approve until a human/CODEOWNERS approval is recorded, regardless of how clean the diff is.

@bokelley
bokelley merged commit 7ad0230 into main Sep 30, 2026
64 checks passed
@bokelley
bokelley deleted the feat/outcome-target-cost-per branch September 30, 2026 08:04
bokelley added a commit that referenced this pull request Sep 30, 2026
… and cost targets

Keep the GA wording over main's rc.53 pin bumps in the docs pages, and keep
main's exact rc.53 pins in Addie certification text until @adcp/sdk 14.0.0
publishes. Add #7774 (experimental execution requirements) and #7778
(outcome_target cost_per) to the 3.2.1 release notes and what's new.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
bokelley added a commit that referenced this pull request Sep 30, 2026
GA wording for release notes, what's new, migration guide, versions,
versioning, roadmap, intro, FAQ and long-tail pages; 3-2-beta becomes
"AdCP 3.2 prerelease history"; docs.json banner; RELEASING.md and playbook
release topology; GA homepage strip (new dismissal cookie); Addie knowledge
snapshot and GA curriculum wording migration (613); CODE_VERSION bump; patch
changeset. The docs.json default-version flip is left to release-docs.yml
at the v3.2.1 tag.

Release notes also cover the GA-day fixes: governance storyboards (#7788,
#7803), brand-rights interim fix (#7792), strict sf-binary under the 3.2
signing profile (adcp-client#3073), execution requirements (#7774), cost
targets (#7778, #7799).

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
bokelley added a commit that referenced this pull request Sep 30, 2026
GA wording for release notes, what's new, migration guide, versions,
versioning, roadmap, intro, FAQ and long-tail pages; 3-2-beta becomes
"AdCP 3.2 prerelease history"; docs.json banner; RELEASING.md and playbook
release topology; GA homepage strip (new dismissal cookie); Addie knowledge
snapshot and GA curriculum wording migration (613); CODE_VERSION bump; patch
changeset. The docs.json default-version flip is left to release-docs.yml
at the v3.2.1 tag.

Release notes also cover the GA-day fixes: governance storyboards (#7788,
#7803), brand-rights interim fix (#7792), strict sf-binary under the 3.2
signing profile (adcp-client#3073), execution requirements (#7774), cost
targets (#7778, #7799).

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ladon/needs-human-review Ladon has escalated this PR for human review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant