Repository navigation
fix(validation): stop stripping task-envelope status and relaxing response roots (#3481) - #3493
Conversation
…ponse roots (#3481) `status` has been REQUIRED on every task response since 3.1 (core/protocol-envelope.json). The closed 3.2.x compact schemas only omitted it by not composing the envelope; 3.3 (adcontextprotocol/adcp#8547) composes it into every response root. - Server: list_products / decline_proposals / list_collections / list_proposals keep `status`. It is omitted only when the served release's own published schema for the tool has no `status` (3.2.x), decided from the schema rather than a version number. - Validation: remove relaxResponseRoot(). A bundle that composes the envelope is validated as published. For closed pre-composition roots (3.2.7 and earlier) only the envelope fields that release defines are accepted on the closed nodes; body typos are still rejected and no field is added or removed. - injectLegacyEnvelopeStatus never synthesizes status for the compact tools. - Zod generator: follow named-schema references for array bounds, keep ProtocolEnvelope.and(union) bodies, and support both compact-envelope layouts so types generate from an envelope-composing bundle. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
|
Ladon cannot review this PR until merge conflicts are resolved. |
Take main's named-schema array-bound fix (#3487) and keep only the envelope-specific generator changes. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
| const loader = require('../validation/schema-loader') as typeof import('../validation/schema-loader'); | ||
| const omits = loader.responseSchemaComposesEnvelope(toolName, servedVersion) === false; | ||
| // Bundles are immutable for a process except when a test or runner registers an | ||
| // external root, which changes what the same version string resolves to. |
There was a problem hiding this comment.
Medium: The write is guarded against external schema roots; the read above (if (cached !== undefined) return cached) is not. If omitsEnvelopeStatusForRelease(tool, V) is called once with no external root active for V (caching the pinned-bundle answer), then again inside withExternalSchemaRoot(V, composedRoot, …) / after registerExternalSchemaRoot, the cache returns the stale pre-external answer even though the active bundle now composes the envelope. The storyboard runner validates multiple versions with and without external roots in one process, so this can strip or keep status on list_products/decline_proposals against the wrong schema. Skip the cache (or key on the resolved bundle/root) when isExternalSchemaRootActive(servedVersion) on the read path too.
There was a problem hiding this comment.
Ladon verdict: Approve
Approve — task-envelope status preservation (#3481) is sound with one non-blocking medium.
What I checked
acceptEnvelopeOnClosedResponseRootcorrectly narrows the old blanketadditionalProperties:truerelaxation to add only the release's ownprotocol-envelope.jsonfields to closed pre-composition roots — body typos still rejected, composing bundles untouched. Wire-shape fidelity preserved (witness-not-translator respected).- Changeset correctness: the
minorchangeset in.changeset/preserve-task-envelope-status.mdis appropriate. RemovedrelaxResponseRoot/STATUS_FREE_SYNC_RESPONSE_TOOLSsymbols are not in the public barrel, andinjectLegacyEnvelopeStatusbehavior is preserved viaCOMPACT_SYNC_RESPONSE_TOOLS. No changeset understatement. - No official-transport-client or version-pathway concerns in this diff.
Medium findings (non-blocking)
- src/lib/utils/envelope-status-compat.ts:90 —
omitsStatusCacheread path not guarded against external schema roots the way the write path is; storyboard runner can get a stale status-strip/keep answer once an external composed bundle is registered after a prior lookup.
Decision trace: no critical/high findings (row 1 n/a); gated_paths false (row 2 n/a); high_risk false (rows 3,5 n/a); the single medium is category LLM-context/cache-scope, not data-loss/schema/infra (row 4 n/a); no prior decision (row 6 n/a); no author team gate (row 7 n/a); only 1 medium, below the 3-medium threshold (row 8 n/a) → row 9 approve.
Note: review_decision is REVIEW_REQUIRED but gated_paths is false, so the hard approval gate does not apply.
Medium findings
- src/lib/utils/envelope-status-compat.ts:90 — omitsStatusCache read path not guarded against external schema roots
|
Heads up: adcontextprotocol/adcp#8547 changed the compact submitted layout after you regenerated against
On #8547's head, "Generate TypeScript SDK" fails with |
|
To be clear about where the problem lies: the schemas aren't wrong now. They were wrong before. The old task response schemas didn't compose the envelope consistently, closed some roots, and copied envelope fields by hand. Generated code built from them couldn't represent a conforming response, so the generators grew patches to compensate:
adcontextprotocol/adcp#8547 fixes the schemas: plain So the fix on the SDK side is to remove them, not to adapt them to the new layout. A generator that maps schema to classes directly through standard |
|
17.0.0-beta.5 went out without this PR. It still ships |
|
Current integration evidence for the remaining generator change: adcontextprotocol/adcp#8547 head Since this candidate was tested, SDK main adopted the signed published protocol 3.3.0-beta.1 in #3503 and released SDK 17.0.0-beta.5 through #3497. Please refresh this branch against that base and repeat its baseline regeneration/library/consumer checks with the published beta.1 pin, plus the exact current #8547 bundle. Keep the protocol pin and generated metadata on that current signed release; no disposable PR bundle should be committed as a published schema cache. Protocol #8547 still has independent Python, server/storyboard and schema-fixture status failures. Clearing this SDK change alone does not clear those gates or imply that the envelope PR is ready to merge. |
|
For the record, here is what each red check on adcontextprotocol/adcp#8547 (
None of them is a schema or fixture problem in #8547. The server and storyboard ones need this PR plus one change on our side. The SDK decides from the published schema for the served release, and 3.3.0-beta.1 predates #8547, so the training agent has to register #8547's built schema root ( |
Keep main's composed-envelope generator handling (#3503) and the schema-driven status gate; retain the named-base union fix. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…entation Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
There was a problem hiding this comment.
Ladon verdict: Approve
Approve — clean, additive AdCP 3.3.0-beta.1 adoption.
This is a subsequent review (prior outcome: approve). The prior Medium finding (envelope-status-compat.ts:90) is not present in the current delta and, per scope rules, is not re-surfaced. The current run surfaces no critical, high, or medium findings.
What I checked:
- Three new tools (request_account, report_media_buy_issue, get_media_buy_issue) wired consistently across typed clients, server handler/tool maps, MUTATING_TASKS, schema maps, entity hydration, and protocol map.
- Per-package creative-delivery projection and the version bump traced; projectAssignedCreative control flow, success-collapse, and the opt-in omit_unstated_size size synthesis are correctly fenced behind explicit seller opt-in — no witness-not-translator violation.
- Changesets present and correctly scoped (minor for beta adoption, patch for the rest) — satisfies changeset-vs-wire-impact.
- request-normalizer correctly exempts request_account's top-level account_id from the legacy account shim (witness-preserving).
Non-blocking follow-up for the author (not a finding): at creative-delivery.ts L44144, refsFromValue(answer)[0] compares only the first resolver ref — confirm multi-ref resolver answers on the missingSelectedMapping branch cannot false-reject.
Gates: gated_paths=false, high_risk=false, no no-auto-approve team match. No findings fire rows 1–8; falls through to row 9 = approve.
…se's schema (#1761) #1754 stamps status on list_products and decline_proposals from 3.3.0-beta.3 by comparing version strings. That leaves three defects for a 3.2.x peer, and a fourth for the next 3.2.x release: - A typed ListProductsResponse dumps its defaulted `status: completed`. A server serving 3.2.x sent it to a closed root that forbids it, so strict response validation failed on a handler that returned the typed model. - Converting a synchronous decline_proposals response from 3.3 to 3.2 raised ADCPVersionConversionError: the 3.2 root permits `status` only as `submitted`, and the converter had no rule for the status that 3.3 requires. - Converting up from 3.2 to 3.3 did not supply the `status` 3.3 requires, so the converted list_products / decline_proposals payload failed 3.3 validation. - A 3.2.x release that composes the envelope (the backport) would still be treated as one that does not. uses_task_status_envelope(tool, version) now asks the served release's own response schema whether it composes core/protocol-envelope.json, as the TypeScript SDK does (adcontextprotocol/adcp-client#3493). The version comparison from #1754 stays as the answer for a release that ships no schema for the tool. The server drops only the typed default `completed` where the served release has none for the tool (a submitted arm keeps its status), and convert_payload supplies `completed` going up and drops it, recorded as a loss, going down. Nothing is stripped for any other tool or release. Co-authored-by: Claude Sonnet 5.5 <[email protected]>
Fixes #3481. Unblocks adcontextprotocol/adcp#8547.
What was wrong
statushas been REQUIRED on every task response since 3.1 (core/protocol-envelope.json). The closed 3.2.x compact schemas only omitted it by not composing the envelope. The SDK turned that gap into policy: it strippedstatusfromlist_products,decline_proposals,list_collectionsandlist_proposals, andrelaxResponseRoot()clearedadditionalProperties: falseon every response root so envelope fields would pass. #8547 composes the envelope into every task response root, so both workarounds are now wrong.What changed
status. A seller omits it only when the served release's own published schema for that tool has nostatus(3.2.xlist_products/decline_proposals: closed, and the decline success arm saysnot: required status). The release's schema decides (omitsEnvelopeStatusForRelease), not a version string, so a 3.2.x backport that composes the envelope flips the answer with no code change.list_collections/list_proposalsare 3.3-only and never gated.relaxResponseRoot()is gone. A bundle that composes the envelope is validated exactly as published,statusrequired. For a closed pre-composition root (3.2.7 and earlier) only the envelope fields that release's ownprotocol-envelope.jsondefines are accepted on the closed nodes: body typos are still rejected, and no field is ever added to or removed from a response.injectLegacyEnvelopeStatusleaves the compact tools alone. The documented 3.0.x shim for payloads that declare themselves 3.0 is unchanged.ProtocolEnvelope.and(union)response bodies are no longer dropped by the never-union strip, and the compact submitted envelope merges for both the old and the composed layouts. This is a no-op against the published 3.3.0-beta.0 bundle (regenerated: no diff).Verified against #8547
Built from #8547's head (
3da19611, bundle from theschema-pr-bundle-9262c774artifact). Generated types carry the envelope fields (ListProductsResponse.status: TaskStatus). Training agent storyboards (current /sales) with this SDK and #8547's built schema root registered:compact_direct_buy_lifecycle,compact_product_lifecycle,declined_proposal_refinement,declined_proposal_execution,outcome_target_list_products_inert,product_coverage_filters,sales_dooh,availability_windowsall clean (0 failed steps). Unmodifiedmainfails the same steps withmust have required property 'status'.Not in this PR
The PR bundle is not committed as the schema root.
schemas/codegen-provenance.jsonneeds a published commit-addressed URL, andadcontextprotocol.org/protocol/pr/<sha>/latest.tgzis only published once #8547's "Validate schema PR bundle" passes (its Generate TypeScript SDK job runs this repo's generator, which this PR fixes; Generate Python SDK is still red). It also carries unrelated protocol-main changes (installments, purchase rights,get_account_requests, ...) that the SDK's fail-closed commercial-terms verifier and client manifest do not know yet. The pin stays on the published 3.3.0-beta.0 bundle, which forbidsstatuson these arms, so the default pin keeps omitting it until the pin moves to beta.1 or a composed bundle.Tests
test/lib/response-envelope-status-gating.test.js: 3.2.x validateslist_products/decline_proposalswithoutstatus; a composed release requires and preserves it and accepts every envelope field (runs against the pinned bundle once it composes, or setADCP_COMPOSED_ENVELOPE_SCHEMA_ROOTto an unpacked #8547schemas/; 21/21 locally with it).statusis emitted exactly when the pinned release composes the envelope, and omitted on a 3.2 server.main(environmental, no Postgres in the sandbox).🤖 Generated with Claude Code
Open workspace in Conductor