Hello,
Usually when sending the final event with status.state = completed, the message is not included in the event.
See https://a2a-protocol.org/latest/specification/#93-streaming-task-execution-sse the last event.
The code in UpdateTaskState does not care if message is nil or not, it sets it anyway:
func (h *taskHandler) UpdateTaskState(
taskID *string,
state protocol.TaskState,
message *protocol.Message,
) error {
if taskID == nil || *taskID == "" {
return fmt.Errorf("taskID cannot be nil or empty")
}
task, err := h.manager.getTaskInternal(h.ctx, *taskID)
if err != nil {
log.Warnf("UpdateTaskState called for non-existent task %s", *taskID)
return fmt.Errorf("task not found: %s", *taskID)
}
// Update task status.
task.Status = protocol.TaskStatus{
State: state,
Message: message,
Timestamp: time.Now().UTC().Format(time.RFC3339),
}
// Store updated task.
if err := h.manager.storeTask(h.ctx, task); err != nil {
return fmt.Errorf("failed to update task status: %w", err)
}
...
}
WDYT to only update the message if it's not nil? Something like this:
// Update task status.
task.Status = protocol.TaskStatus{
State: state,
Timestamp: time.Now().UTC().Format(time.RFC3339),
}
if message != nil {
task.Status.Message = message
}
Hello,
Usually when sending the final event with
status.state= completed, the message is not included in the event.See https://a2a-protocol.org/latest/specification/#93-streaming-task-execution-sse the last event.
The code in
UpdateTaskStatedoes not care if message is nil or not, it sets it anyway:WDYT to only update the message if it's not nil? Something like this: