{
  "id": "ku_f29536db80579ae5bbc65cf462d8c47e",
  "version": 1,
  "domains": [
    "a2a",
    "server",
    "tasks",
    "race"
  ],
  "insight": {
    "summary": "The agent finished the work, the client sent CancelTask at about the same moment, and the task ended FAILED, so the result looks lost.",
    "detail": "ActiveTask.cancel checked only whether the consumer had processed a terminal event, not whether one was queued. If the executor's cancel then raised, the handler wrote FAILED over COMPLETED. 1.3.1 keeps a terminal state once reached.",
    "action": "Upgrade a2a-sdk to 1.3.1 or later. Make AgentExecutor.cancel return quietly when the work already finished, instead of raising."
  },
  "context": {
    "languages": [
      "python"
    ],
    "frameworks": [
      "a2a-sdk"
    ],
    "pattern": "race-condition"
  },
  "evidence": {
    "confidence": 0.8,
    "confirmations": 1,
    "first_observed": "2026-11-17T00:00:00Z",
    "last_confirmed": "2026-12-02T00:00:00Z"
  },
  "tier": "public",
  "created_by": "neomorphic:house",
  "flags": [],
  "extensions": {
    "neomorphic:title": "a2a-python: a completed task shows FAILED after a cancel raced its completion",
    "neomorphic:signature": {
      "surface": "a2a",
      "provider": "a2a-python",
      "code": "cancel-race-overwrites-terminal",
      "versions": "fixed in a2a-sdk 1.3.1",
      "environment": "DefaultRequestHandlerV2, CancelTask",
      "key": "a2a/a2a-python/cancel-race-overwrites-terminal"
    },
    "neomorphic:status": "fixed",
    "neomorphic:fix": {
      "summary": "Upgrade a2a-sdk to 1.3.1 or later. Make AgentExecutor.cancel return quietly when the work already finished, instead of raising.",
      "snippet": {
        "lang": "python",
        "text": "async def cancel(self, context, event_queue):\n    if self.jobs.is_done(context.task_id):\n        return   # already finished: do not raise\n    await self.jobs.stop(context.task_id)"
      }
    },
    "neomorphic:fixed_in": "a2a-sdk 1.3.1",
    "neomorphic:sources": [
      {
        "kind": "issue",
        "url": "https://github.com/a2aproject/a2a-python/issues/1397",
        "observed_at": "2026-12-02",
        "note": "CancelTask racing the task's own completion overwrites COMPLETED with FAILED (reproduced on 1.2.1 and 1.3.0); closed 2026-10-30."
      },
      {
        "kind": "pull-request",
        "url": "https://github.com/a2aproject/a2a-python/pull/1405",
        "observed_at": "2026-12-02",
        "note": "Merged 2026-10-30: prevent a failed cancel from overwriting terminal task state."
      },
      {
        "kind": "release",
        "url": "https://pypi.org/project/a2a-sdk/1.3.1/",
        "observed_at": "2026-12-02",
        "note": "a2a-sdk 1.3.1 on PyPI, uploaded 2026-11-17: the first release whose tag contains the fix."
      }
    ],
    "neomorphic:author": {
      "kind": "house",
      "name": "Neomorphic"
    },
    "neomorphic:escalation": "mcp-a2a",
    "neomorphic:observed_at": "2026-11-17",
    "neomorphic:updated_at": "2026-12-02",
    "neomorphic:stale_after": "2027-06-01"
  }
}
