What happened and how to reproduce it?
HttpSensor supports response_error_codes_allowlist so users can treat selected HTTP errors as "keep poking" instead of failing the task. In the synchronous path this is honored by checking self.response_error_codes_allowlist in HttpSensor.poke().
However, in deferrable mode the behavior appears to diverge after the task is deferred:
providers/http/src/airflow/providers/http/sensors/http.py stores the configured allowlist and uses it in poke().
HttpSensor.execute() creates an HttpSensorTrigger, but does not pass response_error_codes_allowlist to the trigger.
providers/http/src/airflow/providers/http/triggers/http.py has HttpSensorTrigger.run() retry only when the exception string starts with "404".
A DAG using something like this can behave differently depending on whether deferrable mode is enabled:
HttpSensor(
task_id="wait_for_api",
endpoint="/health",
http_conn_id="my_api",
response_error_codes_allowlist=["404", "503"],
deferrable=True,
)
Expected behavior: 503 should be treated the same way as in non-deferrable mode, i.e. the sensor should keep waiting according to poke_interval.
Current behavior: the initial worker-side poke() can honor 503, but after deferral the trigger only handles 404. For other allowlisted statuses such as 503, the trigger does not sleep via the allowlist path and does not preserve the documented sensor behavior.
What you think should happen instead?
HttpSensorTrigger should accept and serialize the configured response_error_codes_allowlist, and HttpSensor.execute() should pass the value when creating the trigger.
The trigger should use that allowlist instead of hard-coding 404, so deferrable and non-deferrable HttpSensor behavior are consistent.
A unit test should cover a deferrable HttpSensor with a custom allowlist such as ["404", "503"].
What happened and how to reproduce it?
HttpSensorsupportsresponse_error_codes_allowlistso users can treat selected HTTP errors as "keep poking" instead of failing the task. In the synchronous path this is honored by checkingself.response_error_codes_allowlistinHttpSensor.poke().However, in deferrable mode the behavior appears to diverge after the task is deferred:
providers/http/src/airflow/providers/http/sensors/http.pystores the configured allowlist and uses it inpoke().HttpSensor.execute()creates anHttpSensorTrigger, but does not passresponse_error_codes_allowlistto the trigger.providers/http/src/airflow/providers/http/triggers/http.pyhasHttpSensorTrigger.run()retry only when the exception string starts with"404".A DAG using something like this can behave differently depending on whether deferrable mode is enabled:
Expected behavior:
503should be treated the same way as in non-deferrable mode, i.e. the sensor should keep waiting according topoke_interval.Current behavior: the initial worker-side
poke()can honor503, but after deferral the trigger only handles404. For other allowlisted statuses such as503, the trigger does not sleep via the allowlist path and does not preserve the documented sensor behavior.What you think should happen instead?
HttpSensorTriggershould accept and serialize the configuredresponse_error_codes_allowlist, andHttpSensor.execute()should pass the value when creating the trigger.The trigger should use that allowlist instead of hard-coding
404, so deferrable and non-deferrableHttpSensorbehavior are consistent.A unit test should cover a deferrable
HttpSensorwith a custom allowlist such as["404", "503"].