Skip to content

Improve error handling and logging in CommsDecoder interface #46426

Open

Description

@ashb

Resurrect #45927 and extend it.

Every request should have a response that the client reads.

We need the ability to pass/send errors from Supervisor to the task code (for instance if there is an error performing an action, or if the XCom can't be found) -- right now each end point handles this itself in a different way.

except ServerResponseError as e:
if e.response.status_code == HTTPStatus.NOT_FOUND:
log.error(
"XCom not found",
dag_id=dag_id,
run_id=run_id,
task_id=task_id,
key=key,
map_index=map_index,
detail=e.detail,
status_code=e.response.status_code,
)
# Airflow 2.x just ignores the absence of an XCom and moves on with a return value of None
# Hence returning with key as `key` and value as `None`, so that the message is sent back to task runner
# and the default value of None in xcom_pull is used.
return XComResponse(key=key, value=None)
for example shouldn't be handled in the API Client, but it should expose/raise the 404 to the Task itself and it should be handled there

Activity

  1. converted this from a draft issue on Feb 4, 2025
  2. kaxil commented on Apr 9, 2025

    @kaxil
    Member
  3. moved this from Icebox to In Progress in AIP-72 - Task Execution Interface and SDKon Jun 5, 2025
  4. self-assigned this
    on Jun 5, 2025
  5. added this to the Airflow 3.0.3 milestone on Jun 16, 2025
  6. amoghrajesh commented on Jul 30, 2025

    @amoghrajesh
    Contributor

    @ashb a lot of this has been handled already via: #51699?

    Do we have more to do for 3.0.4? Or can we move this one to 3.1?

  7. ashb commented on Jul 30, 2025

    @ashb
    MemberAuthor

    @amoghrajesh I think to mark this as closed we need to at least do these

    • Look at all the error reporting paths
    • Remove OKResponse entirely, that isn't needed anymore since errors would be explicitly raised.

    But we can move this to 3.1, yes

  8. amoghrajesh commented on Feb 12, 2026

    @amoghrajesh
    Contributor

    @ashb do you think we should be working on this as part of 3.2 or move it to later with advances we have made in task sdk so far?

  9. amoghrajesh commented on Feb 17, 2026

    @amoghrajesh
    Contributor

    Moving to a different parent issue, we can figure out if this needs improvement there: #62061

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions