Skip to content

Commit ac12f05

Browse files
authored
fix: convert auth_required state in proto utils (#444)
# Description The A2A client is receiving `unknown` state over REST transport while it should receive `auth_required`. - [x] Follow the [`CONTRIBUTING` Guide](https://github.com/a2aproject/a2a-python/blob/main/CONTRIBUTING.md). - [x] Make your Pull Request title in the <https://www.conventionalcommits.org/> specification. - Important Prefixes for [release-please](https://github.com/googleapis/release-please): - `fix:` which represents bug fixes, and correlates to a [SemVer](https://semver.org/) patch. - `feat:` represents a new feature, and correlates to a SemVer minor. - `feat!:`, or `fix!:`, `refactor!:`, etc., which represent a breaking change (indicated by the `!`) and will result in a SemVer major. - [ ] Ensure the tests and linter pass (Run `bash scripts/format.sh` from the repository root to format) - [ ] Appropriate docs were updated (if necessary) --------- Signed-off-by: Tomas Pilar <[email protected]>
1 parent 9193208 commit ac12f05

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/a2a/utils/proto_utils.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,8 @@ def task_state(cls, state: types.TaskState) -> a2a_pb2.TaskState:
122122
return a2a_pb2.TaskState.TASK_STATE_FAILED
123123
case types.TaskState.input_required:
124124
return a2a_pb2.TaskState.TASK_STATE_INPUT_REQUIRED
125+
case types.TaskState.auth_required:
126+
return a2a_pb2.TaskState.TASK_STATE_AUTH_REQUIRED
125127
case _:
126128
return a2a_pb2.TaskState.TASK_STATE_UNSPECIFIED
127129

@@ -568,6 +570,8 @@ def task_state(cls, state: a2a_pb2.TaskState) -> types.TaskState:
568570
return types.TaskState.failed
569571
case a2a_pb2.TaskState.TASK_STATE_INPUT_REQUIRED:
570572
return types.TaskState.input_required
573+
case a2a_pb2.TaskState.TASK_STATE_AUTH_REQUIRED:
574+
return types.TaskState.auth_required
571575
case _:
572576
return types.TaskState.unknown
573577

tests/utils/test_proto_utils.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -170,11 +170,7 @@ def test_enum_conversions(self):
170170
)
171171

172172
for state in types.TaskState:
173-
if state not in (
174-
types.TaskState.unknown,
175-
types.TaskState.rejected,
176-
types.TaskState.auth_required,
177-
):
173+
if state not in (types.TaskState.unknown, types.TaskState.rejected):
178174
proto_state = proto_utils.ToProto.task_state(state)
179175
assert proto_utils.FromProto.task_state(proto_state) == state
180176

0 commit comments

Comments
 (0)