Repository navigation
RE: a cancel Prefect accepts is never reported as failed (TR-62c) - #1116
Merged
Merged
Conversation
… is a cancel
laz, flow run 90cf24d0: a SCHEDULED run hit RE's deadline. Prefect REJECTed
the CANCELLING proposal ("Scheduled flow run has no infrastructure to
terminate.") and set CANCELLED itself (BypassCancellingFlowRunsWithNoInfra),
but request_cancel read every ABORT/REJECT as a refusal: the deadline line
said "cancel attempt FAILED ... the run may still be live", and the Admin
route answered 502 on a run it had cancelled. The forced CANCELLED TR-62b
removed had covered this case.
request_cancel now re-reads the run after an ABORT or REJECT: CANCELLED or
CANCELLING is success, "before it started" (CancelOutcome.before_start). The
deadline line ends "; the run was cancelled before it started"; the route
returns {"status": "cancelled"}. Any other state, or an unreadable one, keeps
the existing refusal words.
Tests: tests/test_tr62c_cancel_reject_is_cancelled.py (13).
Signed-off-by: Dan Wolfson <dan.wolfson@pdr-associates.com>
The full suite's no-silent-success ratchet caught a log-free `except: pass` around the re-read. The refusal now ends "; its state could not be read afterwards (<Type>)", so "refused" and "refused, and we could not check" read differently. Signed-off-by: Dan Wolfson <dan.wolfson@pdr-associates.com>
Read-back R1: before_start was set for any CANCELLED or CANCELLING read after a refused cancel. CancelOutcome now says `cancelled` (CANCELLED now) and `before_start` (CANCELLED and no start_time) separately: - refused, then CANCELLING (e.g. a second Admin Cancel on a running run): a cancel under way; the route says "cancelling", the deadline line "; the run was cancelled"; - refused, then CANCELLED with a start_time (an earlier cancel won): the route says "cancelled", the deadline line "; the run was cancelled"; - refused, then CANCELLED with no start_time (the laz SCHEDULED case): "; the run was cancelled before it started", route "cancelled". Tests: the CANCELLING half of the earlier parametrized success test now expects a cancel under way (R1), plus 7 new cases. Signed-off-by: Dan Wolfson <dan.wolfson@pdr-associates.com>
dwolfson
added a commit
that referenced
this pull request
Nov 19, 2026
…nto the odpi sync Signed-off-by: Dan Wolfson <dan.wolfson@pdr-associates.com>
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.
TR-62c: a cancel Prefect accepts is never reported as failed
This fixes a regression from #1115 (TR-62a/b), found in that PR's live proof on laz on 2026-11-19.
The bug. When a run hasn't started yet (SCHEDULED or PENDING, so it has no infrastructure), Prefect rejects the CANCELLING proposal and sets the run to CANCELLED itself.
request_canceltreated every ABORT or REJECT as a refusal. So for a run that Prefect had in fact cancelled:The old forced
Cancelled()had handled this case.The fix. After an ABORT or REJECT,
request_cancelre-reads the run.start_time): success, worded "the run was cancelled before it started". The route returns 200{"status": "cancelled"}.Commits
Tests
test_tr62c_cancel_reject_is_cancelled.py, 18 tests. A REJECT followed by a CANCELLED read is success on both the deadline path and the route. An ABORT followed by a COMPLETED read stays a refusal.No separate live proof is needed (Architect). Nothing runs or writes differently; only the reported outcome changes.
🤖 Generated with Claude Code