The GitHub Actions job "Tests AMD" on airflow.git/fix-bug-dag-test has 
succeeded.
Run started by GitHub user kaxil (triggered by kaxil).

Head commit for run:
93ada665d1b9af7956d5f2b3313071c8848d4c0b / Kaxil Naik <[email protected]>
Fix bug with in-process request handling for `dag.test`

Fixes a subtle bug where `SUPERVISOR_COMMS` was incorrectly set during 
supervisor-side request handling in `InProcessSupervisorComms.send_request()`.

When calling the supervisor’s `_handle_request()` (e.g. in response to a 
connection or variable fetch), some internal logic (like `Variable.get()` or 
`Connection.get_connection_from_secrets()`) would incorrectly detect that it 
was running in a Task SDK execution context — because `SUPERVISOR_COMMS` was 
still set.

This led to recursive calls into the SDK flow (e.g., calling 
`SUPERVISOR_COMMS.lock`) **while already holding the lock**, resulting in 
`AttributeError: 'NoneType' object has no attribute 'lock'` or deadlocks.

- The fix ensures `SUPERVISOR_COMMS` is temporarily unset while handling the 
request.
- This prevents Task SDK context detection logic from activating during 
supervisor API handling.
- The `set_supervisor_comms(None)` context manager is now explicitly used 
within `send_request()` to guard the call to `_handle_request()`.

- Unit tests for `set_supervisor_comms()` covering all override/restore edge 
cases
- A roundtrip test that verifies `send_request()` triggers `_handle_request()`, 
which in turn uses `send_msg()` to queue a response retrievable via 
`get_message()`

This fixes real bugs encountered when using `dag.test()` in system tests that 
rely on connections or variables:
- Tasks attempting to fetch a connection during execution caused the supervisor 
to recurse into its own comms path
- This led to incorrect error handling (`500 Internal Server Error`) and test 
failures

- Based on debugging a failure in the `example_athena` system test under 
`dag.test()`
- Prevents regressions for other DAGs/tasks that rely on connection or variable 
fetches inside Task SDK runtime

Report URL: https://github.com/apache/airflow/actions/runs/14939563647

With regards,
GitHub Actions via GitBox


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to