Skip to content

fix(validation): stop stripping task-envelope status and relaxing response roots (#3481) - #3493

Merged
bokelley merged 4 commits into
mainfrom
conductor/beirut
Oct 29, 2026
Merged

bokelley merged 4 commits into
mainfrom
conductor/beirut

Conversation

@bokelley

@bokelley bokelley commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #3481. Unblocks adcontextprotocol/adcp#8547.

What was wrong

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. The SDK turned that gap into policy: it stripped status from list_products, decline_proposals, list_collections and list_proposals, and relaxResponseRoot() cleared additionalProperties: false on 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

  • No stripping. The four tools keep status. A seller omits it only when the served release's own published schema for that tool has no status (3.2.x list_products / decline_proposals: closed, and the decline success arm says not: 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_proposals are 3.3-only and never gated.
  • No relaxing. relaxResponseRoot() is gone. A bundle that composes the envelope is validated exactly as published, status required. For a closed pre-composition root (3.2.7 and earlier) only the envelope fields that release's own protocol-envelope.json defines are accepted on the closed nodes: body typos are still rejected, and no field is ever added to or removed from a response.
  • Never filled in. injectLegacyEnvelopeStatus leaves the compact tools alone. The documented 3.0.x shim for payloads that declare themselves 3.0 is unchanged.
  • Zod generator. Types generate from an envelope-composing bundle: named-schema references are followed for array bounds, 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 the schema-pr-bundle-9262c774 artifact). 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_windows all clean (0 failed steps). Unmodified main fails the same steps with must have required property 'status'.

Not in this PR

The PR bundle is not committed as the schema root. schemas/codegen-provenance.json needs a published commit-addressed URL, and adcontextprotocol.org/protocol/pr/<sha>/latest.tgz is 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 forbids status on 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 validates list_products / decline_proposals without status; a composed release requires and preserves it and accepts every envelope field (runs against the pinned bundle once it composes, or set ADCP_COMPOSED_ENVELOPE_SCHEMA_ROOT to an unpacked #8547 schemas/; 21/21 locally with it).
  • Server tests assert status is emitted exactly when the pinned release composes the envelope, and omitted on a 3.2 server.
  • Generator tests for both compact-envelope layouts, named-reference array bounds, and the named-base union.
  • Tests that asserted the removed relaxation (arbitrary root fields accepted) now assert the new contract.
  • Fast and slow groups: failures are identical to unmodified main (environmental, no Postgres in the sandbox).

🤖 Generated with Claude Code


Open workspace in Conductor

…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]>
@aao-secretariat

Copy link
Copy Markdown

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.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

aao-secretariat[bot]
aao-secretariat Bot previously approved these changes Oct 28, 2026

@aao-secretariat aao-secretariat Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ladon verdict: Approve

Approve — task-envelope status preservation (#3481) is sound with one non-blocking medium.

What I checked

  • acceptEnvelopeOnClosedResponseRoot correctly narrows the old blanket additionalProperties:true relaxation to add only the release's own protocol-envelope.json fields to closed pre-composition roots — body typos still rejected, composing bundles untouched. Wire-shape fidelity preserved (witness-not-translator respected).
  • Changeset correctness: the minor changeset in .changeset/preserve-task-envelope-status.md is appropriate. Removed relaxResponseRoot/STATUS_FREE_SYNC_RESPONSE_TOOLS symbols are not in the public barrel, and injectLegacyEnvelopeStatus behavior is preserved via COMPACT_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 — omitsStatusCache read 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

@KonstantinMirin

Copy link
Copy Markdown
Contributor

Heads up: adcontextprotocol/adcp#8547 changed the compact submitted layout after you regenerated against 3da19611. Head is now 43c537b522.

  • core/task-submitted.json (status const submitted, task_id → core/task-id.json, both required) replaces the envelope's if/then. Every submitted body composes it through allOf, core/compact-task-submitted.json included, and the local status/task_id declarations are gone. The exception is the control_media_buy and commitment branches, which keep their status const for the OpenAPI discriminator.
  • core/task-id.json is the single task_id definition (non-empty).

On #8547's head, "Generate TypeScript SDK" fails with postProcessCompactTaskSubmittedEnvelope: expected the generated envelope intersection, so the post-processor needs to follow the new allOf member. Coming next on the same PR: core/task-working.json / core/task-input-required.json (same pattern for the async payloads), and a single message definition (core/task-message.json, maxLength: 2000) referenced by the envelope and the webhook payload.

@KonstantinMirin

Copy link
Copy Markdown
Contributor

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:

  • post-processors written for one specific schema (postProcessCompactTaskSubmittedEnvelope);
  • rewrites keyed on exact class signatures (post_generate_fixes.py, 29 of them);
  • a copied side tree for the async schemas, with its own $ref resolution;
  • stripping or relaxing fields at runtime.

adcontextprotocol/adcp#8547 fixes the schemas: plain allOf composition of protocol-envelope, one definition per envelope field (core/task-id.json, core/task-submitted.json, …), and open response roots. With that in place, these patches aren't needed. They fail because they're aimed at a schema layout that no longer exists.

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 allOf, $ref and discriminated oneOf produces the right types from these schemas without them. Post-processing that works around a general generator limitation, the same way for every schema, is fine. Post-processing that has to know the structure of one particular schema is the sign of a problem in the schema, and that problem should be fixed in the schema.

@KonstantinMirin

Copy link
Copy Markdown
Contributor

17.0.0-beta.5 went out without this PR. It still ships STATUS_FREE_SYNC_RESPONSE_TOOLS and the status strip. adcontextprotocol/adcp#8547 and its 3.2.x backport #8567 are green apart from the storyboard steps and smoke test that this strip breaks, so they're waiting on the release that includes this PR.

Copy link
Copy Markdown
Contributor Author

Current integration evidence for the remaining generator change: adcontextprotocol/adcp#8547 head dc66f2343da437412cd1f145966c18d57f226045 already uses SDK 13c162c8135a5d285c1abe91755ccc88f4b22a58 (including merged #3498). Its TypeScript job 123163129007 now fails postProcessCompactTaskSubmittedEnvelope: expected the generated envelope intersection. This is the follow-on compact-envelope assumption addressed here, not the now-closed legacy_create issue #3490.

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.

@KonstantinMirin

Copy link
Copy Markdown
Contributor

For the record, here is what each red check on adcontextprotocol/adcp#8547 (dc66f2343d) is waiting on:

Check Failing step Cause
Storyboards (current /sales) required-clean / required-exact list_products without status, the strip this PR removes
Server unit tests (4/4) tenant-smoke list_products same: must have required property 'status'
Build and static checks, TypeScript Build routed tenant smoke tests same
Generate TypeScript SDK postProcessCompactTaskSubmittedEnvelope this PR's generator change
Generate Python SDK $ref file not found …/async_response_refs/… adcontextprotocol/adcp-client-python#1680

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 (registerExternalSchemaRoot) until the pin moves. We'll ship that in the same commit as the SDK bump, once a release includes this PR. If "schema-fixture status failures" refers to a check that isn't in this table, tell me which one and I'll look.

bokelley and others added 2 commits October 29, 2026 18:00
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]>

@aao-secretariat aao-secretariat Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@bokelley
bokelley merged commit 460b1df into main Oct 29, 2026
45 checks passed
@bokelley
bokelley deleted the conductor/beirut branch October 29, 2026 18:45
bokelley added a commit to adcontextprotocol/adcp-client-python that referenced this pull request Oct 31, 2026
…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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove envelope workarounds: status stripped from four tools, every response root relaxed

2 participants