Skip to content

fix(server): mark a task FAILED when its execution fails - #459

Merged
muscariello merged 1 commit into
stack/15-rest-cancel-metadatafrom
stack/16-executor-error-marks-task-failed
Nov 3, 2026
Merged

muscariello merged 1 commit into
stack/15-rest-cancel-metadatafrom
stack/16-executor-error-marks-task-failed

Conversation

@muscariello

Copy link
Copy Markdown
Member

Fixes #431. Replaces #432.

Cause: an executor error, an event the server cannot apply, or a push failure with fail_on_error ended drive_execution without a terminal state. The stored task stayed SUBMITTED or WORKING for good, so GetTask and ListTasks kept reporting it in progress and a returnImmediately caller polling it (§3.2.2) never saw it end.

Fix: the three error paths record the error and leave the loop. fail_task then saves the task as TASK_STATE_FAILED with the sanitized error as its status message, and the error reaches live subscribers as before. A task that is already terminal (canceled meanwhile) is left alone.

Tests: test_execution_error_leaves_the_task_failed, test_unappliable_event_leaves_the_task_failed and test_failed_push_leaves_the_task_failed fail with the fix reverted. test_canceled_task_is_not_marked_failed guards the canceled case. A ScriptedExecutor helper is reused by the later handler fixes.

Unproven: the caller still gets the typed error, as with the Python SDK; the Go SDK returns the failed Task instead. The A2A 1.1 line (#388/#392), which #432 says writes FAILED only after a panic, was not checked.

An executor error, an event the server cannot apply, or a push failure
with fail_on_error ended the execution without a terminal state, so the
stored task stayed SUBMITTED or WORKING for good: GetTask and ListTasks
kept reporting it in progress and a returnImmediately caller polling it
never saw it end. The failed execution now saves the task as FAILED, with
the sanitized error as its status message, before the error reaches the
live subscribers as before.

Signed-off-by: gulldan <[email protected]>
@muscariello
muscariello requested a review from a team as a code owner November 2, 2026 22:39
@muscariello
muscariello added this pull request to stack #460 November 2, 2026 22:40
@codecov

codecov Bot commented Nov 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@muscariello
muscariello added this pull request to the merge queue Nov 3, 2026
Merged via the queue into main with commit 8b66c96 Nov 3, 2026
22 checks passed
@muscariello
muscariello deleted the stack/16-executor-error-marks-task-failed branch November 3, 2026 08:17
@github-actions github-actions Bot mentioned this pull request Nov 3, 2026
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]: a task whose executor fails stays SUBMITTED/WORKING forever

3 participants