Repository navigation
Keep A2A canceled sticky against message/send persist - #331
Merged
Merged
Conversation
tasks/cancel can land while unary message/send is still unwinding. The stream path already refused to overwrite canceled; update_a2a_task now enforces the same so completed/failed cannot clobber cancel, and the send RPC returns request cancelled instead of a completed Task. Co-authored-by: Tyler Reckart <tylerreckart@users.noreply.github.com>
This was referenced Sep 12, 2026
tylerreckart
marked this pull request as ready for review
September 21, 2026 13:23
…-cancel # Conflicts: # CHANGELOG.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
tasks/cancelpersistscanceledwhile an in-flightmessage/sendis still unwinding. The stream path already refuses to overwrite that row (get_a2a_taskthen skip the terminal persist). The unary send path always wrotebuild_terminal_task'scompleted/failedthroughupdate_a2a_task, so a successful (or failed) send could revive a canceled task.tasks/getthen disagreed with the cancel RPC, and the send client received a completed Task.Exception / tenant-disabled paths on send had the same hole: they wrote
failedwithout checking for a racing cancel.Fix
update_a2a_taskkeepscanceledsticky: a non-canceledstateis a no-op when the row is alreadycanceled. Re-writingcanceled(the cancel handler itself) still lands soupdated_at/ error stay current. Unarymessage/sendtreats that CAS miss asrequest cancelledinstead of returning a completed Task.Tests
unit_request_log— canceled is not overwritten by completed/failed; re-writing canceled still succeeds; working → completed still works when cancel never landed.Independently mergeable against
main. Code hunks are disjoint from #322/#330 (list_conversations/EntryFilter) and from #321–#329. CHANGELOG[Unreleased]will need a rebase after whichever sibling merges first.Note
Medium Risk
Changes durable A2A task state and unary RPC outcomes on cancel/send races; behavior is narrower (cancel wins) but affects protocol clients that relied on a completed send response after cancel.
Overview
Fixes a race where
tasks/cancelcould persistcanceledwhile unarymessage/sendwas still finishing, thenupdate_a2a_taskwrotecompleted/failedand the RPC returned a terminal Task thattasks/getcontradicted. The stream path already avoided that overwrite; this change aligns unary send.TenantStore::update_a2a_tasknow treatscanceledas sticky in SQL: updates with a non-canceledstate are a no-op when the row is alreadycanceled; re-writingcanceled(e.g. fromtasks/cancel) still succeeds soupdated_at/ error text stay current. Unarymessage/sendchecks that CAS: if persist fails and the row is stillcanceled, it responds withrequest cancelledinstead of a completed Task.Adds a
unit_request_logtest for sticky cancel plus normalworking→completedwhen cancel never landed, and documents the behavior inCHANGELOGandtenant_store.h.Reviewed by Cursor Bugbot for commit 7733e34. Bugbot is set up for automated code reviews on this repo. Configure here.