Repository navigation
Conversation
Preserve the completed SDK status after selected native shutdown signals. Keep cancellation, incomplete uploads, invalid completion records, and explicit task failures unrecovered. Signed-off-by: 1fanwang <1fannnw@gmail.com>
1fanwang
requested review from
cosmicbboy,
davidmirror-ops,
kumare3,
machichima,
pingsutw,
samhita-alla and
wild-endeavor
as code owners
November 5, 2026 03:33
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #3483 +/- ##
===========================================
+ Coverage 46.34% 83.58% +37.24%
===========================================
Files 327 3 -324
Lines 28868 195 -28673
Branches 3039 0 -3039
===========================================
- Hits 13379 163 -13216
+ Misses 15388 32 -15356
+ Partials 101 0 -101 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Tracking issue
There is no linked public issue.
Why are the changes needed?
The fast-execution launcher reports failure when a native shutdown signal arrives after task results have been uploaded. A task that returns 42 and uploads its result still leaves the launcher at exit 245 when its exit hook receives SIGSEGV.
What changes were proposed in this pull request?
Add a recovery mode that is off by default and is switched on through the task environment. When it is on, the launcher restores the SDK's completed status only when a fresh completion record identifies its direct child and the upload path has finished. Task hooks run before upload, so a plugin cannot safely record this boundary.
Recovery excludes termination signals, forwarded cancellation, and earlier failures. It preserves error documents and the SDK's explicit failure status. Exit hooks still run, but a crash can interrupt remaining cleanup.
How was this patch tested?
Testing Done
The reproducer runs each commit's entrypoint source against the same installed SDK and dependencies, and it switches recovery on by setting FLYTE_RECOVER_SHUTDOWN_CRASH in the task environment. It launches the fast-execute and execute CLIs, unpacks a local code distribution, uploads a real protobuf result, and injects a signal in an exit hook. This is controlled fault injection, not a reproduction of a Ray native defect. No remote Flyte deployment or Ray cluster was exercised.
Setup process
Python 3.12.13 on macOS arm64, from the repository root with this PR checked out:
The reproducer exports the original entrypoint from c3735a6 and the fixed entrypoint from the PR commit. Save the source below as /tmp/flytekit-shutdown-repro-9d81b06f.py.
Reproducer source: flytekit-shutdown-repro-9d81b06f.py
Screenshots
Not applicable to this runtime change.
Check all the applicable boxes
Related PRs
#2305 preserves automatic Ray shutdown so worker logs can finish flushing.
#3029 proposes a separate launcher startup optimization.
Docs link
https://github.com/flyteorg/flytekit/blob/25c96e2cd3ba7e6997681db0fb9c83b528e985e5/docs/source/design/execution.rst#recovering-completed-results-after-a-shutdown-crash