Skip to content

Fix A2A thread safety and implement tasks/get, tasks/cancel - #2155

Open
hadirsa wants to merge 6 commits into
embabel:mainfrom
hadirsa:fix/a2a-thread-safety-cleanup
Open

hadirsa wants to merge 6 commits into
embabel:mainfrom
hadirsa:fix/a2a-thread-safety-cleanup

Conversation

@hadirsa

@hadirsa hadirsa commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Closes #2034

Summary

  • Thread safety: TaskStateManager now uses one map of immutable TaskInfo values, updated atomically. The A2A services are @ThreadSafe, and A2AThreadSafetyRulesTest checks them.
  • Protocol: implements tasks/get and tasks/cancel, stores message/send tasks, and accepts multi-part messages. Failures return InternalError with the request id, and the streaming error event is final.
  • Cleanup: removes the unused scheduler and the TODOs.

Keep tasks in one ConcurrentHashMap of immutable TaskInfo values updated atomically, and add getTask for tasks/get.

Signed-off-by: Hadi Rasouli <rasuli.hadi4@gmail.com>
Register message/send tasks so tasks/get can find them, return InternalError on failure and mark failed streams final.

Signed-off-by: Hadi Rasouli <rasuli.hadi4@gmail.com>
Signed-off-by: Hadi Rasouli <rasuli.hadi4@gmail.com>
Signed-off-by: Hadi Rasouli <rasuli.hadi4@gmail.com>
Add embabel.agent.platform.a2a.server.task-retention (default 1h). TaskStateManager evicts tasks finished longer ago than that whenever a task is registered.

Signed-off-by: Hadi Rasouli <rasuli.hadi4@gmail.com>
Signed-off-by: Hadi Rasouli <rasuli.hadi4@gmail.com>
@hadirsa
hadirsa force-pushed the fix/a2a-thread-safety-cleanup branch from 73ab653 to 4da1d3f Compare October 15, 2026 21:52
@igordayen
igordayen requested a review from azanux October 16, 2026 01:16
@igordayen igordayen added this to the 1.5.5-Release🔵 milestone Oct 16, 2026
@hadirsa
hadirsa force-pushed the fix/a2a-thread-safety-cleanup branch 3 times, most recently from cf027c5 to 4da1d3f Compare October 16, 2026 05:06
@hadirsa hadirsa changed the title WIP: Fix A2A thread safety and implement tasks/get, tasks/cancel Fix A2A thread safety and implement tasks/get, tasks/cancel Oct 16, 2026
@hadirsa
hadirsa marked this pull request as ready for review October 16, 2026 05:56
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.

A2A Stack — Thread Safety & Correctness Cleanup

2 participants