potiuk opened a new pull request, #67504:
URL: https://github.com/apache/airflow/pull/67504

   `_load_logging_config` called `discover_remote_log_handler` without 
exception protection. A raise there propagated through 
`load_remote_log_handler` (which is called transitively from any logger 
acquisition path) into the task lifecycle handler, crashing the task with a 
non-obvious error.
   
   The earlier PR #66571 fixed the "no handler available" signal; the gap was 
that the discovery call itself wasn't guarded.
   
   Reported as F-005 in the [`apache/tooling-agents` L3 task-sdk sweep 
`0920c77`](https://github.com/apache/tooling-agents/issues/24).
   
   ## Change
   
   Wrap 
[`discover_remote_log_handler`](https://github.com/apache/airflow/blob/main/task-sdk/src/airflow/sdk/log.py#L184)
 in try/except. On failure, emit a warning to the dedicated 
`airflow.logging.remote` structlog logger (same logger PR #66571 uses for 
`remote_log_handler_unavailable` / `remote_log_upload_failed`) and fall back to 
"no remote handler" so the rest of the logging system initialises and the task 
can run with local logs only.
   
   ## Test plan
   
   - [x] `test_discovery_failure_warns_and_falls_back` — patches 
`discover_remote_log_handler` to raise `ImportError`; asserts the warning lands 
with exc_info, `_ActiveLoggingConfig.remote_task_log is None`, and 
`logging_config_loaded is True` (so we don't loop trying to re-discover).
   - [x] `test_discovery_success_no_warning` — success path emits no warning 
and the returned handler is cached.
   - [x] `prek run ruff` clean.
   - [x] `prek run mypy-task-sdk` clean.
   - [x] Full `test_log.py` suite passes.
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes — Claude Code (Opus 4.7)
   
   Generated-by: Claude Code (Opus 4.7) following [the 
guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to