Skip to content

[BUG] Completed background A2A tasks are not retained in /tasks (completed_task_retention ignored) #691

Closed

Description

@edenreich

Summary

Submitting an A2A task to a (mock) agent and letting it complete leaves nothing in /tasks: the task shows while running, then disappears on completion. The default a2a.task.completed_task_retention: 5 should keep the last 5 completed A2A tasks, but none are retained.

Root cause: the only place that populates the A2A retention service is retainTaskFromResult (internal/services/a2acoord/coordinator.go:199-219), called from taskCompletedCmds. It retains a task only when BOTH:

  1. result.Data type-asserts to tools.A2ASubmitTaskResult (:204), and
  2. submitResult.Task != nil (:209).

For a backgrounded A2A submission - the "delegated, you'll be notified when it completes" flow used for async / mock agents - the submit result is built at internal/agent/tools/a2a_task.go:264-278 with no Task field set (only TaskID / ContextID / AgentURL / State / ...). So when completion is handled, submitResult.Task == nil and the task is never added to the retention service. It is already gone from the active poller (it finished), so it vanishes from /tasks entirely.

Two fragilities in the same gate:

  • result.Data.(tools.A2ASubmitTaskResult) is a concrete-type assertion that also silently fails if the result has been through a JSON round-trip (Data becomes map[string]any) - the same class of issue noted elsewhere in the codebase for tool-result Data.
  • Requiring a non-nil *adk.Task means the common background path (which only has the task id / polling state at submit time) is never retained.

Note: I could not locate where domain.A2ATaskCompletedEvent is constructed/emitted in a quick search (no inline struct literal in non-test code), so the maintainer should confirm whether the completion event carries the final Task; if it does not, that is the fix point.

This is independent of the new per-kind /tasks tables: the view reads completed A2A rows from taskRetentionService.GetTasks() and shows them in the default "All" tab; the retention service is simply never populated for backgrounded tasks.

Steps to Reproduce

  1. Configure an A2A (mock) agent; ensure a2a.task.completed_task_retention: 5 (default).
  2. In chat, submit a task to the agent (backgrounded - "you will be notified when it completes").
  3. Open /tasks while it runs - it appears under active.
  4. Wait for completion, reopen /tasks.

Expected Behavior

The completed A2A task remains listed in /tasks (Completed / All tabs), up to the last 5 (completed_task_retention).

Actual Behavior

The task disappears from /tasks after completion; nothing is retained.


Suggested fix: retain completed A2A tasks by task id / polling state even when the final *adk.Task is not present (and make the result.Data extraction tolerant of the map[string]any round-trip), and/or ensure the completion event carries the final Task.

Activity

  1. added
    bug
    on Jun 30, 2026
  2. added theissue type on Jun 30, 2026
  3. moved this to Todo in 2026on Jun 30, 2026
  4. inference-gateway-releaser commented on Jun 30, 2026

    @inference-gateway-releaser
    Contributor

    🎉 This issue has been resolved in version 0.126.0 🎉

    The release is available on:

    Your semantic-release bot 📦🚀

  5. moved this from Todo to Done in 2026on Jul 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugreleased

    Type

    Projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions