mirror of
https://github.com/openai/codex.git
synced 2026-11-24 23:22:05 +00:00
Gate new turn submissions on host shutdown admission (#43943)
## Why Hosts need to stop new turn-input work during shutdown without consuming pending input or preventing already-running delegated work from finishing. ## What changed - Add an optional `TurnStartAdmission` extension gate, checked before reserving or starting a new turn. Hosts without a gate retain existing behavior. - Return `NotSubmittedReason::ServerDraining` for refused starts and surface an app-server error instructing clients to reconnect and retry. - Keep steering, parent-delegated subagent input, and memory-only mailbox wakeups available during drain, while gating automatic starts. - Close realtime conversations with an ordered handoff, error, and close event sequence when a handoff is refused during drain. ## Testing Add regression coverage for rejected input staying out of subsequent requests, persisted queue items remaining available for later starts, delegated agent and review work completing during drain, mailbox wakeups, and realtime handoff error ordering. GitOrigin-RevId: 03dbdcd71eab200e597c0649e6eb39bd92dbc82f
This commit is contained in:
1 parent
973dcd80fc
commit
7c098d8741
11 files changed
+510
-8
No files matched your search
@@ -667,7 +667,11 @@ impl TurnRequestProcessor {
|
||||
TurnInputSubmission::Started { turn_id } => (turn_id, true),
|
||||
TurnInputSubmission::Steered { turn_id } => (turn_id, false),
|
||||
TurnInputSubmission::NotSubmitted { reason } => {
|
||||
let error = internal_error(format!("failed to submit turn input: {reason:?}"));
|
||||
let error = if reason == NotSubmittedReason::ServerDraining {
|
||||
crate::error_code::server_draining_error()
|
||||
} else {
|
||||
internal_error(format!("failed to submit turn input: {reason:?}"))
|
||||
};
|
||||
self.track_error_response(&request_id, &error, /*error_type*/ None);
|
||||
return Err(error);
|
||||
}
|
||||
@@ -1067,6 +1071,9 @@ impl TurnRequestProcessor {
|
||||
SteerSubmission::Steered { turn_id } => turn_id,
|
||||
SteerSubmission::NotSubmitted { reason } => {
|
||||
let (message, data, error_type) = match reason {
|
||||
NotSubmittedReason::ServerDraining => {
|
||||
return Err(crate::error_code::server_draining_error());
|
||||
}
|
||||
NotSubmittedReason::NoActiveTurn | NotSubmittedReason::NotIdle => (
|
||||
"no active turn to steer".to_string(),
|
||||
None,
|
||||
|
||||
Reference in new issue
Block a user