Fix AirbyteJobSensor marking a cancelled job as success in deferrable mode#69786
Open
steveahnahn wants to merge 1 commit into
Open
Fix AirbyteJobSensor marking a cancelled job as success in deferrable mode#69786steveahnahn wants to merge 1 commit into
steveahnahn wants to merge 1 commit into
Conversation
… mode When the deferred sensor resumes, execute_complete only failed on an "error" event. A job cancelled while the sensor was deferred yields a "cancelled" event, which fell through to the success path, so the task was marked SUCCESS and downstream tasks ran against a sync that never completed. The same sensor fails correctly on a cancelled job in non-deferrable mode, and the sibling AirbyteTriggerSyncOperator already fails on the cancelled event, so deferrable sensor runs silently diverged from both. Fail closed on any non-success status so unrecognized statuses cannot be treated as success either.
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.
Problem
AirbyteJobSensorin deferrable mode resumes viaexecute_complete, which only fails on anerrorevent.AirbyteSyncTriggeryield acancelledevent, which fell through to the success path: the task is marked SUCCESS and downstream tasks run against a sync that never completed.poke()raises, the deferrableexecute()raises when it seesCANCELLEDbefore deferring, and the siblingAirbyteTriggerSyncOperator.execute_completealready fails on thecancelledevent (added in Implement execution_timeout semantics for AirbyteTriggerSyncOperator in deferrable mode #64051, which did not cover the sensor).Change
execute_complete, matchingpoke(). Thecancelledevent now fails the task, and unrecognized statuses fail closed instead of being treated as success.Live verification
Ran a real
airflow standalone(scheduler, triggerer, API server) against a live local endpoint serving the Airbyte jobs API, with the connection host pointed at it. Both runs: sensor deferred while the job wasrunning, then the job was flipped tocancelled.RuntimeError: Job run 1 has been cancelled., run marked Failed.Tests
test_execute_complete_fails_when_job_did_not_succeed(parametrized:cancelled, unrecognized status) fails on the code before this change; the failure output shows the bug verbatim ("completed successfully." on a cancelled event).test_execute_complete_succeeds_on_success_eventguards the happy path.Was generative AI tooling used to co-author this PR?
Generated-by: Claude Code (Fable 5) following the guidelines