Repository navigation
Conversation
In v0.3 every OAuth flow is an optional field, so a card may list several. In 1.0 OAuthFlows is a oneof, and parse_agent_card copied the legacy flows object across unchanged, so ParseDict rejected such cards and the client could not be created. Keep one flow for a legacy oauth2 scheme, the same one the v0.3 compat conversion keeps, and log a warning naming the flows.
🧪 Code Coverage (vs
|
| Base | PR | Delta | |
|---|---|---|---|
| src/a2a/client/card_resolver.py | 100.00% | 98.36% | 🔴 -1.64% |
| src/a2a/server/cluster/database_event_stream.py | 93.64% | 97.27% | 🟢 +3.64% |
| Total | 93.67% | 93.70% | 🟢 +0.03% |
Generated by coverage-comment.yml
This branch has not been deployed
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.
Description
parse_agent_cardmaps legacy v0.3 security schemes to their 1.0 form, but it copies anoauth2scheme'sflowsobject across unchanged. In the v0.3 JSON schema every flow is an independent optional property ofOAuthFlows(specification/json/a2a.jsonatv0.3.0; this SDK'sa2a.compat.v0_3.types.OAuthFlowsand thea2a-sdk0.3.x models have the same shape), so a v0.3 card may list, for example,authorizationCodeandclientCredentialstogether. The v0.3 proto declares a oneof, but cards are discovered as JSON. In 1.0OAuthFlowsis a oneof, soParseDictraises andA2ACardResolver.get_agent_card()/ClientFactory.create_from_url()fail withAgentCardResolutionError:To reproduce, I ran an agent on
a2a-sdk==0.3.26that builds its card with that release's ownOAuthFlows(authorization_code=..., client_credentials=...)and serves it withA2AStarletteApplication, then pointedClientFactory(ClientConfig()).create_from_url()frommainat it (macOS arm64, 127.0.0.1):mainclientCredentialsonlyclient_credentialsclient_credentialsauthorizationCode+clientCredentialsAgentCardResolutionErrorclient_credentialsSo a 1.0 client cannot connect to a 0.3 agent that describes its OAuth server with more than one flow.
This change keeps a single flow when a legacy
oauth2scheme lists several, and logs a warning naming the flows. It keeps the same flow as the v0.3 compat conversion:to_core_oauth_flowssets the flows in order on the oneof, so the last one present wins, and both paths give the same result for the same card. Only the legacy branch (type: oauth2) is touched. A 1.0 card whoseoauth2SecurityScheme.flowssets two flows is still rejected.Tests: added
test_parse_030_agent_card_oauth2_with_several_flows, which fails onmainwith theParseErrorabove and passes with the fix. It also checks that the 1.0 form with two flows still raises.tests/clientandtests/compat: 637 passed. Full suite: 2623 passed, 215 skipped, 4 xfailed, 1 xpassed.ruff check: all checks passed;ruff format --check: 285 files already formatted;ty checkreports the same 3 diagnostics as onmain, none in the changed files.CONTRIBUTINGGuide.bash scripts/format.shfrom the repository root to format)This change was drafted with Claude Code (claude-opus-5-5); the test results above are from the runs described.