Skip to content

fix: do not treat TASK_STATE_UNSPECIFIED as a terminal event - #1217

Open
anxkhn wants to merge 1 commit into
a2aproject:mainfrom
anxkhn:fix/event-consumer-unspecified
Open

fix: do not treat TASK_STATE_UNSPECIFIED as a terminal event#1217
anxkhn wants to merge 1 commit into
a2aproject:mainfrom
anxkhn:fix/event-consumer-unspecified

Conversation

@anxkhn

@anxkhn anxkhn commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Description

  • Follow the CONTRIBUTING Guide
  • Conventional Commits title
  • Tests and linter pass
  • Docs updated if necessary

Fixes #1214

Summary

Legacy EventConsumer.is_final_event included TASK_STATE_UNSPECIFIED in the stop set. That is the proto default (value 0), not a finished state.

Spec 4.1.3 treats unspecified as unknown. Terminal is COMPLETED, FAILED, CANCELED, REJECTED. V2 TERMINAL_TASK_STATES already omits unspecified. INPUT_REQUIRED is left alone because consume_all still pauses there on the legacy path.

If an agent enqueues a Task without setting status, or a status update that omits state, the queue closed and later WORKING/COMPLETED events never reached message/send, stream, cancel, or subscribe.

UNSPECIFIED is removed from the terminal set so a default-state Task no longer stops the loop.

Testing

Added test_consume_all_does_not_stop_on_unspecified_state.

uv run pytest tests/server/events/test_event_consumer.py -q

16 passed, 2 xfailed (existing #869).

Signed-off-by: Anas Khan <83116240+anxkhn@users.noreply.github.com>
@anxkhn
anxkhn requested a review from a team as a code owner August 27, 2026 21:10
@github-actions

Copy link
Copy Markdown

🧪 Code Coverage (vs main)

⬇️ Download Full Report

No coverage changes.

Generated by coverage-comment.yml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

1 participant