0BVer opened a new issue, #77757: URL: https://github.com/apache/airflow/issues/77757
### Description `ClassifierRetryPolicy` and `LLMRetryPolicy` decide from the exception alone: its class and message (or traceback), the attempt count and the category descriptions. For some failures that is not enough. `KubernetesPodOperator` raises `Pod <name> returned a failure.` whatever happened inside the pod, so a policy cannot tell an out-of-memory kill from a bug in the user's code. The task's own log usually settles it, but a policy cannot read that log today. A policy runs in the task-runner process on the worker and receives the task's `context`, so it looks as if it could open the log file. As far as I can tell from reading `main`, it cannot do that reliably: * The log path is rendered by the scheduler or the executor from `log_filename_template` and handed to the supervisor. `StartupDetails` does not carry it, so the task runner never receives it. * On `main` the rendered path depends on the task instance's loop and map `log_position`, so a worker cannot rebuild it from configuration alone. A reader built on a guessed path would read the wrong file, or none, for some task instances. The proposal is to expose where the current attempt's log lives to the task runner, so that a model-backed retry policy can read its tail. The open questions are what to expose (a path, or a reader object that also covers remote logging) and how the reader sees lines the supervisor has not flushed yet. The text would go through the same redaction as the exception message, and the docs would keep the warning that task output holds secrets and personal data more often than an exception does. ### Use case/motivation Retry only what is worth retrying. A policy that sees the last lines of the task's output can send an obviously permanent failure (a missing table, a failed assertion) straight to FAIL, and keep retrying a transient one (a node that went away, a rate limit) that the exception message hides. An opt-in `extra_context` callable on both policies, which takes the task's `context` and returns extra prompt text, is the generic part of this and does not depend on the log path. With it a task author can pass the tail of the output, the outcome of earlier attempts or a lookup in the system the task launched. It is proposed in a separate PR. This issue tracks the part that does depend on the task-sdk: a built-in way to get at the task's own log. ### Related issues The `include_traceback` option (#74308) is the closest precedent. It added more text to the prompt, and it is redacted first and then cut to its tail. ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md) --- Drafted-by: Claude Code (Sonnet 5.5) (no human review before posting) -- 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]
