Skip to content

fix(supervisor): reply before graceful shutdown - #995

Merged
kvinwang merged 2 commits into
masterfrom
codex/fix-supervisor-shutdown-response
Aug 4, 2026
Merged

fix(supervisor): reply before graceful shutdown#995
kvinwang merged 2 commits into
masterfrom
codex/fix-supervisor-shutdown-response

Conversation

@kvinwang

@kvinwang kvinwang commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator

Summary

Return the Supervisor shutdown response before notifying Rocket to stop, so clients receive the result instead of losing the connection to an immediate process exit. Signal-triggered shutdown retains the existing forced-exit behavior.

Verification

  • cargo test --manifest-path dstack/Cargo.toml -p supervisor
  • cargo fmt --manifest-path dstack/Cargo.toml --all
  • git diff --check

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adjusts the Supervisor’s HTTP shutdown endpoint to stop the Rocket server after producing a shutdown result, so clients are less likely to lose the connection due to immediate process termination. It preserves the existing “forced exit” behavior for signal-triggered shutdowns.

Changes:

  • Update the /shutdown route to call Supervisor::shutdown() directly and only then trigger Rocket’s graceful shutdown notification.
  • Keep signal-triggered shutdown behavior routed through the existing forced-exit path.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread dstack/supervisor/src/web_api.rs Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@kvinwang
kvinwang enabled auto-merge August 4, 2026 11:25
@kvinwang
kvinwang merged commit 256380c into master Aug 4, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants