Skip to content

[Bug]: Missing rejected state mapping in proto_utils.py causes TaskStatusUpdateEvent to report unknown instead of rejected #888

@Varun9002

Description

@Varun9002

What happened?

Observed behavior:
When a server sends a TaskStatusUpdateEvent with the state set to rejected, the client receives it as unknown.

Expected behavior:
The client should receive the state as rejected, matching the server's intent.

Root cause:
The task_state classmethod in a2a/utils/proto_utils.py handles mappings for all other TaskState variants (submitted, working, completed, cancelled, failed, input_required, auth_required) but does not include a case for TASK_STATE_REJECTED. As a result, the rejected state falls through to the default wildcard match and is mapped to unknown.

Relevant code (a2a/utils/proto_utils.py):

@classmethod
def task_state(cls, state: a2a_pb2.TaskState) -> types.TaskState:
    match state:
        case a2a_pb2.TaskState.TASK_STATE_SUBMITTED:
            return types.TaskState.submitted
        case a2a_pb2.TaskState.TASK_STATE_WORKING:
            return types.TaskState.working
        case a2a_pb2.TaskState.TASK_STATE_COMPLETED:
            return types.TaskState.completed
        case a2a_pb2.TaskState.TASK_STATE_CANCELLED:
            return types.TaskState.canceled
        case a2a_pb2.TaskState.TASK_STATE_FAILED:
            return types.TaskState.failed
        case a2a_pb2.TaskState.TASK_STATE_INPUT_REQUIRED:
            return types.TaskState.input_required
        case a2a_pb2.TaskState.TASK_STATE_AUTH_REQUIRED:
            return types.TaskState.auth_required
        case _:
            return types.TaskState.unknown
# Missing: a2a_pb2.TaskState.TASK_STATE_REJECTED -> types.TaskState.rejected

Happy to submit a PR for this if that would be helpful

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions