Skip to content

Gracefully drain exec-server on shutdown signals#20534

Draft
starr-openai wants to merge 4 commits intomainfrom
starr/exec-server-graceful-drain
Draft

Gracefully drain exec-server on shutdown signals#20534
starr-openai wants to merge 4 commits intomainfrom
starr/exec-server-graceful-drain

Conversation

@starr-openai
Copy link
Copy Markdown
Contributor

@starr-openai starr-openai commented Apr 30, 2026

Summary

  • add exec-server-specific shutdown config with a default 30s drain timeout and CLI override
  • stop accepting new websocket connections on SIGINT/SIGTERM while existing work drains
  • reject new process starts and HTTP requests during drain; force remaining sessions on timeout or second signal
  • add focused config, CLI, and signal-drain tests

Validation

  • just fmt
  • remote Applied devbox: bazel test --bes_backend= --bes_results_url= //codex-rs/exec-server:exec-server-unit-tests //codex-rs/exec-server:exec-server-websocket-test //codex-rs/exec-server:exec-server-shutdown-test //codex-rs/cli:cli-unit-tests

@starr-openai starr-openai force-pushed the starr/exec-server-graceful-drain branch from 5fb4ab9 to ee3399d Compare May 1, 2026 00:03
Copy link
Copy Markdown
Contributor

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5fb4ab9905

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread codex-rs/exec-server/src/server/transport.rs
Comment thread codex-rs/exec-server/src/server/processor.rs
@starr-openai starr-openai force-pushed the starr/exec-server-graceful-drain branch from ee3399d to f6b3eec Compare May 1, 2026 00:13
Add dedicated exec-server shutdown config and signal handling so the listener stops accepting new websocket connections while existing work drains up to a configurable timeout. Reject new process starts and HTTP requests once drain begins, and force remaining sessions on timeout or a second signal.

Add focused config, CLI, and signal shutdown tests for drain, timeout, second signal, and new connection/start rejection behavior.

Co-authored-by: Codex <noreply@openai.com>
@starr-openai starr-openai force-pushed the starr/exec-server-graceful-drain branch from f6b3eec to 6220442 Compare May 1, 2026 02:17
@starr-openai starr-openai changed the title Add graceful drain for exec-server shutdown Gracefully drain exec-server on shutdown signals May 1, 2026
@starr-openai starr-openai marked this pull request as draft May 1, 2026 02:17
starr-openai and others added 3 commits April 30, 2026 19:24
Reap completed websocket connection tasks while serving so long-running exec-server processes do not retain finished JoinSet entries.

Track all in-flight JSON-RPC request handlers in the drain state before declaring shutdown idle, covering non-process/non-http RPCs as well as the existing process and HTTP drain checks.

Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Codex <noreply@openai.com>
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.

1 participant