Skip to content

Add validate trigger events deferrable tasks OpenAI provider#69506

Open
takayoshi-makabe wants to merge 1 commit into
apache:mainfrom
takayoshi-makabe:add-validate-trigger-events-openai-deferrable-tasks
Open

Add validate trigger events deferrable tasks OpenAI provider#69506
takayoshi-makabe wants to merge 1 commit into
apache:mainfrom
takayoshi-makabe:add-validate-trigger-events-openai-deferrable-tasks

Conversation

@takayoshi-makabe

Copy link
Copy Markdown
Contributor

OpenAITriggerBatchOperator.execute_complete used the trigger event without validating it, branching deny-list style (only status == "error" raised, everything else succeeded):

  • cancelled was marked SUCCESS: the provider's own OpenAIBatchTrigger emits {"status": "cancelled"} when the batch is cancelled while the task is deferred, but only error raised — so the task went green with no results. The non-deferrable path (OpenAIHook.wait_for_batch) has raised for CANCELLED/CANCELLING since feat(providers/openai): support batch api in hook/operator/trigger #41554, so the two modes of the same operator disagreed.
  • event=None: crashed with an opaque TypeError: 'NoneType' object is not subscriptable.
  • Unrecognised status (triggerer/worker version skew, custom trigger): fell through into the success path.

Same fix shape as the anthropic provider in #69379: a validate_execute_complete_event() helper plus allow-list branching (status != "success" raises).

Also fixes a missing else in OpenAIBatchTrigger.run() that yielded a second, spurious error event after every terminal event (benign — only the first event is consumed — but incorrect).


Was generative AI tooling used to co-author this PR?
  • Yes (please specify the tool below)

Claude Code


  • Read the Pull Request Guidelines for more information. Note: commit author/co-author name and email in commits become permanently public when merged.
  • For fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
  • When adding dependency, check compliance with the ASF 3rd Party License Policy.
  • For significant user-facing changes create newsfragment: {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.

@takayoshi-makabe takayoshi-makabe changed the title Add validate trigger events deferrable tasks Add validate trigger events deferrable tasks OpenAI provider Jul 7, 2026
@potiuk potiuk added the ready for maintainer review Set after triaging when all criteria pass. label Jul 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants