Conversation
…gun on capabilities-validation failure Port of JS commit 27bd79d (#1201). When `get_adcp_capabilities` fails strict schema validation but the response is structurally v3-shaped, surface the v3 validation error loudly instead of silently re-classifying the agent as v2 — which downstream tooling turns into a cascade of confusing "AdCP schema data for version v2.5 not found" errors that have nothing to do with the original wire-shape bug. `looks_like_v3_capabilities(data)` checks for any one v3 signal: the `adcp` envelope, `supported_protocols` array, or any v3 protocol-level block (`account`, `media_buy`, `signals`, `creative`, `brand`, `governance`, `sponsored_intelligence`, `compliance_testing`). Arrays are explicitly rejected via the `_is_plain_object` helper so `adcp: []` / `media_buy: []` don't false-positive. `ADCPClient.refresh_capabilities` now distinguishes parse failure (the `_parse_response` "Failed to parse response:" prefix) from transport failure: parse failures re-fetch the raw dict from the adapter and run the heuristic; transport failures fall straight through to the original "Failed to fetch capabilities" path so the existing failure-raises test keeps passing. Closes #461. Refs #452. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Port of JS commit
27bd79d(#1201) to the Python SDK. Closes #461. Refs #452.When
get_adcp_capabilitiesfails strict schema validation but the response is structurally v3-shaped, surface the v3 validation error loudly instead of silently re-classifying the agent as v2 — which downstream tooling turns into a cascade of confusing"AdCP schema data for version v2.5 not found"errors that have nothing to do with the original wire-shape bug.looks_like_v3_capabilities(data)(insrc/adcp/capabilities.py, also re-exported from top-leveladcp) checks for any one v3 signal: theadcpenvelope,supported_protocolsarray, or any v3 protocol-level block (account,media_buy,signals,creative,brand,governance,sponsored_intelligence,compliance_testing)._is_plain_objecthelper soadcp: []/media_buy: []don't false-positive (mirrors the JSisPlainObjectdefense).ADCPClient.refresh_capabilitiesdistinguishes parse failure (the_parse_response"Failed to parse response:"prefix) from transport failure: parse failures re-fetch the raw dict from the adapter and run the heuristic; transport failures fall straight through to the original"Failed to fetch capabilities"path so the existing failure-raises test stays green.Test plan
refresh_capabilities:v3and neverv2.5"Failed to fetch capabilities", adapter called exactly once (no extra probe)ruff checkclean on touched filesmypyclean onsrc/adcp/capabilities.py+src/adcp/client.pytests/suite: 3065 passed, 18 skipped, 1 xfailed (no regressions)🤖 Generated with Claude Code