Cancel task
Cancels a task by marking it for cancellation in the system.
This method initiates task cancellation based on the task's current state:
- If the task has not been sent to an agent, it cancels immediately and transitions the task
to a terminal state (`STATUS_DONE_NOT_OK` with `ERROR_CODE_CANCELLED`).
- If the task has already been sent to an agent, the cancellation request is routed to the agent.
The agent is then responsible for deciding whether cancellation is possible or not:
- If the task can be cancelled, the agent must use `UpdateTaskStatus` and set the task status to `STATUS_DONE_NOT_OK`.
- If the task cannot be cancelled, the agent must use `UpdateTaskStatus` to attach a `TaskError` to the task with the error code `ERROR_CODE_REJECTED`
and a `message` explaining why the task cannot be cancelled.