Skip to content

feat(schema): PROPOSAL_TERMS_CHANGED for a mismatched accept_proposal digest - #9171

Merged
bokelley merged 1 commit into
mainfrom
fix/proposal-terms-changed-9168
Nov 22, 2026
Merged

bokelley merged 1 commit into
mainfrom
fix/proposal-terms-changed-9168

Conversation

@bokelley

Copy link
Copy Markdown
Contributor

Closes #9168.

What

A standard error code for an accept_proposal whose proposal_terms_digest does not match the committed proposal's current terms_digest, for 3.3.0-rc.3.

  • PROPOSAL_TERMS_CHANGED in enums/error-code.json (enum, enumDescriptions, enumMetadata), recovery correctable. It covers a stale or wrong digest, terms the seller re-committed under the same proposal_id, and a proposal already accepted under a different digest. Nothing is accepted. Sellers SHOULD set error.field to proposal_terms_digest.
  • Recovery. Re-read the proposal. If it is accepted, don't accept again: find the existing MediaBuy through get_media_buys. Otherwise, if the current terms are acceptable, accept them with the current digest and a fresh idempotency_key. Never resend the rejected digest.
  • Precedence. IDEMPOTENCY_CONFLICT and the proposal-state codes (PROPOSAL_NOT_FOUND, PROPOSAL_EXPIRED, PROPOSAL_NOT_COMMITTED, INVALID_STATE for a declined or withdrawn proposal) come first.
  • Spec text. proposal_terms_digest in accept-proposal-request.json and a new "Terms digest mismatch" section in accept_proposal.mdx (placed before "Accepting a seller offer"). The 3.2 MUST to refuse a mismatch and accept nothing is unchanged. The code is a SHOULD. Sellers on earlier releases may use another code, so buyers act on recovery and field.
  • Code listings. L3 error-handling table, the transport-errors CODE_RECOVERY map, the generated compliance error-code snippet (npm run build:compliance), the 3.0.x drift dispositions, release notes (feature index and "Behavior changes to review"), whats-new, and the 3.2→3.3 migration guide (checklist row 62 and "SDK and code-generator maintainers").
  • Conformance. media_buy_seller/compact_product_lifecycle 1.3.0 adds a terms_digest_mismatch phase before the real acceptance. Required: the wrong-digest accept is refused (any error), and the following real acceptance with the correct digest succeeds, which proves the proposal wasn't accepted. Advisory (permanent_advisory, reported but not failing): code PROPOSAL_TERMS_CHANGED, plus recovery correctable and field proposal_terms_digest on whichever error shape is present (adcp_error or errors[0]), via field_value_or_absent. A transient recovery (for example CONFLICT) is reported. No new MUST is added during the RC.
  • Training agent. It returns PROPOSAL_TERMS_CHANGED with recovery and field. Check order: not found, then declined, then accepted with the matching digest (INVALID_STATE), then not committed, then expired, then digest mismatch. A proposal accepted under a different digest now falls through to PROPOSAL_TERMS_CHANGED after the state checks. The deprecated create_media_buy proposal path uses the same order.
  • Exact-count pin media_buy_seller/compact_product_lifecycle goes from 10:0 to 11:0 in scripts/run-storyboards-matrix.sh and .github/workflows/training-agent-storyboards.yml.

error.code is an open string, so no payload validates differently. lint:additive-minor (source vs 3.2.12) reports 0 non-additive changes. scripts/schema-equivalence/cli.cjs is not on main, so it was not run.

Follow-up

