Skip to content

[Bug]: EventConsumer treats TASK_STATE_UNSPECIFIED as terminal and closes the queue #1214

Description

@anxkhn

What happened?

Legacy EventConsumer.is_final_event (src/a2a/server/events/event_consumer.py) includes TASK_STATE_UNSPECIFIED in the stop set. That is the proto default (value 0), not a finished state.

Spec 4.1.3: unspecified is unknown/indeterminate. Terminal is COMPLETED / FAILED / CANCELED / REJECTED. V2 TERMINAL_TASK_STATES already omits unspecified.

If an agent enqueues a Task without setting status, or a status update that omits state, consume_all closes the queue. Later WORKING/COMPLETED events never arrive on the legacy message/send, stream, cancel, and subscribe paths.

Repro

  1. Enqueue Task(id=..., context_id=...) with default status.
  2. Then enqueue WORKING and COMPLETED updates.

Observed: only the first Task is yielded and the queue is closed.
Expected: unspecified is non-final; WORKING and COMPLETED are still consumed.

Relevant log output

n/a. Covered by a consume_all unit test.

Code of Conduct

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

Metadata

Metadata

Assignees

Labels

component: serverIssues related to frameworks for agent execution, HTTP/event handling, database persistence logic.

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions