Skip to content

fix(compat): mark interrupted v0.3 status updates as final - #1426

Open
ShivamSharma43 wants to merge 2 commits into
a2aproject:mainfrom
ShivamSharma43:compat-final-interrupted
Open

ShivamSharma43 wants to merge 2 commits into
a2aproject:mainfrom
ShivamSharma43:compat-final-interrupted

Conversation

@ShivamSharma43

Copy link
Copy Markdown

Problem

to_compat_task_status_update_event set final=True only for terminal states (completed, canceled, failed, rejected). When an agent stops at input-required or auth-required, a v0.3 message/stream still closes after that status update, but the update arrives with final: false. The v0.3 field means "this is the final event in the stream for this interaction", so v0.3 clients never get a final: true event for an interrupted turn.

Here is a v0.3 JSON-RPC message/stream against a 1.0 DefaultRequestHandler with enable_v0_3_compat=True. The agent emits working and then the given state, then returns. Output on main:

TASK_STATE_INPUT_REQUIRED -> stream closed after 3 events
    task submitted final= None
    status-update working final= False
    status-update input-required final= False
TASK_STATE_AUTH_REQUIRED -> stream closed after 3 events
    ...
    status-update auth-required final= False
TASK_STATE_COMPLETED -> stream closed after 3 events
    ...
    status-update completed final= True

a2a-go's v0.3 compat layer sets Final for input-required as well (a2acompat/a2av0/conversions.go, FromV1TaskStatusUpdateEvent).

Fix

Compute final from the core state using TERMINAL_TASK_STATES | INTERRUPTED_TASK_STATES. These are the same states DefaultRequestHandlerV2 stops tailing a stream on. With the fix, the run above reports final= True for input-required and auth-required.

Tests

test_task_status_update_event_conversion_terminal_states now expects final=True for input-required and auth-required. Submitted, working and unspecified still expect final=False. The updated test fails on main and passes with the fix. scripts/lint.sh is clean. I ran uv run pytest on Windows: 2532 passed. The only failures came from the local environment: os.killpg in the cross-version harness, cp1252 console encoding in the samples smoke test, and one xdist-only flake that passes when run alone.

🤖 Generated with Claude Code

The v0.3 TaskStatusUpdateEvent conversion set final=True only for
terminal states. A stream that stops at input-required or auth-required
ended with final=False, so v0.3 clients never saw the event that closes
the interaction marked as such.

Treat interrupted states as final too, matching the states the 1.0
server stops streaming on.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ShivamSharma43
ShivamSharma43 requested a review from a team as a code owner November 5, 2026 12:40
Copilot AI balanced review requested due to automatic review settings November 5, 2026 12:40

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@Iwaniukooo11 Iwaniukooo11 self-assigned this Nov 5, 2026
@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown

🧪 Code Coverage (vs main)

⬇️ Download Full Report

Base PR Delta
src/a2a/server/cluster/database_event_stream.py 92.73% 93.64% 🟢 +0.91%
Total 93.48% 93.49% 🟢 +0.01%

Generated by coverage-comment.yml

This branch has not been deployed

No deployments
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.

3 participants