Skip to content

Commit 29ec4d4

Browse files
Fix lint/typing errors
1 parent 7cdef10 commit 29ec4d4

File tree

2 files changed

+781
-762
lines changed

2 files changed

+781
-762
lines changed

src/a2a/server/request_handlers/grpc_handler.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ async def SendMessage(
102102
return proto_utils.ToProto.task_or_message(task_or_message)
103103
except ServerError as e:
104104
await self.abort_context(e, context)
105+
return a2a_pb2.SendMessageResponse()
105106

106107
@validate_async_generator(
107108
lambda self: self.agent_card.capabilities.streaming,
@@ -162,9 +163,12 @@ async def CancelTask(
162163
)
163164
if task:
164165
return proto_utils.ToProto.task(task)
165-
self.abort_context(ServerError(error=TaskNotFoundError()), context)
166+
await self.abort_context(
167+
ServerError(error=TaskNotFoundError()), context
168+
)
166169
except ServerError as e:
167170
await self.abort_context(e, context)
171+
return a2a_pb2.Task()
168172

169173
@validate_async_generator(
170174
lambda self: self.agent_card.capabilities.streaming,
@@ -221,6 +225,7 @@ async def GetTaskPushNotification(
221225
return proto_utils.ToProto.task_push_notification_config(config)
222226
except ServerError as e:
223227
await self.abort_context(e, context)
228+
return a2a_pb2.TaskPushNotificationConfig()
224229

225230
@validate(
226231
lambda self: self.agent_card.capabilities.pushNotifications,
@@ -230,7 +235,7 @@ async def CreateTaskPushNotification(
230235
self,
231236
request: a2a_pb2.CreateTaskPushNotificationRequest,
232237
context: grpc.aio.ServicerContext,
233-
) -> TaskPushNotificationConfig:
238+
) -> a2a_pb2.TaskPushNotificationConfig:
234239
"""Handles the 'CreateTaskPushNotification' gRPC method.
235240
236241
Requires the agent to support push notifications.
@@ -259,6 +264,7 @@ async def CreateTaskPushNotification(
259264
return proto_utils.ToProto.task_push_notification_config(config)
260265
except ServerError as e:
261266
await self.abort_context(e, context)
267+
return a2a_pb2.TaskPushNotificationConfig()
262268

263269
async def GetTask(
264270
self,
@@ -281,9 +287,12 @@ async def GetTask(
281287
)
282288
if task:
283289
return proto_utils.ToProto.task(task)
284-
self.abort_context(ServerError(error=TaskNotFoundError()), context)
290+
await self.abort_context(
291+
ServerError(error=TaskNotFoundError()), context
292+
)
285293
except ServerError as e:
286294
await self.abort_context(e, context)
295+
return a2a_pb2.Task()
287296

288297
async def GetAgentCard(
289298
self,

0 commit comments

Comments
 (0)