mirror of
https://github.com/openai/codex.git
synced 2026-10-23 18:08:45 +00:00
Explain session creation failures during server shutdown (#52721)
## Why
Graceful shutdown rejects new sessions with an invalid-request error. Give clients a structured shutdown reason and show command center users why session creation is paused.
## What changed
- Add `data: {"reason":"serverShuttingDown"}` to app-server shutdown admission errors while retaining JSON-RPC code `-32600`.
- Show a dedicated shutdown message explaining the wait for active turns and automatic reconnection for non-embedded servers. Recognize older servers by their exact draining message only when error data is absent, and preserve retained-worktree cleanup guidance.
- Keep the command center reconnect presentation when a shutdown error covers the initial overview and no conversation is open.
## Testing
Extend admission and WebSocket shutdown assertions, add embedded and daemon shutdown message snapshots, and cover reconnection with a shutdown error over the initial command center.
GitOrigin-RevId: f167144c0ddc77872afdf3daac8bb1c89f3425b4
This commit is contained in:
@@ -8,7 +8,9 @@ pub(crate) const OVERLOADED_ERROR_CODE: i64 = -32001;
|
||||
pub const INPUT_TOO_LARGE_ERROR_CODE: &str = "input_too_large";
|
||||
|
||||
pub(crate) fn server_draining_error() -> JSONRPCErrorError {
|
||||
invalid_request("Server is draining; retry after reconnecting")
|
||||
let mut error = invalid_request("Server is draining; retry after reconnecting");
|
||||
error.data = Some(serde_json::json!({ "reason": "serverShuttingDown" }));
|
||||
error
|
||||
}
|
||||
|
||||
pub(crate) fn invalid_request(message: impl Into<String>) -> JSONRPCErrorError {
|
||||
|
||||
Reference in New Issue
Block a user