Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,17 @@ public EventKind onMessageSend(MessageSendParams params, ServerCallContext conte
pushConfigStore.setInfo(createdTask.id(), params.configuration().pushNotificationConfig());
}

if (blocking && interruptedOrNonBlocking) {
// Check if task requires immediate return (AUTH_REQUIRED)
// AUTH_REQUIRED expects the client to receive it immediately and handle it out-of-band,
// while the agent continues executing in the background
boolean requiresImmediateReturn = kind instanceof Task task &&
task.status().state() == io.a2a.spec.TaskState.TASK_STATE_AUTH_REQUIRED;
if (requiresImmediateReturn) {
LOGGER.debug("DefaultRequestHandler: Task {} in AUTH_REQUIRED state, skipping fire-and-forget handling",
taskId.get());
}

if (blocking && interruptedOrNonBlocking && !requiresImmediateReturn) {
// For blocking calls: ensure all consumed events are persisted to TaskStore before returning
// Order of operations is critical to avoid circular dependency and race conditions:
// 1. Wait for agent to finish enqueueing events (or timeout)
Expand Down
Loading