Fix Celery worker crash on Airflow 3.0 with json_logs#69919
Merged
Conversation
vatsrahul1001
requested review from
dheerajturaga and
hussein-awala
as code owners
July 15, 2026 12:34
vatsrahul1001
force-pushed
the
fix-celery-json-output-af30
branch
2 times, most recently
from
July 15, 2026 13:26
e799875 to
f1339dc
Compare
kaxil
approved these changes
Jul 15, 2026
kaxil
left a comment
Member
There was a problem hiding this comment.
LGTM. Correct version boundary -- verified against stable-branch content that json_output lands in the task-sdk configure_logging on 3.1+, so gating the 3.0.x fallback on AIRFLOW_V_3_1_PLUS is right. Fix restores pre-#68916 behavior and the regression test has teeth.
The celery worker CLI unconditionally passed `json_output` to `airflow.sdk.log.configure_logging` under an `AIRFLOW_V_3_0_PLUS` gate. That parameter was only added to the Task SDK in 1.1 (Airflow 3.1, the structlog migration), so on Airflow 3.0.x the call raises `TypeError: configure_logging() got an unexpected keyword argument 'json_output'` and the worker crashes on startup. Gate the `json_logs` handling on a new `AIRFLOW_V_3_1_PLUS` constant and fall back to `configure_logging(output=sys.stdout.buffer)` on 3.0.x, so the provider stays compatible across the full Airflow 3.x range it supports. Signed-off-by: Rahul Vats <rah.sharma11@gmail.com>
vatsrahul1001
force-pushed
the
fix-celery-json-output-af30
branch
from
July 15, 2026 14:31
f1339dc to
6adb60c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The Celery worker CLI passes
json_outputtoairflow.sdk.log.configure_loggingunder anAIRFLOW_V_3_0_PLUSgate (added in #68916 "Honor json_logs config in Celery worker startup"):But
json_outputwas only added to the Task SDK'sconfigure_loggingin SDK 1.1 / Airflow 3.1 (the structlog migration, #52651). On Airflow 3.0.x that parameter does not exist, so the call raises:…and the Celery worker crashes on startup. The
AIRFLOW_V_3_0_PLUSgate is too loose — this affects any plain Airflow 3.0.x deployment running celery provider >= 3.22.0.How
AIRFLOW_V_3_1_PLUSconstant to the provider'sversion_compat.json_logshandling onAIRFLOW_V_3_1_PLUS. On Airflow 3.0.x, fall back toconfigure_logging(output=sys.stdout.buffer)(nojson_output), matching the pre-Honor json_logs config in Celery worker startup #68916 behavior.This keeps the provider compatible across the full Airflow 3.x range it declares support for;
json_logsis honored from 3.1+ where the SDK supports it.Tests
Added
test_json_output_not_passed_on_airflow_3_0(patchesAIRFLOW_V_3_1_PLUS = False, assertsconfigure_loggingis called withoutjson_output). Existingjson_logstests continue to assert the 3.1+ behavior.Was generative AI tooling used to co-author this PR?
Generated-by: Claude Code (Opus 4.8) following the guidelines
I reviewed and understand all of the generated code, verified it against the actual
worker()code path, and ran the relevant static checks and tests locally.