fix(gateway): pre-mark sessions resume_pending before drain (#28217)#28576
Merged
Conversation
…vent data loss (#27856) Pre-mark all running agent sessions as resume_pending BEFORE the drain wait begins. If the service manager kills the process during the drain (window), the durable marker is already written so the next gateway boot can recover in-flight sessions. On graceful drain completion, clear the early markers for sessions that finished successfully.
Contributor
🔎 Lint report:
|
This was referenced May 20, 2026
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.
Salvage of #28217 by @LifeJiggy. Extends just-merged #27831 to cover the SIGKILL-during-drain edge case.
What:
mark_resume_pendingwas called AFTER drain timeout. If the service manager hard-kills the process mid-drain (e.g. systemdTimeoutStopSecexceeded before drain completes), the post-drain marker is never written and in-flight sessions lose their durable resume hint.How:
resume_pendingBEFORE entering the drain wait, usingrestart_timeout/shutdown_timeoutas the reason depending on the stop cause.clear_resume_pendingon sessions that finished during the window, so they don't carry a stale flag into the next boot._interrupt_running_agents().Original PR: #28217