Uh oh!
There was an error while loading. Please reload this page.
Respect run on latest version when clearing a running Dag run - #71425
Respect run on latest version when clearing a running Dag run#71425ephraimbuddy wants to merge 2 commits into
Conversation
run_on_latest_version should have the same meaning for running and queued Dag runs, and when callers preserve a finished run's state. Otherwise cleared running tasks can retry against stale code while the Dag run still points at an older serialized Dag or bundle. Keeping the run, cleared task instances, integrity checks, and bundle selection aligned preserves the user's explicit rerun choice without rewriting unrelated task-version history.
pierrejeambrun
left a comment
There was a problem hiding this comment.
LGTM, but would love another pair of eyes.
Just one nit
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Pierre Jeambrun <pierrejbrun@gmail.com>
dstandish
commented
Aug 11, 2026
Hi Ephraim. Want to flag a design concern The field Documented or not, the name itself was always the contract — a write-once historical fact, not a live pointer. Per a conversation with @jedcunningham (the original author of AIP-65), that was intentional: bundle-versioned (pinned) runs were always meant to execute the version pinned at creation, with no path to move off it. "Run with the latest code" was supposed to be achieved by not using a versioned bundle — unpinned bundles already always resolve to the latest DagVersion (DBDagBag._version_from_dag_run). Starting with #54984 and extended through #59764 and #65835/#66901, created_dag_version_id started being mutated after creation to support run_on_latest_version for pinned runs — a capability the original design didn't intend to exist for that case. This PR extends the same mutation to running/queued runs, going further in that direction. That mutation has already produced concrete, reachable bugs elsewhere in the codebase, because other code correctly assumed the field's original (immutable) contract: #71454 — DagRun.dag_versions silently drops versions still in use by task instances that weren't part of a given clear. Given the original design intent, I think this is worth pausing on: should run_on_latest_version apply to bundle-versioned/pinned runs at all, rather than being extended further here? If the answer is yes and this is a deliberate, considered departure from the original pinning guarantee, it should probably written down somewhere (and the field's contract/docs updated to match), rather than continuing to build on a field whose name and documentation still say something the code no longer does. |
Thanks for raising this. I agree that the name and documentation of I don’t think that should block this PR, though. #71425 does not introduce the mutation for queued/running Dag runs: The #71455 repro also does not reproduce on the finished-run path as written. That path calls I agree #71454 is valid. On the broader design question, From the consumers I checked, the execution paths use My preference is therefore to land #71425 to restore the existing invariants, fix #71454 and Drafted-by: Codex (5.6 Sol); reviewed by @ephraimbuddy before posting |
run_on_latest_version should have the same meaning for running and queued Dag runs, and when callers preserve a finished run's state. Otherwise cleared running tasks can retry against stale code while the Dag run still points at an older serialized Dag or bundle.
Keeping the run, cleared task instances, integrity checks, and bundle selection aligned preserves the user's explicit rerun choice without rewriting unrelated task-version history.
Was generative AI tooling used to co-author this PR?
Generated-by: Codex (5.6 Sol) following the guidelines