Verification

  • npm run build:schemas, npm run build:compliance, npm run test:compliance-snippets (current)
  • npm run test:schemas passed. test:error-codes, test:error-code-drift (81 ahead, 0 warnings), test:error-handling, test:docs-error-handling-copy, tests/error-recovery-vectors.test.cjs, tests/transport-error-mapping.test.cjs, and test:sdk-response-conformance all passed.
  • All scripts/lint-storyboard-*.cjs and every test:storyboard-* suite passed. tests/compact-product-lifecycle-storyboards.test.cjs has a new test for the refusal phase.
  • compact_product_lifecycle against the /sales training agent with the CI env (candidate-version mode) ran clean: 11P / 0S. Two simulations of an older seller also ran clean, 11P: one returning CONFLICT/transient, with the code and recovery advisories reported; one returning INVALID_REQUEST with the field set.
  • tenant-smoke.test.ts covers the wrong digest before acceptance and after it. With server/tests/unit/training-agent.test.ts: 885 passed. tsc is clean.
  • Pushed with ADCP_SKIP_STORYBOARD_MATRIX=1.

🤖 Generated with Claude Code

… digest (#9168)

Adds the PROPOSAL_TERMS_CHANGED standard error code (recovery correctable)
for an accept_proposal whose proposal_terms_digest does not match the
committed proposal's current terms_digest, including a proposal already
accepted under a different digest. The schema and task docs say a mismatch
MUST be refused with nothing accepted, SHOULD use the new code with
field proposal_terms_digest, and rank after IDEMPOTENCY_CONFLICT and the
proposal-state codes. The buyer re-reads the proposal: an accepted one is
found through get_media_buys; otherwise it accepts the current terms with
the current digest and a fresh idempotency_key.

compact_product_lifecycle 1.3.0 refuses a mismatched digest before the
real acceptance; code, recovery and field are advisory. The training agent
returns the new code in the documented check order.

Co-Authored-By: Claude Opus 5.5 <[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 paths require human/CODEOWNERS approval.

This PR adds the PROPOSAL_TERMS_CHANGED error code. The reviewer found no Critical/High/Medium findings: schema↔docs coherence holds across all seven surfaces, an additive patch changeset is present (new enum value, non-breaking), the storyboard/matrix/workflow step counts are updated consistently, and smoke + unit tests cover both the committed and already-accepted mismatch paths. The digest-mismatch precedence correctly routes to PROPOSAL_TERMS_CHANGED over the already-accepted INVALID_STATE.

However, the PR touches hard-gated paths (gated_paths: true):

  • .github/workflows/training-agent-storyboards.yml (matches .github/workflows/**)
  • static/schemas/source/enums/error-code.json (matches static/schemas/source/**)
  • static/schemas/source/media-buy/accept-proposal-request.json (matches static/schemas/source/**)

Per decision table row 2, because gated_paths is true AND review_decision is REVIEW_REQUIRED (not APPROVED), the outcome must be escalate. Human/CODEOWNERS review is required before this can merge. Once a real review approval lands, the diff is clean and would otherwise fall through to approve.

Escalation reasons

  • Gated files require human/CODEOWNERS approval: .github/workflows/training-agent-storyboards.yml, static/schemas/source/enums/error-code.json, static/schemas/source/media-buy/accept-proposal-request.json — review_decision is REVIEW_REQUIRED.

Why human review

  • Gated path touched: .github/workflows/training-agent-storyboards.yml (matches .github/workflows/**) — human/CODEOWNERS approval required; review_decision is REVIEW_REQUIRED, not APPROVED
  • Gated path touched: static/schemas/source/enums/error-code.json (matches static/schemas/source/**) — human/CODEOWNERS approval required
  • Gated path touched: static/schemas/source/media-buy/accept-proposal-request.json (matches static/schemas/source/**) — human/CODEOWNERS approval required
  • This PR touches a path under a hard, non-overridable approval gate (.github/workflows/training-agent-storyboards.yml (modified) matches .github/workflows/**; static/schemas/source/enums/error-code.json (modified) matches static/schemas/source/**; static/schemas/source/media-buy/accept-proposal-request.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 Nov 22, 2026
@bokelley
bokelley merged commit 2db59ba into main Nov 22, 2026
71 of 72 checks passed
@bokelley
bokelley deleted the fix/proposal-terms-changed-9168 branch November 22, 2026 13:37
KonstantinMirin added a commit to KonstantinMirin/adcp that referenced this pull request Nov 22, 2026
…dcontextprotocol#9169, adcontextprotocol#9171)

Brings in adcontextprotocol#9169 (inventory get_products filters by required_metrics;
the inventory storyboard floors rise) and adcontextprotocol#9171 (accept_proposal and
create_media_buy refuse a mismatched terms digest with
PROPOSAL_TERMS_CHANGED; compact_product_lifecycle gains its 11th step).

Resolution ledger:
- mechanical: none.
- semantic: none. git merged the four files both sides changed with no
  conflicts, and the hunks are disjoint:
  - scripts/run-storyboards-matrix.sh: main raises the
    compact_product_lifecycle exact count to 11 steps; this branch's
    changes are the queue and the build cache.
  - server/src/training-agent/task-handlers.ts: main changes the
    terms-digest checks and exports reportingMetricIsAvailable; this
    branch's changes are the imports and the lazy product-discovery
    input schemas.
  - server/src/training-agent/tenants/tenant-smoke.test.ts and
    server/tests/unit/training-agent-inventory-tenants.test.ts: main
    adds tests beside this branch's loopback-server and reset changes.
- The CI-only inventory floors in training-agent-storyboards.yml come in
  unchanged; the local pre-push queue has no inventory floors.

Checks on the merge result:
- npm run typecheck: pass.
- node --test tests/compact-product-lifecycle-storyboards.test.cjs
  tests/run-storyboards-sharding.test.cjs: pass.
- node scripts/precommit-server-unit.cjs --full: 867 files, 14,718
  tests, 31 skipped. Before the merge: 14,716; adcontextprotocol#9169 adds two tests.
  One test failed at load 112: the cold-worker exact-inference test,
  whose child hit that test's 25 s kill. Neither merged PR touches it,
  and main has the same 25 s kill.
KonstantinMirin added a commit to KonstantinMirin/adcp that referenced this pull request Nov 22, 2026
Brings in 3 commits from main: adcontextprotocol#9123 (deprecates the single-value
branch of 17 scalar-or-list unions and fixes the bundler so call-site
keys beside a $ref stay at the call site), adcontextprotocol#9169 (training agent
inventory floors) and adcontextprotocol#9171 (PROPOSAL_TERMS_CHANGED for a mismatched
accept_proposal digest).

Resolution ledger

Mechanical files, resolved by rule:
- package.json (conflicted): the test list keeps both sides' entries,
  test:schema-named-constraints from this branch and
  test:build-schemas-exit-status from main. 119 entries, each defined.
- tests/mcp-schema-projection.test.cjs (auto-merged, failed the gate):
  the parity compile limit is the measured comply_test_controller
  projection rounded up to the next 1,000 bytes. Main's deprecation
  descriptions and the new error code bring main's controller from
  1,350,376 to 1,351,064 bytes; this branch's named schemas still add
  79,135, so the merged controller measures 1,430,199 and the limit
  moves from 1,430,000 to 1,431,000.

Semantic files, union of both sides:
- brand.json color_value, brand/get-brand-identity-response.json
  colors (5 sites), error-details/requote-required.json envelope_field:
  this branch's $ref to core/hex-color.json or
  #/definitions/envelope_field_path is kept, and main's deprecated,
  x-deprecated-in, x-removed-in and deprecation description sit beside
  it on the single-value branch. brand.json keeps x-removed-in 5.0.0;
  the others keep 4.0.0. The referenced definitions carry no
  deprecation, so the array branches and the other sites that reference
  them are not deprecated.
- media-buy/accept-proposal-request.json proposal_terms_digest: this
  branch's $ref to core/proposal-terms-digest.json with main's longer
  description from adcontextprotocol#9171.

Proof:
- Schema equivalence, origin/main -> merge, with the delta manifest:
  3,056 entries at 41 sites and 4,255 informational entries, the same
  as the branch against its previous merge base; the manifest matches,
  41/41 witnesses pass, and no corpus instance changes verdict.
- The annotation channel at source level is the union of both sides:
  each of main's 77 annotation changes (title, description, default,
  deprecated, x-*) lands at the same document and pointer in the merge,
  and each of this branch's 1,636 stays relative to main.
- Bundles: the 81 single-value deprecation nodes in the bundled schemas
  sit at the same pointers with the same keys as main's build, and none
  moves onto a shared definition.
- Inline pattern and enum counts stay at 83 and 471, and the $ref count
  is unchanged.
KonstantinMirin added a commit to KonstantinMirin/adcp that referenced this pull request Nov 22, 2026
Brings in 6 commits from main: adcontextprotocol#9123 (deprecates the single-value form
of the scalar-or-list unions), adcontextprotocol#9169 (training agent inventory floors),
adcontextprotocol#9171 (PROPOSAL_TERMS_CHANGED), adcontextprotocol#9170 (not-guards that resolve 11
overlapping oneOf unions, with tests/oneof-overlap-resolution.test.cjs),
adcontextprotocol#9141 (3.3.0-rc.3 version packages) and adcontextprotocol#9176 (rc.3 docs snapshot).

Resolution ledger:
- package.json (conflicted): test:schemas keeps both sides' entries,
  the two equivalence tests from this branch and
  tests/oneof-overlap-resolution.test.cjs from main, at main's
  position. Main's test:build-schemas-exit-status auto-merged. Every
  test file it names exists. The version (3.3.0-rc.3) is main's.
- package-lock.json: main's (version field only).
- Invariants: no code change needed. The oneof check at the merged
  tree reports 223 reachable oneOfs, P 219, W 4, U 0, the same as main
  at 14651cc; adcontextprotocol#9170 resolves 12 of the 16 witnessed overlaps
  (main at 2db59ba, after adcontextprotocol#9123, still has 16). The 4 left are the either/or unions adcontextprotocol#9170 leaves for
  adcontextprotocol#8191. The construct catalog still reports its 37 known false
  alarms and no misses, and tests/oneof-overlap-resolution.test.cjs
  passes (38 of 38).
- Proof: schema equivalence of the merged tree against 14651cc:
  1113 roots, 0 differ, class 1, no informational entries.
KonstantinMirin added a commit to KonstantinMirin/adcp that referenced this pull request Nov 22, 2026
Brings in 6 commits from main: adcontextprotocol#9123 (deprecates the single-value form
of the scalar-or-list unions), adcontextprotocol#9169 (training agent inventory floors),
adcontextprotocol#9171 (PROPOSAL_TERMS_CHANGED), adcontextprotocol#9170 (not-guards that resolve 11
overlapping oneOf unions, with tests/oneof-overlap-resolution.test.cjs),
adcontextprotocol#9141 (3.3.0-rc.3 version packages) and adcontextprotocol#9176 (rc.3 docs snapshot).

Resolution ledger:
- package.json (conflicted): test:schemas keeps both sides' entries,
  the five lint tests from this branch and
  tests/oneof-overlap-resolution.test.cjs from main, at main's
  position. Main's test:build-schemas-exit-status auto-merged. Every
  test file it names exists. The version (3.3.0-rc.3) is main's.
- package-lock.json: main's (version field only).
- Baseline: adcontextprotocol#9170's error-branch guards are local refs to #/oneOf/0,
  which the schema-path lint reports as ref-local-not-defs. They are
  main's schemas, so the seven findings are recorded in
  scripts/lint-schema-paths-baseline.json with --update-baseline
  rather than changed here:
  - adagents.json#/oneOf/1/not/$ref
  - content-standards/{calibrate-content,create-content-standards,
    get-content-standards,get-media-buy-artifacts,
    list-content-standards,validate-content-delivery}-response.json
    #/oneOf/1/not/$ref
  Schema paths go from 593 to 600. The other four lints are unchanged:
  enum values 58, property names 820, value lists 24,
  x-adcp-validation 337.
- Proof: schema equivalence against 14651cc: 1113 roots, 0 differ,
  class 1; 158 informational x-adcp-validation entries at 18 sites,
  as before.
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.

accept_proposal: no error code for a proposal_terms_digest that doesn't match the committed proposal

1 participant