Skip to content

fix(a2a): set final=True for error TaskStatusUpdateEvent in event_converter#5389

Open
kuishou68 wants to merge 1 commit intogoogle:mainfrom
kuishou68:fix/event-converter-error-final-flag
Open

fix(a2a): set final=True for error TaskStatusUpdateEvent in event_converter#5389
kuishou68 wants to merge 1 commit intogoogle:mainfrom
kuishou68:fix/event-converter-error-final-flag

Conversation

@kuishou68
Copy link
Copy Markdown

Closes #5388

Problem

In _create_error_status_event inside src/google/adk/a2a/converters/event_converter.py, the TaskStatusUpdateEvent for a failed task is incorrectly created with final=False:

return TaskStatusUpdateEvent(
    ...
    status=TaskStatus(state=TaskState.failed, ...),
    final=False,  # BUG: should be True
)

A failed state is terminal — no further events will follow, so final must be True. Consumers that check this flag will otherwise wait indefinitely or mishandle the error.

Fix

Change final=Falsefinal=True in _create_error_status_event.

The equivalent code in from_adk_event.py already uses final=True correctly (line 154), so this change makes event_converter.py consistent.

Testing

Existing unit tests for error event conversion should be updated/added to assert final=True.

Signed-off-by: Cocoon-Break 54054995+kuishou68@users.noreply.github.com

…verter

When a task transitions to TaskState.failed, the resulting
TaskStatusUpdateEvent should have final=True because the error state
is terminal — no further events will follow.

The existing from_adk_event.py already sets final=True for error events
(line 154), but event_converter.py incorrectly uses final=False, which
causes consumers to wait indefinitely for additional events after a
failure.

Closes google#5388

Signed-off-by: Cocoon-Break <54054995+kuishou68@users.noreply.github.com>
@adk-bot
Copy link
Copy Markdown
Collaborator

adk-bot commented Apr 19, 2026

Response from ADK Triaging Agent

Hello @kuishou68, thank you for your contribution!

Your PR description is very clear and it's great that you've included an associated issue and a testing plan.

As per our contribution guidelines, could you please also include a summary of the passed pytest results to verify the fix? This will help speed up the review process.

Thanks!

@adk-bot adk-bot added the mcp [Component] Issues about MCP support label Apr 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mcp [Component] Issues about MCP support

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: error TaskStatusUpdateEvent has final=False in event_converter.py

2 participants