Validate trigger events in Anthropic deferrable tasks#69379
Merged
kaxil merged 2 commits intoJul 6, 2026
Merged
Conversation
Contributor
|
Could the helper also validate the keys each resume path needs, not just Drafted-by: Codex (GPT-5); reviewed by @Vamsi-klu before posting |
kaxil
approved these changes
Jul 6, 2026
kaxil
reviewed
Jul 6, 2026
kaxil
reviewed
Jul 6, 2026
Co-authored-by: Kaxil Naik <kaxilnaik@gmail.com>
gopidesupavan
approved these changes
Jul 6, 2026
1 task
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.
The Anthropic provider's three deferrable resume paths —
AnthropicBatchOperator.execute_complete,AnthropicBatchSensor.execute_completeandAnthropicAgentSessionOperator.execute_complete— used the trigger event without validating it:event=None: happens when a deferred task resumes without a payload — a custom or subclassed trigger that yieldsTriggerEvent(None), or an event payload lost between the triggerer and the worker. Crashed with an opaqueTypeError: 'NoneType' object is not subscriptable.status: happens on triggerer/worker version skew (a task defers under one provider version and resumes under another whose trigger emits a different status vocabulary) or with a custom trigger. These methods branch deny-list style (timeout/errorraise, everything else succeeds), so an unknown status fell through into the success path — the task was marked SUCCESS even though the Anthropic batch/session outcome was unknown.This adds a
validate_execute_complete_event()helper applied at the top of all three methods. TheNonecheck mirrors the amazon provider's helper of the same name (https://github.com/apache/airflow/blob/main/providers/amazon/src/airflow/providers/amazon/aws/utils/__init__.py#L70-L75).The status check plays the role amazon's call sites cover with their
if validated_event["status"] != "success": raiseallow-list branching (https://github.com/apache/airflow/blob/main/providers/amazon/src/airflow/providers/amazon/aws/operators/emr.py#L207-L209)Note: event validation across other providers is inconsistent — databricks has a required-keys helper (
validate_trigger_event), while e.g. google and dbt.cloud access the event unvalidated with the same deny-list branching. This PR only fixes the Anthropic provider.Was generative AI tooling used to co-author this PR?
Claude Code
{pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.