fix(proto): use field.label instead of is_repeated for protobuf compatibility#1010
Merged
sokoliva merged 4 commits intoa2aproject:mainfrom Apr 22, 2026
Merged
fix(proto): use field.label instead of is_repeated for protobuf compatibility#1010sokoliva merged 4 commits intoa2aproject:mainfrom
sokoliva merged 4 commits intoa2aproject:mainfrom
Conversation
🧪 Code Coverage (vs
|
Contributor
There was a problem hiding this comment.
Code Review
This pull request updates src/a2a/utils/proto_utils.py to replace the use of the is_repeated property with explicit checks against the LABEL_REPEATED constant. The reviewer suggests accessing these constants via the FieldDescriptor class rather than the field instance to ensure idiomatic consistency and better compatibility with various protobuf backends.
ishymko
approved these changes
Apr 22, 2026
Member
ishymko
left a comment
There was a problem hiding this comment.
PR description nit:
-protobuf>=5.29.0,
+protobuf>=5.29.5,
ishymko
approved these changes
Apr 22, 2026
Member
ishymko
left a comment
There was a problem hiding this comment.
I'd also mention in the description that although the deprecated label was already removed in some 7.x version, 7.x version can't be resolved with the other constraints we have in the project.
ishymko
pushed a commit
that referenced
this pull request
Apr 24, 2026
🤖 I have created a release *beep* *boop* --- ## [1.0.2](v1.0.1...v1.0.2) (2026-04-24) ### Features * **helpers:** add non-text Part, Message, and Artifact helpers ([#1004](#1004)) ([cfdbe4c](cfdbe4c)) ### Bug Fixes * **proto:** use field.label instead of is_repeated for protobuf compatibility ([#1010](#1010)) ([7d197db](7d197db)) * **server:** deliver push notifications across all owners ([#1016](#1016)) ([c24ae05](c24ae05)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
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
Replace
field.is_repeatedwithfield.label == field.LABEL_REPEATEDinproto_utils.pyto support older protobuf versions where theis_repeatedattribute is not available onFieldDescriptor.Problem
When using older protobuf versions accessing
field.is_repeatedraises:a2a.utils.errors.InternalError: 'google._upb._message.FieldDescriptor' object has no attribute 'is_repeated'The project's declared minimum is
protobuf>=5.29.5,5.29.5does not supportis_repeated. This causedsend_message(and other proto-validating client calls) to fail at runtime for users on older protobuf releases.The
is_repeatedproperty was only added toFieldDescriptorin newer protobuf releases (6.x), so relying on it broke compatibility with the supported version range.Although the deprecated label was already removed in some 7.x version, 7.x version can't be resolved with the other constraints we have in the project.
Fix
Use the long-standing
labelattribute and compare againstFieldDescriptor.LABEL_REPEATED, which is available across all supported protobuf versions and is the canonical way to detect repeated fields.Testing
uv run pytestpasses against the supported protobuf version range.