Skip to content

[codex] Add exec-server SIGTERM shutdown#21305

Open
richardopenai wants to merge 9 commits into
mainfrom
codex/exec-server-sigterm-shutdown
Open

[codex] Add exec-server SIGTERM shutdown#21305
richardopenai wants to merge 9 commits into
mainfrom
codex/exec-server-sigterm-shutdown

Conversation

@richardopenai
Copy link
Copy Markdown
Contributor

Summary

  • Add Unix SIGTERM handling to codex exec-server so the service stops accepting new WebSocket connections and shuts down cleanly.
  • Thread a cancellation token through active connection processing so in-flight reads and route handling can exit promptly.
  • Drain all exec-server sessions during process shutdown and terminate owned child processes through the existing process shutdown path.

Impact

This makes standalone exec-server behave like a long-lived service when a supervisor or user sends SIGTERM, instead of relying on abrupt process termination.

Validation

  • just fmt
  • cargo test -p codex-exec-server --test process exec_server_sigterm_shuts_down_gracefully
  • cargo test -p codex-exec-server --test process
  • cargo test -p codex-exec-server
  • just fix -p codex-exec-server
  • Manual local end-to-end test against target/debug/codex exec-server over raw WebSocket: initialize, start a long-running shell process, send SIGTERM to exec-server, verify exit code 0, WebSocket disconnect, and child process cleanup.

Notes

  • just bazel-lock-update and just bazel-lock-check could not run locally because bazel is not installed in this environment.

@richardopenai richardopenai marked this pull request as ready for review May 6, 2026 04:54
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: 17de186436

ℹ️ 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/tests/process.rs
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