Skip to content

fix(training-agent): list only the served release's compliance scenarios - #8258

Merged
bokelley merged 1 commit into
mainfrom
fix/training-agent-3-0-capability-scenarios
Oct 17, 2026
Merged

bokelley merged 1 commit into
mainfrom
fix/training-agent-3-0-capability-scenarios

Conversation

@bokelley

Copy link
Copy Markdown
Contributor

Summary

With an explicit adcp_version: "3.0", get_adcp_capabilities on /sales/mcp listed 20 compliance_testing.scenarios. Sixteen of them are not in 3.0, for example force_create_media_buy_arm, seed_product and compact_product_lifecycle_probe. The 3.0 schema closes that enum to six values, so the response failed the 3.0 schema.

Root cause: the tenant router's projectTenantCapabilities merged salesComplyScenarios(servedVersion) into the list. That function gates on reliable reporting and the account change feed, not on the 3.0 enum. Only the frozen 3.0 storyboard facade (storyboardCompat) used the legacy list.

Fix

New server/src/training-agent/compliance-scenarios.ts reads the allowed set from the served release's own get_adcp_capabilities response schema, via getToolResponseSchema from @adcp/sdk/schemas. When that schema has a closed enum (3.0), the list is filtered to it. 3.1 and 3.2 accept any scenario name, so their lists are unchanged. If a release's bundle cannot be loaded, the list is also left unchanged.

The filter is applied in three places:

  • Final gate in projectTenantCapabilities, for every tenant route. It applies no matter which projection or SDK derivation contributed the scenarios. If the filtered list is empty, the block is dropped; that does not happen on any current tenant.
  • Sales capability list. It replaces the storyboardCompat special case, with the same output.
  • v5 handleGetAdcpCapabilities (/mcp, /mcp-strict*). It replaces the hard-coded six-scenario 3.0 list, with identical output and order.

comply_test_controller list_scenarios is not filtered.

Other tenants

I probed every tenant's /mcp and /mcp-strict route at 3.0, 3.1 and 3.2 before the fix:

  • Only sales/mcp at 3.0 had scenarios outside the 3.0 enum.
  • After the fix, every route's 3.0 response passes the canonical 3.0 get_adcp_capabilities schema.
  • sales/mcp lists 4 scenarios at 3.0, and still lists 20 at 3.1 and 25 at 3.2.

Tests

  • tenant-smoke.test.ts: each tenant route's explicit-3.0 response validates against the canonical 3.0 schema. The sales 3.0 list equals the legacy four, and 3.2 still lists every sales scenario, including the post-3.0 ones. It fails on main for sales (/compliance_testing/scenarios/4 must be equal to one of the allowed values).
  • server/tests/unit/training-agent-compliance-scenarios.test.ts: the closed 3.0 set is read from the schema, a filtered list validates and an unfiltered one does not, 3.1 and 3.2 keep every scenario, and an unknown release is left unchanged.
  • The existing v5 test that pins the exact six 3.0 scenarios still passes.

Verification

  • npm run typecheck: pass
  • npm run test:unit: pass (75 files)
  • npm run test:server-unit -- --shard=N/3: 1/3 4614 passed; 2/3 3314 passed, 31 skipped; 3/3 4688 passed
  • server/tests/integration/training-agent-3-0-compat-tools.test.ts: 8 passed
  • No changeset: there are no protocol-scoped changes.

🤖 Generated with Claude Code

An explicit `adcp_version: "3.0"` get_adcp_capabilities call on the main
/sales/mcp route listed 16 scenarios that 3.0 does not have, for example
force_create_media_buy_arm, seed_product and
compact_product_lifecycle_probe. The 3.0 capabilities schema closes
compliance_testing.scenarios to six values, so the response failed the
3.0 schema.

The tenant router's capabilities projection gated the sales list on
reliable reporting and the account change feed only. Only the frozen 3.0
storyboard facade (storyboardCompat) used the legacy list.

The allowed set now comes from the served release's own
get_adcp_capabilities response schema. Releases with a closed enum (3.0)
are filtered to it; 3.1 and 3.2 accept any scenario name and keep every
scenario. It applies:

- as a final gate in projectTenantCapabilities, for every tenant route,
  whichever projection or SDK derivation contributed the scenarios;
- to the sales capability list, replacing the storyboardCompat special
  case;
- to the v5 handler (/mcp and /mcp-strict*), replacing its hard-coded
  six-scenario 3.0 list. The output is identical.

comply_test_controller list_scenarios is unchanged.

Tests: every tenant route's 3.0 response validates against the canonical
3.0 schema (fails on main for sales), 3.2 still lists every sales
scenario, and helper unit tests cover the 3.0 enum and the open 3.1/3.2
lists.

Co-Authored-By: Claude Opus 5.5 (1M context) <[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: Approve

Approve — clean schema-driven fix with no blocking or medium findings.

This PR replaces two hand-maintained 3.0 compliance-scenario lists with a schema-driven filter (complianceScenariosForServedVersion) that reads the served release's own get_adcp_capabilities enum, closing the drift where /sales/mcp advertised 20 scenarios to explicit 3.0 callers against a 6-value closed enum. Behavior preservation was verified at all three sites (sales 3.0 → legacy four in order; v5 → identical six in order; new projectTenantCapabilities gate at function top-level covers every tenant). Error case left uncached to allow retry; open releases cached as null and unchanged.

Scope is server-only under training-agent/ with no protocol surface touched (no static/schemas/source/**, docs, or dist artifacts), so no changeset is correctly required. Tests validate each tenant's explicit-3.0 response against the canonical 3.0 schema.

Gate checks: no critical/high findings; gated_paths false; high_risk false; no no-auto-approve team match; no medium findings. review_decision is REVIEW_REQUIRED, but with gated_paths false and no blocking findings, none of rows 1–8 fire. Falls through to row 9 → approve.

@bokelley
bokelley merged commit ffdde8a into main Oct 17, 2026
56 checks passed
@bokelley
bokelley deleted the fix/training-agent-3-0-capability-scenarios branch October 17, 2026 11:05
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