Repository navigation
feat(schema): PROPOSAL_TERMS_CHANGED for a mismatched accept_proposal digest - #9171
Conversation
… 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]>
There was a problem hiding this comment.
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(matchesstatic/schemas/source/**)static/schemas/source/media-buy/accept-proposal-request.json(matchesstatic/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_decisionisREVIEW_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) matchesstatic/schemas/source/**; static/schemas/source/media-buy/accept-proposal-request.json (modified) matchesstatic/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.
…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.
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.
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.
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.
Closes #9168.
What
A standard error code for an
accept_proposalwhoseproposal_terms_digestdoes not match the committed proposal's currentterms_digest, for 3.3.0-rc.3.PROPOSAL_TERMS_CHANGEDinenums/error-code.json(enum,enumDescriptions,enumMetadata), recoverycorrectable. It covers a stale or wrong digest, terms the seller re-committed under the sameproposal_id, and a proposal already accepted under a different digest. Nothing is accepted. Sellers SHOULD seterror.fieldtoproposal_terms_digest.accepted, don't accept again: find the existing MediaBuy throughget_media_buys. Otherwise, if the current terms are acceptable, accept them with the current digest and a freshidempotency_key. Never resend the rejected digest.IDEMPOTENCY_CONFLICTand the proposal-state codes (PROPOSAL_NOT_FOUND,PROPOSAL_EXPIRED,PROPOSAL_NOT_COMMITTED,INVALID_STATEfor a declined or withdrawn proposal) come first.proposal_terms_digestinaccept-proposal-request.jsonand a new "Terms digest mismatch" section inaccept_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 onrecoveryandfield.CODE_RECOVERYmap, 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").media_buy_seller/compact_product_lifecycle1.3.0 adds aterms_digest_mismatchphase 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): codePROPOSAL_TERMS_CHANGED, plus recoverycorrectableand fieldproposal_terms_digeston whichever error shape is present (adcp_errororerrors[0]), viafield_value_or_absent. A transient recovery (for exampleCONFLICT) is reported. No new MUST is added during the RC.PROPOSAL_TERMS_CHANGEDwithrecoveryandfield. 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 toPROPOSAL_TERMS_CHANGEDafter the state checks. The deprecatedcreate_media_buyproposal path uses the same order.media_buy_seller/compact_product_lifecyclegoes from10:0to11:0inscripts/run-storyboards-matrix.shand.github/workflows/training-agent-storyboards.yml.error.codeis 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.cjsis not onmain, so it was not run.Follow-up
PROPOSAL_TERMS_CHANGEDto the SDK's knownErrorCodetable.@adcp/sdk17.0.0-beta.32 logs "not in the known ErrorCode set" when the training agent returns the code. The response itself is unaffected.Verification
npm run build:schemas,npm run build:compliance,npm run test:compliance-snippets(current)npm run test:schemaspassed.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, andtest:sdk-response-conformanceall passed.scripts/lint-storyboard-*.cjsand everytest:storyboard-*suite passed.tests/compact-product-lifecycle-storyboards.test.cjshas a new test for the refusal phase.compact_product_lifecycleagainst the/salestraining agent with the CI env (candidate-version mode) ran clean: 11P / 0S. Two simulations of an older seller also ran clean, 11P: one returningCONFLICT/transient, with the code and recovery advisories reported; one returningINVALID_REQUESTwith the field set.tenant-smoke.test.tscovers the wrong digest before acceptance and after it. Withserver/tests/unit/training-agent.test.ts: 885 passed.tscis clean.ADCP_SKIP_STORYBOARD_MATRIX=1.🤖 Generated with Claude Code