Skip to content

fix(training-agent): accept 4.x versions in storyboard candidate mode - #9350

Open
bokelley wants to merge 1 commit into
mainfrom
fix/training-agent-candidate-4x
Open

bokelley wants to merge 1 commit into
mainfrom
fix/training-agent-candidate-4x

Conversation

@bokelley

@bokelley bokelley commented Dec 4, 2026

Copy link
Copy Markdown
Contributor

Summary

Main is in Changesets beta pre mode for 4.0, so the next Version Packages cut is 4.0.0-beta.0. The Version Packages PR for it (#9344) fails every current-surface storyboard with Compliance cache version 4.0.0-beta.0 is not supported. The runner already derived the wire candidate 4.0-beta.0 correctly. The problem was that candidate-version.ts accepted only ^3\. and dropped the candidate without saying so. The agent then advertised only its stable 3.x lines, and the SDK rejected the bundle.

This PR makes candidate mode accept 4.x the same way it accepts 3.x. Deployed behaviour doesn't change, and neither does 3.x candidate behaviour.

Changes

  • server/src/training-agent/candidate-wire-version.ts (new, pure): the candidate majors ([3, 4], extended on purpose rather than accepting any major), the wire-value check, and the bundle-to-wire derivation. The derivation follows the existing 3.x convention: 4.0.0-beta.0 becomes 4.0-beta.0, 4.0.0-rc.2 becomes 4.0-rc.2, 4.0.0 becomes 4.0, and 4.1.2 becomes 4.1. The file has no side effects at load, so the runner can import it before it sets the env.
  • candidate-version.ts: uses that check instead of the 3.x-only regex.
  • server/tests/manual/run-storyboards.ts: derives the candidate through the same helper. It now fails fast in two cases: when the bundle version can't become a candidate, and when the agent doesn't adopt the candidate. Before, either case ended in the opaque compliance-cache error. It also logs Candidate mode: serving AdCP <wire> from compliance bundle <version>.
  • Platforms that don't declare supported_versions (signals, governance, creative, creative-builder, brand, si, inventory): when supported_versions is absent, @adcp/sdk builds the negotiable list from the major of the configured pin. On a 3.x pin that list is ["3"], which covers everything. On a 4.x pin it's ["4"], so the stable 3.2 default fails with defaultAdcpVersion "3.2" must be present in capabilities.supported_versions and the tenants never register. The new TRAINING_AGENT_CROSS_MAJOR_CANDIDATE_CAPABILITIES (in types.ts) has these platforms declare the registry's releases explicitly, as the sales platform already does. It applies only when the candidate's major differs from the current line's major, and it's {} otherwise.

What stays the same: TRAINING_AGENT_CURRENT_ADCP_VERSION (3.2), the unpinned default (3.0), and major_versions: [3]. A major-only caller is never served the candidate, so advertising 4 there would be wrong. The hosted preview and the legacy signing routes are also unchanged. As with 3.x, a legacy route neither advertises nor accepts the candidate.

No changeset: the pre-push protocol-scope hook rejects one for training-agent-only changes.

Tests

  • server/tests/unit/training-agent-candidate-wire-version.test.ts (new, 42 cases):
    • 3.x and 4.x derivations: beta, rc, GA, and later 4.x patch and minor releases.
    • Rejections: 2.x, 5.x, alpha, malformed, and wire-vs-bundle confusion.
    • The candidate is accepted only with NODE_ENV=test and candidate mode on.
  • server/tests/unit/training-agent-candidate-version-4x.test.ts (new): runs a 4.0-beta.0 candidate through the real router.
    • The process adopts the candidate in place of the hosted preview, and the stable constants are unchanged.
    • Every tenant without proposal negotiation registers.
    • /sales, /brand, /signals, /governance and /creative negotiate 4.0-beta.0, explicit 3.2, and the unpinned request (served 3.2).
    • The legacy signing route refuses the candidate.
    • The HTTP negotiation cases skip themselves while the installed SDK refuses proposal negotiation on a 4.x pin (see Blocker below). Every route shares the registry that includes sales.
  • Existing suites still pass:
    • training-agent-candidate-version, -preview-version, -schema-compat, storyboard-candidate-schema-root, training-agent-inventory-tenants, tenants/tenant-smoke, tenants/served-release-shape.
    • tests/run-storyboards-schema-root-options.test.cjs and run-storyboards-isolation.test.cjs.
    • The pre-commit typecheck.

Storyboard evidence (local, candidate mode, 4.0.0-beta.0 bundle)

To simulate the bundle, I checked out package.json, static/schemas/source/index.json and static/compliance/published-versions.json from changeset-release/main (#9344's head). I ran build-schemas and build-compliance, then the runner with ADCP_COMPLIANCE_DIR=dist/compliance/latest ADCP_SCHEMA_ROOT=dist/schemas/latest ADCP_STORYBOARD_CANDIDATE_VERSION_MODE=1. The sales tenant needed the one-line SDK change described under Blocker, applied locally in node_modules and not committed:

Tenant Storyboards Steps
brand 58/58 clean 110 passed, 0 failed
governance 60/60 clean 184 passed, 0 failed
creative 62/62 clean 246 passed, 0 failed
si 53/53 clean 65 passed, 0 failed
signals 56/57 138 passed, 1 failed (error_compliance_signals/supported_major_version, see below)
sales shard 0/8 24/25 225 passed, 1 failed (error_compliance/supported_major_version)
sales shard 1/8 25/25 clean 177 passed, 0 failed

As a 3.x regression check, signals on the restored 3.3.1 bundle in candidate mode was 57/57 clean. The log shows Candidate mode: serving AdCP 3.3 from compliance bundle 3.3.1.

Still blocking the 4.0.0-beta.0 cut (not fixed here)

  1. Blocker, in @adcp/sdk (17.0.0 and beta.40): createAdcpServer throws proposalNegotiation requires adcpVersion 3.2 or newer when proposalRelease.major !== 3. Because of that, the sales tenant can't register on any 4.x pin, and since every route shares one registry, no storyboard runs at all. The fix belongs in adcp-client: major < 3 || (major === 3 && minor < 2). Other SDK checks of the form major === 3 are worth auditing too: envelope-status-compat, v2/projection/creative-delivery ("adcpVersion must name an AdCP 3.x version"), and the request-signing required/either default in create-adcp-server.
  2. Compliance fixtures: static/compliance/source/universal/error-compliance.yaml and error-compliance-signals.yaml (supported_major_version) send adcp_major_version: 3 while the runner pins adcp_version: 4.0-beta.0. The agent correctly rejects that with "majors must agree". adcp_major_version is x-removed-in: 4.0.0, so the step needs a 4.0 decision: send 4, or drop it on 4.x.

Other version gates checked:

  • /schemas/v3/ and the other alias middleware: OK. Aliases resolve only to stable releases, so /v3/ stays on 3.3.1 and /v4/ returns 404 until 4.0.0 GA.
  • check-release-state.cjs: no version gate. It does require every storyboard job, including the sales orchestrators and the proposal-profile jobs, so blocker 1 also blocks verified-merge and the full-verification fallback.
  • scripts/update-release-docs-nav.mjs: previousLine('4.0') is undefined, so the first 4.0 beta selector gets no 3.3-to-4.0 migration link, and its story pages have no predecessor to sit next to. No whats-new-in-4-0 or migration/3-3-to-4-0 pages exist yet.
  • The hosted compliance target picker only prefers the 3.2 and 3.1 lines. That's fine for a beta.
  • Local only: the lab route /sales/identity/mcp pins 3.3, so with a 4.x candidate the sales supported_versions would exceed it. No CI storyboard uses that route.

🤖 Generated with Claude Code

Main is in Changesets beta pre mode for AdCP 4.0, so the next Version
Packages cut is 4.0.0-beta.0. The storyboard runner derived the wire
candidate 4.0-beta.0 from that bundle, but candidate-version.ts accepted
only 3.x and silently ignored it. The agent then advertised only its
stable 3.x lines, and every current-surface storyboard failed with
"Compliance cache version 4.0.0-beta.0 is not supported".

- candidate-wire-version.ts: one pure home for the candidate majors (3
  and 4), the wire-value check, and the bundle-to-wire derivation
  (4.0.0-beta.0 to 4.0-beta.0, 4.0.0 to 4.0, 4.1.2 to 4.1).
- candidate-version.ts uses it instead of a 3.x-only regex.
- run-storyboards.ts derives the candidate through the same helper,
  fails fast when a bundle cannot become a candidate or the agent does
  not adopt it, and logs the served candidate.
- Tenants without declared supported_versions let the SDK negotiate by
  the configured pin's major. On a 4.x pin that list is just "4", which
  refuses the stable 3.2 default. A cross-major candidate now makes
  those platforms declare the registry's releases, as sales already
  does. Empty otherwise: deployed and 3.x candidate behaviour unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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.

1 participant