Fix remote logging connection caching in Task SDK#68379
Closed
anshuman0123 wants to merge 2 commits into
Closed
Conversation
The _fetch_remote_logging_conn function in the supervisor was caching None results when a connection lookup failed. In the two-token execution model, an initial lookup with a restricted token might fail, and caching this None result prevented subsequent lookups with an execution token from succeeding. This change ensures that only successful connection lookups are cached, allowing for retries when a better token becomes available. Fixes: apache#68366
amoghrajesh
approved these changes
Jun 11, 2026
Member
|
Duplicate of #68370 |
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.
Summary
Noneresults for connection lookups in the supervisor.Details
In the new two-token execution mechanism, a worker starts with a workload-scoped token which lacks permission to access connections. The connection preloading logic attempts to fetch connections, receives None, and was previously caching this empty result. Later, when the task runs and the worker's token is upgraded to an execution-scoped token (which has connection access), the system continued to use the cached None value, preventing hooks from finding the necessary credentials.
The fix modifies
_fetch_remote_logging_connintask-sdk/src/airflow/sdk/execution_time/supervisor.pyto only cache truthy connection results. By not caching None, the worker is forced to re-attempt the connection lookup later (e.g., during log upload) when it has the correct token scope, allowing it to successfully retrieve the connection details.Testing
_fetch_remote_logging_connno longer caches None values when lookups fail.Fixes: #68366